Error DHT12 M5stack CORE



  • unexpected keyword argument freq
    M5stack CORE
    0_1613464279029_41061b55-0ccf-482e-ba8c-24ef37afc9ab-imagen.png

    UI 1,4,5

    from m5stack import *
    from m5ui import *
    from uiflow import *
    import i2c_bus

    setScreenColor(0x222222)

    label0 = M5TextBox(85, 57, "Text", lcd.FONT_DejaVu40,0xFFFFFF, rotate=0)
    label1 = M5TextBox(83, 145, "Text", lcd.FONT_DejaVu40,0xFFFFFF, rotate=0)
    label2 = M5TextBox(215, 146, "C", lcd.FONT_DejaVu40,0xFFFFFF, rotate=0)
    label3 = M5TextBox(215, 57, "%", lcd.FONT_DejaVu40,0xFFFFFF, rotate=0)
    label4 = M5TextBox(250, 135, "O", lcd.FONT_Default,0xFFFFFF, rotate=0)

    hum_Integer = None
    hum_decimal = None
    tem_Integer = None
    tem_decimal = None

    i2c0 = i2c_bus.easyI2C(i2c_bus.PORTA, 0x5C)
    while True:
    wait_ms(100)
    hum_Integer = int(((i2c0.read_u16(0x00, byteorder="big")) / 256))
    wait_ms(100)
    hum_decimal = ((i2c0.read_u16(0x00, byteorder="big")) % 256) * 0.1
    wait_ms(100)
    label0.setText(str(hum_Integer + hum_decimal))
    wait_ms(100)
    tem_Integer = int(((i2c0.read_u16(0x02, byteorder="big")) / 256))
    wait_ms(100)
    tem_decimal = ((i2c0.read_u16(0x02, byteorder="big")) % 256) * 0.1
    wait_ms(100)
    label1.setText(str(tem_Integer + tem_decimal))
    wait_ms(2)
    I2c Bus error 6

    Thanks



  • Hello @chetosvsgeez

    Have you considered using the latest UI 1.7.2? Your code runs fine here on a M5Stack Gray and UI 1.7.2.

    BTW: if you enclose your code with ``` on a new line before and after the code, the code becomes much more readable. For example:

    from m5Stack import *
    

    Thanks
    Felix