Just a few hours with this new image from LEGO and so much awesomeness already!
So this is all based on the MicroPython project. Being ‘v1.9.4’ it’s not the lastest version but it’s also not too old (current official release is 1.10). But it’s not ‘just’ a version customized for the EV3 devices… it seems a full implementation for ARM with ‘micropython-lib’ included.
What does it means?
Well, you can add micropyhton aditional modules if/when they are released, like for instance ‘pystone’ (a benchmarking tool):
micropython -m upip install pystone
There are already a lot of modules available including one HTTP client and other for sockets (so you can make your own MicroPython EV3 web server)… and two for MQTT!
And even better… at least the MQTT modules are already included within the LEGO image.
So let’s use EV3 for IoT:
from pybricks import ev3brick as brick
from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor,
InfraredSensor, UltrasonicSensor, GyroSensor)
from pybricks.parameters import (Port, Stop, Direction, Button, Color,
SoundFile, ImageFile, Align)
from pybricks.tools import print, wait, StopWatch
from pybricks.robotics import DriveBase
from umqtt.robust import MQTTClient
def getmessages(topic, msg):
if topic == b'JorgePe/test':
client = MQTTClient('52dc166c-2de7-43c1-88ff-f80211c7a8f6','test.mosquitto.org')
Just configure Wi-Fi, connect with Visual Studio Code, upload this project… and your EV3 is IoTed!
To be continued…