Hey trying to make a it so when weight is 0-5kg red LED lights up, 5-10kg yellow lights up, 10kg-20kg green lights up. But it's not working, the arduino serial monitor keeps saying 0.00kg. When i do a simple test of the joy-it it works, just the way i've connected/coded it is the issue. Any info that is needed is written bellow, any help is welcome!
Connections:
Joy-it G to arduino GND
joy-it S to arduino A0
joy-it V to arduino A5
Arduino GND to breadboard G
cathode of red, yellow and green LED to breadboard G
Red anode to breadboard 25B
Arduino pin 8 220ohms resister to breadboard 25A
Yellow anode to breadboard 21B
Arduino pin 9 220ohms resister to breadboard 21A
Green anode to breadboard 15B
Arduino pin 10 220ohms resister to breadboard 15A
5kg > about 0.18V out
10kg > ~ 0.29V out
20kg > ~0.425V out
That doesn't do anything useful...
It calculates voltage (not weight) and the function doesn't return a value, and voltage is a local variable that doesn't exist outside the "scope" of the function.
It's ALWAYS best to start simple (maybe with the Analog Read Serial Example). Then "develop" your code by adding one or two lines at a time, testing as you go.
This Topic has been locked as it is the identical or too similar your other topic.
Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.
Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.
Repeated duplicate posting could result in a temporary or permanent ban from the forum.
Could you take a few moments to Learn How To Use The Forum
It will help you get the best out of the forum in the future.