libonioni2c, python and arduino dock 2



  • Having a grey hair moment with the I2C comms between onion and the arduino dock 2. My python script has a very simple flow to read counter digits that increment through functions in the arduino:

    while True:
    i2c = onionI2C.OnionI2C()
    sequenceCount = sequenceCount + 1
    size = 1
    addr = 0x20
    counter_1_val = i2c.readBytes(devAddres, addr, size)
    addr = 0x21
    counter_2_val = i2c.readBytes(devAddres, addr, size)
    addr = 0x22
    counter_3_val = i2c.readBytes(devAddres, addr, size)
    addr = 0x23
    counter_4_val = i2c.readBytes(devAddres, addr, size)
    addr = 0x24
    counter_5_val = i2c.readBytes(devAddres, addr, size)
    addr = 0x25
    counter_6_val = i2c.readBytes(devAddres, addr, size)
    sleep(0.1)

    • code breaks here to update OLED with counter values then loops back and starts again

    This will run perfectly for 10 to 30 minutes, then at random a hex value between 0x60 and 0x99 is sent (not used anywhere in code) and the counter_x_val variables are filled with a hex value of 0x63 (which is my arduino sketch reply to a non valid address)

    My i2c instance then becomes locked - although there is no break in the loop and it keeps updating the OLED, it does not transmit any further addr on to the arduino on the i2c pins and the result returned in the counter variables is always 0x63. Any further attempts to run the script again keep returning that value.

    Running i2cget-y 0 0x08 0x20 also returns 0x63

    The only way to get it working again is to reboot the onion.

    Can anyone suggest a way to clear all buffers etc within the libonioni2c library and start fresh?



Looks like your connection to Onion Community was lost, please wait while we try to reconnect.