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.com/micropytho...
- MicroPython Basics: What is MicroPython guide (see this for links to other MicroPython Basics guides): learn.adafruit.com/micropytho...
- Adafruit MicroPython tool: github.com/adafruit/ampy
- Atom text editor: atom.io/
- Visual Studio Code text editor: code.visualstudio.com/
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/subscribe
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.com/
Music by bartlebeats: / bartlebeats
-----------------------------------------

Пікірлер: 40

  • @arzoch
    @arzoch7 жыл бұрын

    These videos are really helpful. Thanks for taking the time to make them, Tony!

  • @liveartrainbow
    @liveartrainbow5 жыл бұрын

    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.

  • @georgettewebb2900
    @georgettewebb29005 жыл бұрын

    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.

  • @dicktonyboy
    @dicktonyboy6 жыл бұрын

    You are a star! Thank you for all of your efforts, they are very much appreciated.

  • @chewbone
    @chewbone7 жыл бұрын

    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.

  • @teddynugent
    @teddynugent8 жыл бұрын

    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!

  • @rsyoung01
    @rsyoung018 жыл бұрын

    Just what I needed to help get started! Thanks so much...

  • @harryperks2717
    @harryperks27173 жыл бұрын

    LIGHT BULBS coming on. Many thanks, very helpful tutorial.

  • @SolracOlas
    @SolracOlas7 жыл бұрын

    Thanks for the great tutorial and for the ampy tool!

  • @SAlexandert8
    @SAlexandert87 жыл бұрын

    I'm on windows and ampy works great! Looking forward to more MicroPy videos!

  • @raccoonnyc
    @raccoonnyc7 жыл бұрын

    Nicely done. Enjoyed it very much.

  • @Nordic_Goon
    @Nordic_Goon3 жыл бұрын

    This is exactly what I was looking for.

  • @kristerl939
    @kristerl9398 жыл бұрын

    As always, thanks, thumbs up :)

  • @SzymonJakubiak
    @SzymonJakubiak8 жыл бұрын

    Great tutorial, thank you Tony.

  • @frab88
    @frab888 жыл бұрын

    Really helpful, thanks

  • @MaxGoddur
    @MaxGoddur6 жыл бұрын

    Excellent, time to break out the ESP boards.

  • @mattnelson8864
    @mattnelson88648 жыл бұрын

    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.

  • @randmorf
    @randmorf7 жыл бұрын

    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?

  • @bennguyen1313
    @bennguyen13132 жыл бұрын

    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.

  • @varadmohan
    @varadmohan7 жыл бұрын

    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.

  • @Herebuss
    @Herebuss6 жыл бұрын

    Saved, it was causing grief trying to code larger sketches through WebRepl.

  • @martonkotyuk1031
    @martonkotyuk10314 жыл бұрын

    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.

  • @stawolf73
    @stawolf737 жыл бұрын

    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?

  • @mrf604
    @mrf6047 жыл бұрын

    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.

  • @marcelocorrea7916
    @marcelocorrea79163 жыл бұрын

    Is there a way use ampy to get/put all project at once? its possible? like "ampy -p PORT get /"

  • @ShivaShankars
    @ShivaShankars4 жыл бұрын

    how can you use upip and import the library

  • @JM_Tushe
    @JM_Tushe2 жыл бұрын

    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.

  • @OttovanZanten
    @OttovanZanten6 жыл бұрын

    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

    @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 :)

  • @MrSwan-tm5wj
    @MrSwan-tm5wj6 жыл бұрын

    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...

  • @SuilujChannel
    @SuilujChannel6 жыл бұрын

    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

  • @user-zg6db6rv8r
    @user-zg6db6rv8r7 жыл бұрын

    useful!!!!!

  • @tomverschueren3556
    @tomverschueren35566 жыл бұрын

    Hello, When I code micropython in an editor, i get errors for the 'import machine' line. Is there a way to avoid this?

  • @SuilujChannel

    @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.

  • @testbed5290
    @testbed52906 жыл бұрын

    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.

  • @Arvinthhh
    @Arvinthhh4 жыл бұрын

    Is these amy commands same for windows?

  • @rahulkhokhariya2686
    @rahulkhokhariya26865 жыл бұрын

    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

    @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

  • @AlanMedina314
    @AlanMedina3147 жыл бұрын

    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.

Келесі