MicroPython Basics: Load Files & Run Code with Tony D! @micropython
Live stream to / adafruit showing how to load files and run code from your computer on a MicroPython board. Using a simple command line tool you can setup an 'Arduino-like' workflow to edit MicroPython code on your computer and have it run on a board.
Links mentioned in the video:
- MicroPython Basics: Load Files & Run Code guide: learn.adafruit...
- MicroPython Basics: What is MicroPython guide (see this for links to other MicroPython Basics guides): learn.adafruit...
- Adafruit MicroPython tool: github.com/ada...
- Atom text editor: atom.io/
- Visual Studio Code text editor: code.visualstu...
Acknowledgements:
- Music: bartlebeats
- Intro shuttle footage: NASA
- Intro fonts: Typodermic
- Intro inspiration: Mr. Wizards's World
- Matrix background: cool-retro-term & cmatrix
-----------------------------------------
Visit the Adafruit shop online - www.adafruit.com
Subscribe to Adafruit on KZread: adafru.it/subsc...
Join our weekly Show & Tell on G+ Hangouts On Air: adafru.it/showtell
Watch our latest project videos: adafru.it/latest
New tutorials on the Adafruit Learning System: learn.adafruit....
Music by bartlebeats: / bartlebeats
-----------------------------------------
Пікірлер: 40
Thank you Tony for the rich information and teaching you are providing . Definitely , Adafruit is the best company that is building the basics of open sources and open education that will help help humanity to move forward fast for a better and smart future.I really appreciate such initiatives.
A tip for you guys. To automatically run saved python files, I installed fswatch on my Mac using homebrew. It triggers when monitored files change. Run any updated file: fswatch *.py | xargs -I {} ampy run -n {} Upload any updated file: fswatch *.py | xargs -I {} ampy put {} Run only a specific file: fswatch blink.py | xargs -I {} ampy run -n {} There are probably other ways, but this one works for me.
These videos are really helpful. Thanks for taking the time to make them, Tony!
I’ve learnt a lot from your videos. Love the detail and examples you use. The way you introduce different hardware, keeps me buying from Adafruit. Keep up the good work Tony.
LIGHT BULBS coming on. Many thanks, very helpful tutorial.
Thank you for making this video. I am new to microcontollers and python and this video has helped me get started with the ESP8266 NodeMCU Module!
You are a star! Thank you for all of your efforts, they are very much appreciated.
I'm on windows and ampy works great! Looking forward to more MicroPy videos!
Just what I needed to help get started! Thanks so much...
Cool, will be giving ampy a try tonight. Up and running on webrepl already but it would be nice to not have to hook up to wifi to get to work. That and the instant "run" ability looks like a really handy way to test/fix/test.
Thanks for the great tutorial and for the ampy tool!
This is exactly what I was looking for.
Ideally the device would show up as a mass-storage-device, such that scripts can be dragged over. But instead of a tool (ampy, thonny, mu-editor, Pymakr etc), I think using the REPL interface (rshell, mpfshell) might be the more native way to upload files! As far as executing the file, since Python3 removes execfile("my.py", global_vars, local_vars), is run or runfile the preferred way of executing via REPL? runpy.run_path? exec(open("my.py").read(), globals())? with open("my.py") as f: code = compile(f.read(), "my.py", 'exec') exec(code, global_vars, local_vars) Speaking of globals, if one executes a script that opens/connects the uart/bluetooth and uses a global variable for the interface/handle.. once the script closes does the connection stay open and the handle stays available for other scripts? Reason I ask is that I'd like several scripts to access the same peripheral. For example, can REPL be configured to another UART port, so that my scripts can access the UART connected to the host? Ideally I'd like to have micropython (REPL) running on BOTH cores, one running REPL on the unused serial, while my scripts run on the other core using the UART/USB.
Nicely done. Enjoyed it very much.
Excellent, time to break out the ESP boards.
Hey Tony, Thanks for this excellent tutorial. I do have some suggestion for your Ampy software (v1.01): 1. You should add the --no-output or -n to the help 2. How do your differentiate file and folder from ls command? 3. I try the "Ampy reset" command after I download my main.py but it won't run. I have to Hardware reset the device to work. Is it normal?
Hi Tony D! Thanks for these tutorial videos and all your development efforts with "ampy". Ease of use is certainly a prerequisite for making a product/tool popular. "Ampy" helps make MicroPython a lot easier to use. However, on my Win7-PC, where I'm running Putty for the MicroPython REPL interactive interface and cmd.exe (command.com) for running "ampy", it seems these two apps are constantly fighting each-other for control of COM15 (my USB port id). Usually I have to close down Putty, run the "ampy" command in cmd.exe, then restart Putty and by that time the messages have already passed by. Is there another set of tools (text editor and serial terminal emulator) where these 2 apps are not fighting for control of the COM port? I think ideally, there should be one program that offers both text editing capabilities and terminal emulation capabilities, perhaps in separate "panes" of the same application, with code to share the single COM port between both apps. This would go a long way in helping to create an "IDE" for MicroPython. Perhaps the "ampy" functionality could be added so we don't need to go into cmd.exe to execute "ampy.". Any suggestions? Anybody?
As always, thanks, thumbs up :)
Hi Thony! Thank you for this video, it is very useful for me. I copied those two long commands and will use it later. Thanks! I learned from Your lesson, that writing firmware does not destroy my ESP, I can easily return to Arduino at any time. It's great! But Thony does not work for me, I can use only uPyCraft.
Great tutorial, thank you Tony.
I really enjoyed all the tuts from adafruit and Tony. Its great, specially the ampy. I could see there is I2C module available in ESP8266 micropython. When I try to use this for connecting LCD and pass a message the only thing that happens is the LCD goes off. Can you suggest some tutorial where I can get that working.
Saved, it was causing grief trying to code larger sketches through WebRepl.
Is there a way use ampy to get/put all project at once? its possible? like "ampy -p PORT get /"
Can I upload mpy-files with this? I have no idea how to put them on the board after compile the .py file on my computer.
how can you use upip and import the library
Changes high() and low() to on() and off() then changes on() and off() to value(0) and value(1). Problem is that most previous examples like this one don't use value(0) etc so took me a while to figure out why this didn't work...
I'm using pycharm with wipy2.0. It works but is broken somewhat. I can get a repl and also pycharm uploads main.py fine. You can run your code just like you'd normally do in pycharm except you'll have to put the libararies in lib manually. That don't work.
Really helpful, thanks
Tony thank you for great series. I loaded Ampy on my dreaded Win10 pc. It works great. Then I tried to load it on my favourite Ubuntu 15.04 PC and I got some errors using Pip3. It sort of looked like it installed, but it complained about certain files and folders having not been previously installed, (sorry I don't have a record of what went wrong). I think it was referring to Ampy specific files as opposed to some Ubuntu OS resources. Anyway now at the linux command line if I type 'ampy' it doesn't find the executable. Is there a Path Statement I need? Is there a way to check or re-do the install? I tried the python3 version. On Ubuntu if I type 'python' it runs the 2.7.9 version, where as if I type 'python3' it runs 3.4.3. Any ideas? Can anyone else confirm it installs on Ubuntu with the pip3 method? PS I didn't use the sudo method installing with pip3.
I cannot follow the screen debug shown at 31:50 I can run the program without output but when i open the screen repl it stops and just shows the repl command prompt. My board is Wemos D1 Mini (esp8266) and i use the driver of the wemos website. my device port is /dev/cu.wchusbserial1410 Does someone have a solution? Edit: I just found out that screen print out does work when i run without the no-output -n flag. But of course i would like to use the -n flag so i do not get the error after the ampy run command waits to finish
Is these amy commands same for windows?
First off thanks for all these guides, you sold me on this platform and I recieved my Feather ESP8266 yesterday, soldered on the headers today and I got my first scripts on it and I'm super stoked! There are a few quirks I've found though. In windows 8.1 when I run the ampy run --no-output C:\...\test.py command it doesn't execute any of the code. Same with -n. When I run a simple script where it has to blink the Red Led 10 times and then stops it always blinks the Blue LED once after it's done. If I add the --no-output argument I only get a blink from the Blue Led, but it doesn't actually execute the script. It doesn't bother me, I don't really see the need to use the --no-output argument, so I just won't use it. But I thought it might be a bug or something.
@OttovanZanten
6 жыл бұрын
Also when I run the ampy ls command or I use ampy run to run a random script from my pc it does what it's supposed to like show me the files or run the script and when it's done it also starts running main.py. And I don't get the print statements in the command prompt untill it's done running. So if I only have a short script it finishes every task and then gives me all the print statements at the end all at once. But when I use a while True loop I never get any print statements because it never finishes it's tasks. Also a bit of an inconvenience is that I can't use the Command Prompt and Putty at the same time, because Putty hogs the COM port and that means I can't use the command prompt to check the files on the ESP. So I often have to choose between reading the print statements and being able to run a file (afaik) or switch really quickly. These aren't big issues for me, just things that are good to know if you're interested in this platform and you're a Windows user. I highly recommend installing Linux. Sadly my pc won't let me install a different OS due to UEFI protections. But I'll work around it :)
I used ESP8266 Flasher and esp8266-20170108-v1.8.7.bin All it does is flash its on board led non stop and send garbage to the serial terminal I have tried different baud rates and smae problem. I tried Putty, Tera and Real. I am running nodemcu with 340 chip not ftdi. I am using windows 7.
I have ESP8266. But Script code available till power on. Meaning that it not run after restart device. So, I want to run my script on boot time. Any Solution ?
@scoobyholmes1447
5 жыл бұрын
have you watched the video until the end? If not you should do it because he explains exactly this question from minute 40
Hello, When I code micropython in an editor, i get errors for the 'import machine' line. Is there a way to avoid this?
@SuilujChannel
6 жыл бұрын
i just found the solution: i use visual studio code with pylint. just writ the comment '# pylint: skip-file' above the line with the import module and it will ignore errors for this module.
useful!!!!!