No video

Adafruit Trinket M0 and CircuitPython

  Рет қаралды 39,953

Gary Explains

Gary Explains

Күн бұрын

The Adafruit Trinket M0 is an Arm Cortex-M0 microcontroller board that can be used with the Arduino IDE, but if you aren't familiar with the C programming language then you can use the Trinket M0 with Python instead.
BUY TRINKET M0:
geni.us/ZVxZ (Adafruit)
geni.us/783cB (Amazon)
Example code: github.com/gar...
Introduction to Android app development: www.dgitacadem...
Let Me Explain T-shirt: teespring.com/...
Twitter: / garyexplains
Instagram: / garyexplains
#garyexplains

Пікірлер: 75
@ravimali2814
@ravimali2814 4 жыл бұрын
Nice video good to know about CircuitPython. Please make more videos based on this.
@dtvking
@dtvking 4 жыл бұрын
I would like to see it measure voltage if possible such as switching a relay on at one voltage and off at another voltage. I was thinking of getting into raspberry pi but this may be a cheaper way for the basic use I would need it for. You make it look so easy to do so please more on these types of devices. Thanks
@FlyByPC
@FlyByPC 4 жыл бұрын
Arduinos and similar boards can easily measure voltages and make decisions based on that. I'm just learning CircuitPython myself, but in C, this would be something like if(analogRead(A0)>512{foo;}else{bar;}}
@piiumlkj6497
@piiumlkj6497 4 жыл бұрын
Doesn't look much easier than C , in fact I think for simple uses C is easier (the blink sketch for example). That said I recognize the power of Python , especially when handling data (which can be a nightmare in C/C++) but I don't think anyone would need to handle any complicated data on a microcontroller.
@aphalunj
@aphalunj 4 жыл бұрын
You can use both if you like.
@slacker2101
@slacker2101 4 жыл бұрын
I can'r see a link to purchase the board. Very informative introduction to working with it. I would like to see more in depth.
@GaryExplains
@GaryExplains 4 жыл бұрын
Sorry about that I forget to add them to the description. Fixed now.
@MrBobWareham
@MrBobWareham 4 жыл бұрын
Thank you, Gary, sorry I can purchase one as I got one a year ago that is in my drawer but now watching your video I think I will get it out and have a go so any more videos would be good thanks, Bob, in the Uk
@andrewzuo86
@andrewzuo86 4 жыл бұрын
An interpreted language on an embedded system. Nice!
@jamess1787
@jamess1787 4 жыл бұрын
I call a high level of tom-foolery. No 'language' runs on a microcontroller except for binary. Last I checked: processors only used *ASM instruction sets represented by machine code and not an interpreter. The blinking-error fancy footwork is probably just the IDE flashing the LED with the error-logic defined within the software before 'converting' the un-interpreted erroneous code. ... Just my ungoogling skepticism, could be totally wrong but I have a feeling that I'm bang on. Only way to convince me otherwise is to pull the source code directly off the flash once it's been programmed.
@mikescholz6429
@mikescholz6429 4 жыл бұрын
You dont compile anything, you upload plain text files with .py extension to it by dragging and dropping the same way you would with a thumb drive and every time main.py is updated it is automatically executed
@jamess1787
@jamess1787 4 жыл бұрын
@@mikescholz6429 once you do this, and delete the files from your computer: is there any way to retrieve the .py or .pyc file from the trinket device? (If not, then that answers any question of how you program an MCU using Python... You don't 😯😜)
@mikescholz6429
@mikescholz6429 4 жыл бұрын
James S yes you can open the .py file directly from the board in a text editor, make changes and as soon as you click save it starts executing the new code. There are binary compiled libraries on the board as well that comprise the actual interpreter but your actual loop stays in plain text. Also if you get one of the boards with the M4 cortex that has like 4 times as much ram it can do some decently heavy lifting. The chip is linked to IIRC a 4mb flash memory chip that holds your code as well as bitmaps, wav files or whatever else you may need. I have a setup that plays bitmap files on addressable LED strips where each row of pixels is one frame of the length of the strip and sequentially writes each row going down the image.
@jamess1787
@jamess1787 4 жыл бұрын
@@mikescholz6429 So the MCU can't actually be programmed with Python, there's a subsystem on the chip, just like on your computer, that interprets the code and runs it on the processor. Perfect. :). Exactly as I thought. :D. Thanks for the clarification. Cool that it has removable storage!
@rodproctor5466
@rodproctor5466 4 жыл бұрын
Would you please describe how to see what is in the libraries that support the hardware functions.
@GaryExplains
@GaryExplains 4 жыл бұрын
This is probably a good starting place: circuitpython.org/libraries
@rodproctor5466
@rodproctor5466 4 жыл бұрын
Thanks for the reference. I'd looked at that before and couldn't find what I was looking for. What I found this time was the API Reference documents. I wanted to know is what all the functions were available from a specific library module. I really enjoy your channel!
@bewilderedlearningevolving
@bewilderedlearningevolving 3 жыл бұрын
@@rodproctor5466 I think what you're asking for is a combination of inspecting in realtime docs.python.org/3/library/functions.html#dir and further reference for the functions themselves github.com/adafruit/circuitpython
@aoikishu
@aoikishu 3 жыл бұрын
If anyone else doesn't get theirs to blink, save as code.py instead of main.py or remove the code.py that's already in your CIRCUITPY directory.
@JoelJosephReji
@JoelJosephReji 4 жыл бұрын
That was cool!
@pfabiszewski
@pfabiszewski 4 жыл бұрын
Could you make a comparison between CircuitPython one C when using with Arduino? Pros and cons of both? Cheers
@AnonEeMouse
@AnonEeMouse 4 жыл бұрын
What else can you build with this tiny chip and can it run off a 9 volt battery? I assume from its size it would be quite cheap.
@tannewt
@tannewt 4 жыл бұрын
It cannot run directly off of a 9 volt because the regulator can only handle up to 5v.
@maneki9neko
@maneki9neko 4 жыл бұрын
Nicely done . .
@awerealis
@awerealis 4 жыл бұрын
I'd love to see it control sound. Nothing monumental just a PC Speaker single square wave would be quite impressive imho
@NoahHornberger
@NoahHornberger 4 жыл бұрын
increase the frequency of the on and off example and send it through a speaker, there you go
@AidenMi
@AidenMi 3 жыл бұрын
would themis work for the PyRuler also?
@AidenMi
@AidenMi 3 жыл бұрын
this*
@RocktCityTim
@RocktCityTim 4 жыл бұрын
Servo controller!
@Saketh-Chandra
@Saketh-Chandra 4 жыл бұрын
Can I know the differences between Micropython vs Circuitpython?
@vinaybharadwaj802
@vinaybharadwaj802 4 жыл бұрын
Circuitpython is a derivative of micropython developed and maintained by Adafruit. It makes the language simpler and education friendly.
@Saketh-Chandra
@Saketh-Chandra 4 жыл бұрын
@@vinaybharadwaj802 Thank you, And what about libraries? Aren't they are same
@tannewt
@tannewt 4 жыл бұрын
@@Saketh-Chandra CircuitPython has a larger collection of libraries designed for it's hardware API that do not work directly with MicroPython.
@summerlaverdure
@summerlaverdure 3 жыл бұрын
this video was helpful, but kind of annoying that we didnt see boot time from power to running, i wanted to see how small that was
@diystem8126
@diystem8126 4 жыл бұрын
how can i connect to ultra sonic sensor
@harishhanchinal2838
@harishhanchinal2838 4 жыл бұрын
Thank you. Could you please show me the link to purchase it.
@GaryExplains
@GaryExplains 4 жыл бұрын
The link in the description.
@supersu6138
@supersu6138 4 жыл бұрын
Hi Gary its kind of irrelevant but still can u suggest me any unique project to work on using Arduino or rasp.pi just for learning something innovative plz help me
@abpccpba
@abpccpba 4 жыл бұрын
You are already on youtube so do a search for say LCD 'liquid crystal display ' see what comes up. "innovative" has no meaning here; everything you will see already exists. If you go to Arduino or Adafruit learn sections you will see very elaborate tutorials for there products. The last point to do this type of hobby being inquisitive is a must. In most cases when you ask a question of the host on youtube it should be about what they have presented otherwise as you can see He did not answer your request. When searching be as specific as you can.
@marcusk7855
@marcusk7855 3 жыл бұрын
The Basic Stamp was doing this 30 years ago. With BASIC though not python.
@theengineer9910
@theengineer9910 4 жыл бұрын
I love circuit Python but this board has no space at all which is frustrating cause I wanted to use the libraries CP can use for audio stuff
@tannewt
@tannewt 4 жыл бұрын
Yup! M4 and nRF52840 boards will store and run more CircuitPython code than an M0 will (and run faster too!)
@stellarorbit1341
@stellarorbit1341 4 жыл бұрын
I’ve never been this early before
@jackwhite3820
@jackwhite3820 4 жыл бұрын
What about Micropython?
@elvingonzalez8932
@elvingonzalez8932 4 жыл бұрын
Where can I download the IDE to code the trinket please??
@tannewt
@tannewt 4 жыл бұрын
codewith.mu
@1MarkKeller
@1MarkKeller 4 жыл бұрын
*GARY!!!* *Bonjour Professeur!* *Bonjour Camarades De Classe!*
@GaryExplains
@GaryExplains 4 жыл бұрын
MARK!!! Bonjour!!!
@briandsouza7854
@briandsouza7854 4 жыл бұрын
Sir
@fvgoya
@fvgoya 4 жыл бұрын
Like before watch...
@1MarkKeller
@1MarkKeller 4 жыл бұрын
*So say we all!*
@zetaconvex1987
@zetaconvex1987 4 жыл бұрын
The big problem as I see it is that it costs $9 and you only get 5 GPIO pins. There's much better value to be had out there, surely.
@toddmarshall7573
@toddmarshall7573 4 жыл бұрын
What we're going to do is we're going to
@reiniertl
@reiniertl 4 жыл бұрын
Interesting but I better learn C than going through the pain of using such debugging capabilities. C is hard but not so much, it just needs a bit of discipline and a couple of good reference sources around you.
@bluegizmo1983
@bluegizmo1983 4 жыл бұрын
I'm sure you already realized this, but that orange power wire you put on the breadboard at 9:50 was totally pointless and not needed for that circuit or any other circuits you showed lol.
@racketman2u
@racketman2u 4 жыл бұрын
really? how would the LED be powered, then, without a positive rail?
@TachirosLament
@TachirosLament 3 жыл бұрын
Mega Newbie alert: how could i go about figuring out if this language and that board would be ideal to operate a nerf gun. i know i'll need to connect a microswitch for the trigger, a solenoid to be triggered by the microswitch, a 9v battery source and two step button to turn it on and off. maybe a capacitor might be needed supply consistent pot to the noid.
@PATRIK67KALLBACK
@PATRIK67KALLBACK 4 жыл бұрын
Great for the kids who don't like C/C++.
@alliejr
@alliejr 4 жыл бұрын
Excellent! But as with _all_ modern software development, it's not about the language, it's about the framework (libraries). C, C++, Rust, Python, Java, JavaScript, Ruby, Perl... yada yada-- the syntactic differences are minor and once you know one, you can figure out the rest. The real "learning" is to learn and understand the _library_ (import board, digitalio, etc.) , as seen in your example which would look 99% the same in any of these languages, but knowing JavaScript or C instead of Python is not going to help you know how the libary works and what it does.
@TR7H
@TR7H 4 жыл бұрын
You're mostly correct but I'll have to disagree slightly. What you said is true in most of high level software development but breaks down when getting closer to the actual hardware. It makes a metric ton of difference whether you know C or python when your writing firmware/ other microcontroller code. This is due to the fact that at sufficiently low levels, the language you're writing needs to conform to the actual hardware without any abstraction layers making your life easier. It's fine and dandy blinking some LEDs with circuit python (which is actually just a sort of perverted C wrapper) but when, for example, reading data from a I2C connected sensor you really need to understand actual silicon register sizes, pointers and all sort of low level stuff that simply isn't present in python.
@alliejr
@alliejr 4 жыл бұрын
TR7H Fair.
@rezag.o.m5680
@rezag.o.m5680 2 жыл бұрын
جوووون
@pamus6242
@pamus6242 4 жыл бұрын
6:06 ..... that is the worst sharpener you could have used on a pencil!!!
@detaart
@detaart 4 жыл бұрын
The performance is undoubtedly horrid when compared to C. You're saving a python script straight to some emulated usb mass storage. It then has to take that and compile it into bytecode if it wants any chance in hell of having any kind of performance at all. It needs to run an OS with all the overhead that comes with that, etc. The only things i can see this being useful for are things like IOT or somehow data processing (which an MCU would be bad for anyway). I don't see the point.
@johnnycernato4068
@johnnycernato4068 4 жыл бұрын
The point is easy access to newcommers, easier development for more complex applications and data processing. Of course the performance is 'horrible' compared to c, but let's be honest: A well programmed Arduino is more than powerful enough for almost all IoT projects, but the atmega is almost 20 years old. The ESP32 has a dual-core arm processor and tons of interfaces and hardware extentions, is cheaper than an arduino and still (running python) more powerfull than the atmega. Moore's law also applies to MCUs and it is high time for another abstraction layer. The arduino project was a milestone over 15 years ago, making MCUs accessible to makers, providing an easy to use IDE/compiler and acess via usb/uart (MCU development kits were proprietary and expensive until then). Micropython (or equivalent) even get rid of (cross-)compiling and makes testing, developing and deploying even easier. I highly recommend trying it yourself! Cheers!
@Metroid1890
@Metroid1890 4 жыл бұрын
What a crappy way to inform the user there has been an error in the code
@tannewt
@tannewt 4 жыл бұрын
The flashes are for the case where you don't have a computer handy. If a screen is attached it will show the error just like the serial output.
@kitKat-by6kk
@kitKat-by6kk 11 ай бұрын
please stop poking your circuits with a graphite pencil... 🔥
@Avidiy
@Avidiy 5 ай бұрын
Very true, graphite is conductive, and may short the wrong pins and BOOM! great video though
@paulcosta8297
@paulcosta8297 4 жыл бұрын
This Python crap is so hateable, dysfunctional, and unsuited to any serious endeavors. Not to mention I find C easier.
@GmanBB
@GmanBB 3 жыл бұрын
It's a good idea, but bad execution. Make small series and start it simple. For 6 years old kid simple. Want to learn how to execute right? Take a kid and start teach him or her. Then make 3-5 minute lessons on youtube.
@GaryExplains
@GaryExplains 3 жыл бұрын
In your ever so humble opinion.
@PATRIK67KALLBACK
@PATRIK67KALLBACK 4 жыл бұрын
Great for the kids who don't like C/C++.
I run untested, viewer-submitted code on my 500-LED christmas tree.
45:17
STM32 Blue Pill vs Black Pill Microcontroller Boards
18:31
Gary Explains
Рет қаралды 136 М.
Мы сделали гигантские сухарики!  #большаяеда
00:44
managed to catch #tiktok
00:16
Анастасия Тарасова
Рет қаралды 42 МЛН
Parenting hacks and gadgets against mosquitoes 🦟👶
00:21
Let's GLOW!
Рет қаралды 13 МЛН
Choosing a Board for CircuitPython   A Few Important Considerations
18:10
John Gallaugher
Рет қаралды 3,1 М.
Seeeduino XIAO - 32-bit Arduino-compatible Microcontroller
41:54
DroneBot Workshop
Рет қаралды 249 М.
Limor Fried, Founder & CEO, Adafruit Industries | MAKERS
4:48
Build Your Own Arduino Like Board For Just a Few Dollars
20:48
Gary Explains
Рет қаралды 81 М.
GPIO for any PC or Laptop: Adafruit FT232H
19:18
ExplainingComputers
Рет қаралды 200 М.
Using the adafruit_led_animations library
26:10
John Gallaugher
Рет қаралды 2,9 М.
I tried finding Hidden Gems on AliExpress AGAIN! (Part 5)
14:11
GreatScott!
Рет қаралды 1,1 МЛН
Top Fifteen Mistakes People Make When Designing Prototype PCBs
12:26
Cosplay Light and Sound
Рет қаралды 146 М.
Raspberry Pi RP2350  - Testing its FPU and SHA256 Performance
7:47
Gary Explains
Рет қаралды 9 М.
Мы сделали гигантские сухарики!  #большаяеда
00:44