MicroPython and ESP8266 Airboat
Final Application
Now that all the pieces are working independently, I can pull it all together. For the final code (Listing 2), I've defined two fans (motorR
and motorL
); a fan control function (fancontrol(left,right)
, line 31) is called from the web requests (lines 35-49). Figure 7 shows the airboat web server, and Figure 8 shows the airboat in action.
Listing 2
Access Point and Web Controls
Summary
You'll be quite surprised how fast two fans will move the airboat. To ensure the boat runs straight forward, balancing the direction of the fans or adding a simple rudder might be necessary.
I've done the same project on the exact same hardware in Arduino C++. The response speeds seem similar, but the Python code might be slightly leaner. Although the MicroPython IDE wasn't as robust as the Arduino IDE, I enjoyed testing the Python code interactively from a command prompt.
I won't be giving up on Arduino C++, but I can definitely see a place for MicroPython, especially for projects with lots of string manipulation.
Infos
- MicroPython: https://micropython.org/
- uPyCraft: https://github.com/DFRobot/uPyCraft
« Previous 1 2 3
Buy this article as PDF
(incl. VAT)