IoT Invention with BBC Microbit

I have just finished a unit for a year 7 STEM class. This is based on the resources available at do your bit, a challenge for children and teens to combine creativity and technology in solutions for the Global Goals. The coding is Microsoft MakeCode. It is mapped against both Digital and Design Technologies ACARA standards.

Please find the pdf or OneNote or on this page: https://www.throughtheclassroomdoor.com/dt-resources/

Enjoy!

VexIQ Sumobot Adventures

I have only just started playing with the VEXIQ system and have discovered some interesting issues. I have previously had to account for the clock cycle of the ‘brain’ and how block code is compiled when using LEGO and Makecode. I have found that these embedded systems don’t care much for nested conditions and don’t like events, in particular.

With VEXcode IQ Blocks, I coded a routine for a SumoBot to reverse and spin at a white line and spin slowly until it detects an opponent; and then charge. With embedded systems, a Loop forever, if..else if nesting is required:

Forever
If sense colour that is greater than 15 (white), then:
Stop driving
Reverse 5cm
Spin around 180 degrees
Else it is black, so
If ultrasonic sensor detects object (distance < 20) then:
drive forward at opponent
Else spin around slowly until detected

MakeCode

forever(function () {

if (sensors.color3.light(LightIntensityMode.Reflected) > 50) {

motors.stopAll()

motors.largeBC.steer(0, –50, 2, MoveUnit.Rotations)

motors.largeBC.tank(-100, 100)

} else {

if (sensors.ultrasonic4.distance() < 20) {

motors.largeBC.steer(0, 100)

} else {

motors.largeBC.tank(-25, 25)

pauseUntil(() => sensors.ultrasonic4.distance() < 20)

}

}

})

VEXcode IQ Blocks

The issue that I had, when I tested out my code, was that there was a delay between detecting the opponent and charging forward; and so it would hit it at an angle or miss completely. I have found this in the past, with the way the code is compiled and run on the bot and issues with nested if statements. I figured the problem was the ‘wait until’, which should have been fine, or it would have been on an Arduino, anyway. Therefore, I modified the code to include a ‘while’ not statement.

This seems to have made the system much happier, as the results below show.

 

First Lego League ACARA Unit

I’m getting a head start with the new season of First Lego League by incorporating the Game challenge into Digital Technologies and STEM for year 8. This has resources for the 2019 challenge, but can very easily be updated for 2020 and beyond. I have tried to make it about designing algorithms with pseudocode, as much as possible, so that any coding IDE can be used. At the moment, it uses MakeCode and I plan on updating it to the new scratch-like EV3 Classroom when it is available.

Please access the OneNote file or the PDF.

Enjoy!

Troubleshooting EV3 and MakeCode

I am a big fan of Lego Mindstorms and MakeCode. However, the firmware is a bit buggie. The main issues that I have had is that after a while, the EV3 drive does not map and no amount of restarts seem to fix it. The other is that there must be an issue with adding programs with the same filenames or something. Certainly, you can’t delete from the brick. This means that when you tweak a setting and upload your program again, the old version runs and not the new. Given the rate of prototyping cycles involved in Robotics, I hope they solve this one soon. Some guidance to solve these issues is below.

TROUBLESHOOTING-EV3-WITH-MAKECODE