MicroPython Basics: Load Files & Run Code with Tony D! @micropython

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ต.ค. 2024

ความคิดเห็น • 40

  • @chewbone
    @chewbone 7 ปีที่แล้ว +2

    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.

  • @arzoch
    @arzoch 7 ปีที่แล้ว

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

  • @liveartrainbow
    @liveartrainbow 6 ปีที่แล้ว

    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
    @georgettewebb2900 6 ปีที่แล้ว

    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.

  • @harryperks2717
    @harryperks2717 3 ปีที่แล้ว

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

  • @teddynugent
    @teddynugent 8 ปีที่แล้ว

    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!

  • @Nordic_Goon
    @Nordic_Goon 3 ปีที่แล้ว

    This is exactly what I was looking for.

  • @rsyoung01
    @rsyoung01 8 ปีที่แล้ว

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

  • @raccoonnyc
    @raccoonnyc 8 ปีที่แล้ว

    Nicely done. Enjoyed it very much.

  • @SolracOlas
    @SolracOlas 7 ปีที่แล้ว

    Thanks for the great tutorial and for the ampy tool!

  • @SAlexandert8
    @SAlexandert8 7 ปีที่แล้ว

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

  • @mattnelson8864
    @mattnelson8864 8 ปีที่แล้ว

    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.

  • @MaxGoddur
    @MaxGoddur 7 ปีที่แล้ว +1

    Excellent, time to break out the ESP boards.

  • @kristerl939
    @kristerl939 8 ปีที่แล้ว

    As always, thanks, thumbs up :)

  • @JM_Tushe
    @JM_Tushe 2 ปีที่แล้ว

    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.

  • @stawolf73
    @stawolf73 7 ปีที่แล้ว

    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?

  • @marcelocorrea7916
    @marcelocorrea7916 4 ปีที่แล้ว

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

  • @varadmohan
    @varadmohan 8 ปีที่แล้ว

    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.

  • @SuilujChannel
    @SuilujChannel 6 ปีที่แล้ว

    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

  • @SzymonJakubiak
    @SzymonJakubiak 8 ปีที่แล้ว

    Great tutorial, thank you Tony.

  • @mrf604
    @mrf604 8 ปีที่แล้ว +1

    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.

  • @Herebuss
    @Herebuss 7 ปีที่แล้ว

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

  • @martonkotyuk1031
    @martonkotyuk1031 4 ปีที่แล้ว

    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.

  • @bennguyen1313
    @bennguyen1313 2 ปีที่แล้ว

    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.

  • @ShivaShankars
    @ShivaShankars 4 ปีที่แล้ว

    how can you use upip and import the library

  • @frab88
    @frab88 8 ปีที่แล้ว +1

    Really helpful, thanks

  • @rahulkhokhariya2686
    @rahulkhokhariya2686 5 ปีที่แล้ว

    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

  • @randmorf
    @randmorf 7 ปีที่แล้ว

    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?

  • @tomverschueren3556
    @tomverschueren3556 7 ปีที่แล้ว

    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
    @testbed5290 6 ปีที่แล้ว

    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
    @Arvinthhh 4 ปีที่แล้ว

    Is these amy commands same for windows?

  • @MrSwan-tm5wj
    @MrSwan-tm5wj 6 ปีที่แล้ว

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

  • @OttovanZanten
    @OttovanZanten 6 ปีที่แล้ว

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

  • @AlanMedina314
    @AlanMedina314 7 ปีที่แล้ว

    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.

  • @游曜瑜-s3e
    @游曜瑜-s3e 7 ปีที่แล้ว

    useful!!!!!