Author Topic: MC-120 module crashes after simply adding an extra file to the project.  (Read 241 times)


  • Newbie
  • *
  • Posts: 26
  • Belgian guy married Phillipina
  • Location: Philippines
    • View Profile
After just adding a file to my project, and only calling the constructor my MC-120 module hangs, I can't connect any more and I must first connect via MC-OTA-updater to erase the script.

So the only instructions executed in my Class are:

Class WaterTank
    Shared Address As Byte
    Shared Sensor As I2c

    Public Sub New(_address As Byte)
        Address = _address
        Sensor = I2c.Create(400000, Pin.SCL, Pin.SDA, Address)
    End Sub
End Class

And in my main program:

    Shared UartTerm As UART_Debug
    Shared WaterTank1 As WaterTank
    Shared Event Boot()
        UartTerm = New UART_Debug()
        WaterTank1 = New WaterTank(0x10)
    End Event

I'm thinking maybe a memory leak in I2C  ???

Share on Facebook Share on Twitter


  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
The problem is the SetMidPowerMode(1). 1 milisecond is to fast and something must overflow. The minimum value is 20 milliseconds but that takes a big load. Make it 250 or just remove the statement. Beaconing every 2 seconds is fast but should work.