Our first season, in the 2019 City Shapers, we were using all LabView for our coding, and we knew we could do better. This year, we made the switch to MicroPython and created our framework containing all reusable (non-season specific) code such as calibrating the light sensor, map for choosing programs, initializing the robot class, speakers for text to speech and even allowing the programmer to manipulate the screen. By far, the hardest part was figuring out how to calibrate the light sensor, as there isn't a command given by ev3dev to calibrate the light sensor unlike how there is a block in LabView. There were a two main problems here: not being able to change the reading of the sensor, and having any saved variables be reset every time the program is restarted (meaning you could have to calibrate every single time you run the program). First, the problem of not being able to change white to 100 on the sensor and black to 0 as the LabView block does, was simply solved by saivng the values of black and white, and then in the line follow function, variables Black and White were used instead of assuming they are 0 and 100 respectively. Next, the problem of saving these values in variables was solved by creating a dictionary in a json file, so even after the python program terminates the json file will still hold the values it was inputted before since the values are saved on the SD card. One problem here was that the dictionary has to have ALL of its values assigned at first, and since calibration takes some time to get the readings of Black and White, dummy values were put in place until the user was ready to calibrate the light sensor in Black and White. There were numerous challenges we faced this year as this was the first year of the senior members using MicroPython, and if you have any further question or challenges your team is facing with Micropython, please email us at [email protected], with the subject something like "FLL Micropython". We learned the hard way that the MicroPython docs isn't the most clear or easy to navigate, (at least in 2020, maybe they will update it :D) but we'd love to help!
-
Notifications
You must be signed in to change notification settings - Fork 0
BLT-Build-Legos-Together/RePlay-2020
About
Micropython Project for the 2020-2021 FLL Season, Replay
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published