#Servo and LED Arduino Code

10 messages · Page 1 of 1 (latest)

spiral echo
#

I got a arduino code for flipping a servo. And I tried, with the glory of the gathered internet knowledge to add a "light the LED when the gyro reach X position and shut it off when it goes back to Y" kind of thing.
I got it to work for a while, then it stopped lighting/shutting the LED off randomly, I do not know why. And for a while it only lit up when I pushed the button or held it in to start the servo code.

Anyone willing to help me out?

north viperBOT
#

Hey @spiral echo, thank you for contributing to this forum.
Please provide as much information (images, video, description) as you can. This will increase the chance that someone can help you with your issue.
Use the Close button when your issue is resolved.

waxen grotto
#

Im afraid you might have burnt the led

#

What voltage are you using?

spiral echo
#

@waxen grotto the LED is fine, it is my code that messes it up.
I used the same LED for other tests and it do not behave like that then.
it is simply my lack of knowing how to code that make it only light up when I hold the button or not, as well as including the light LED code inside other "if then" scenarios that it is not meant to be, but I hoped it would be that easy.

waxen grotto
#

I wish you luck then, may Mr Stark be with you

spiral echo
#

@waxen grotto and if the LED had been burnt what would you suggestion have been besides the change of voltage?
the voltage was 3v for the LED for a 3v LED (however had a small resistor between to make sure) and 6v for the servo as it is a 6v servo.

waxen grotto
#

Ok ok, im sorry dont hold it against me

spiral echo
#

No worries 🙂 was just wondering if you had some idea 🙂

vapid violet
#

Can you share your code here?