Gigglebot Microbit Micropython I2C error message

micropython
#1

I’m using a MacOSx laptop and the Gigglebot + micro:bit, using micropython with the mu-editor v1.0.1, using the dexter hex file micropython override build.v0.3.2-dexterindustries-gb-firmware.hex.

I noted that if I add any method involving the eyes (init(), set_smile, etc.) that after flashing I’ll receive an “OSerror I2C” referencing a line number that is outside (beyond) the scope of the my code (e.g. my code has 10 lines and the error is line number 66).

I have tried the more recent (I believe 4.0) hex file from the github repository; actually I was working with that version prior and switched to the 0.3.2 version to see if it addressed the problem, which it did not.

Other gigglebot methods e.g. drive(), turn(), etc., seem to work fine, I just can’t use the eyes and smile methods without receipt of an I2C error.

Interestingly, I can control the eyes via Microsoft Makecode platform, but this platform is too limited to code, for example, a line follower.

Any help you can offer would be greatly appreciated!

0 Likes

#2

Hello @brad.hontz

I tested it locally. I am running Mu 1.0.2, so slightly different than yours. I’m using firmware 0.4.0, and this is my code:

from microbit import *
from gigglebot import *

init()
while True:
    set_smile(R=100,G=0,B=0)
    sleep(100)
    set_smile(R=0,G=100,B=0)
    sleep(100)
    set_smile(R=0,G=0,B=100)
    sleep(100)

I am not getting any error.

What code are you running?

0 Likes

#3

Thanks so kindly for your reply!

I am heading out now and won’t be back until tomorrow afternoon – I think it would be easier to share a little video so you can see the micro:bit screen concurrent with the code. For example, the first 3 lines of your coding example will generate the error on my end. If I edit out the 3rd line (i.e. init()) all is well.

This would also work just fine:

from microbit import *
from gigglebot import *

while True:

  drive(FORWARD, 100)

  sleep(500)

  drive(BACKWARD, 100)

… it’s really just the methods involving the eyes or smile that invoke an error.

0 Likes

#4

@brad.hontz

And you say it works fine with Makecode, so we’re not looking at a hardware problem. (as an aside, you can totally code a line follower in the makecode environment - you do have access to each sensor value, and you can switch to Javascript if the blocks become painful)

Would you mind trying two other approaches?

  1. https://beta.microbit.edublocks.org/ will also let you code with Python. If you click on the “Blocks” button top right, you will be switched to a Python editor.

  2. There are other instructions here that do not require a change in firmware: https://www.gigglebot.io/pages/program-the-gigglebot-robot-micropython
    Make sure to put the default firmware back onto the microbit first.

I’d be curious to see how these two methods work out for you.

Cleo

0 Likes

#5

Thanks Cleo, just got back to my desk and realized I don’t have the gigglebot / microbit here, they were used at an event over the weekend and someone else carted them home.

I’ll pick them up tomorrow afternoon and look to try your two suggestions prior to making the video I’d offered.

Thanks again!

Brad Hontz

Volunteer

Girl Scouts of Orange County, CA

STEM progam development

0 Likes