At long last we have unboxed the mBots. In order to verify correct installation of the mBlock IDE and arduino drivers, and to get practice programming in scratch and uploading code, we attempt to control the mCore board’s onboard LEDs to create a smoothly flashing, colorful display, thus lending a party-like atmosphere to the classroom.
Disclaimer: This is more of a fancy lightbulb than a robot per-se (there is no autonomous decision-making.)
Disclaimer: This will be more fun rave once we add sound and movement… 🙂
//learning objective: learn about variables, control loops, and get used to uploading code to the mBot.
//goal: to create a light show, with the two onboard LEDs independently shifting through the color spectrum. The lights should change smoothly, without strobing.
//plan: each color should go up until 255, then go down until 0, then go up…etc.
//need to set each color to a different value initially
-variables for each color, RGB, different
-variables for each colors’ direction (dir1, dir2, dir3)
-check the values of each color, and if the value is 255, change the direction of that color to -1, if it’s 0, change the direction to 1.
-change the value of the color by its direction
-set the left led color
-set the right led color