Today our group made a lot of progress and everyone now has an ArtBot that is controlled by another micro:bit using the radio functionality and has distance sensors + code to make those distance sensors work.
Here’s my ArtBot in action:
And here’s the code behind it.
This is the remote control code:
This is the ArtBot code:
I felt a little frustrated by trying to get both of the distance sensors and the radio functionality working today. Here’s a breakdown of the problems/solutions:
|The robots weren’t avoiding obstacles very well. They would often get stuck and wouldn’t sense objects that were clearly in the way.||Our group thought that we would need at least two sensors per bot but it turns out one sensor mounted to the front works better (and makes more sense when you think about it, the bot doesn’t need to turn around if there’s another bot coming up behind it because that bot has a sensor on the front that will tell it to avoid my bot.)|
|You can’t use radio to trigger a function that goes forever. This threw us off a little bit because previously we had been building our code by putting everything into the forever loop because we wanted our bots to be constantly moving. Throwing a loop into the function that is called when the radio broadcast string is received that repeats 80 times didn’t seem like a good options either.||We reconsidered how we were coding/thinking of the remote control. Instead of seeing the remote control as the object that triggers/controls our primary movement code we started to think of it as code that causes a change to the bots normally programmed movement. (In my example the radio command causes the bot to spin quickly in circles)|
These problems aren’t completely solved. You can see in the video that the bot still gets stuck sometimes and that the movement triggered by the remote control micro:bit is a little sporadic. Sometimes the fast speed that is supposed to only apply to the turning in circles is also applied to the normal code which causes the bot to draw a wavy line. I’m not sure why this is.
Frustrations aside, (or maybe because of the frustrations) this was a really great group meeting. We finally saw how our artbots interact with each other and this was exciting and encouraging. Seeing how close we are to our goal and working through problems / learning how to solve problems as they arise helped my group build our confidence that our project would turn out how we imagined it.