m5stack / M5Stack

M5Stack Arduino Library
MIT License
1.19k stars 425 forks source link

Can't get SCALE-KIT-WITH-WEIGHT-UNIT working #302

Closed jerome83136 closed 1 year ago

jerome83136 commented 1 year ago

Hello, I bought a SCALE-KIT-WITH-WEIGHT-UNIT and I cannot get it running correctly.

I connected it to an M5 Atom lite, loaded the weight unit extension into UIflow and tried to run the weight unit example code

I wired the 4 weight sensors to the weight unit and put an empty case on them (the case I received for the product shipment)

When I look at the serial monitor with M5 burner; I see incorrect values.

I press button A to reset the scale and the value goes from -8 to increasing negative values over time. (Sometimes I also randomly get irrelevant values) Whe I put an object on the unit the value changes: but doesn't reflect the real weight at all. And when I remove the object; the weight can decrease, increase with randomly innacurate values.

How can I get it working please ?

The code I use is this one:

from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit

weigh_0 = unit.get(unit.WEIGHT, unit.PORTA)

while True:
  print(weigh_0.weight)
  wait(0.1)
  if btnA.isPressed():
    wait(0.1)
    weigh_0.zero()
  wait_ms(2)

Thank you Best regards

jerome83136 commented 1 year ago

Hi, Just tried pushing another example code on my M5 Atom, with Arduino IDE rather than UIFlow. I tried this code: https://github.com/m5stack/M5Atom/blob/master/examples/KIT/SCALES_KIT/SCALES_KIT.ino

And then it worked with no problem.

I wonder what is the difference between these 2 example codes ?

jerome83136 commented 1 year ago

I re-burned my M5 Atom with M5 Burner I loaded the examples code for weight unit from UI Flow and downloaded it to the Atom And now it works.

Don't really know what I did wrong. I think that burning with M5 Burner helped.