So i managed to load micropython on to one of my ESP32 devices. I am not clear how I load python code onto the board though. The docs weren't super clear on this. Any hints?

#esp32 #micropython #python #microcontroller

The plan is to write some code that detects when a pin changes state, star a timer, and then output the time when a second pin changes state (timer between when a ball interrupts an optical beam and when it interrupts a different optical beam.

@dlakelan I think I remember *something* about the ESP32 not being straightforward. I think it doesn't have native USB, so you won't get the drag-and-drop experience - normally a micropython board will show up as a removable drive after flashing.

If you pull up the serial device exposed by the ESP32 though, you should have access to a micropython REPL.

I dimly remember using the WebREPL... Look into that, maybe? You'll have to set up the WiFi once through the REPL but once you do that you'll be able to put the setup into the main.py.

@nepi

I definitely have the serial console, so that's great. But it definitely doesn't show up as a USB drive or anything.

@dlakelan Yeah, and I think pretty much all the micropython tutorials expect that it does, which is where I got lost on the ESP32 stuff. But the WebREPL should give you filesystem access IIRC.

@nepi

I guess to get the webrepl running I have to get the ESP32 online though right? Anyway I found a solution rshell :

https://github.com/dhylands/rshell

It lets you copy files to the board, and then drop into the shell and execute commands. so that'll be perfect!

GitHub - dhylands/rshell: Remote Shell for MicroPython

Remote Shell for MicroPython. Contribute to dhylands/rshell development by creating an account on GitHub.

GitHub
@dlakelan Oh this project feels very familiar. I think I had some trouble with it and just ended up configuring wifi through the serial console. Glad it worked for you!

@nepi

I'll see how it works once I have some actual code I want to upload. I haven't programmed python since the late 1990s so I'm gonna need to get up to speed again ;-)

Fortunately it should be extremely easy to get the basics working.