Hi guys,
i have a few minor noob issues.
i have ran the button push command and made the led blink and have wired up another button to make another led blink. but i want this to happen.
when i click the left button, the left led blinks continuously until either the center button is pressed or the right button clicks and the right led blinks continuously also vise versa.
please help...
You should show your code, but I'm betting that so far you use delay() so it doesn't see when you press the next button?
Probably time to look at blink without delay, Robin2's demo code and this video.
JimboZA:
You should show your code, but I'm betting that so far you use delay() so it doesn't see when you press the next button?Probably time to look at blink without delay, Robin2's demo code and this video.
ye at the moment i am using the delay
kutenda:
ye at the moment i am using the delay
To do anything other than one blinking LED, you need to break away from that thinking..... It's a big pity that delay() even exists since it causes bad habits right from the start.
Come to terms with those millis() methods in the links I gave and you're set for life.
JimboZA:
kutenda:
ye at the moment i am using the delayTo do anything other than one blinking LED, you need to break away from that thinking..... It's a big pity that delay() even exists since it causes bad habits right from the start.
Come to terms with those millis() methods in the links I gave and you're set for life.
Thank you so much, okay so now I want to implicate an accelerometer into the circuit. Basically what I want is to push the left button and the left led blinks. As the accelerometer moves to the left, it won’t cancel out the left led blinking but once it starts moving back to the center and passes a certain point, let’s say 20 degrees, it cancels out the led. Vice versa For the right button
Class project
Well we don't "do" class projects here, but we "help" on specifics.
So give it a go, see how you get on. Come back with specifics like "I expected x but got y grrrr what did I do wrong" and of course as always, provide code, compile errors if any, schematics, photos....
JimboZA:
Well we don't "do" class projects here, but we "help" on specifics.So give it a go, see how you get on. Come back with specifics like "I expected x but got y grrrr what did I do wrong" and of course as always, provide code, compile errors if any, schematics, photos....
Ye I totally understand that. I have got the accelerometer working and I am able to see all the degrees etc when I put it at an angle but I am having difficulty getting the code to having the accelerometer working with the buttons and the led. The project is for myself, it's not like I'm getting marketed on it, I just want to show that it works but I think I bit to much for mouth really with it being so complicated. Right now I've got the buttons working with the LEDs and the accelerometer working on its own but I don't know how to make them work together and what code I can use in order to make the accelerometer work in accordance with the less
Fair comment.... so have you moved away from the delay() paradigm, because that's really what you should do.
Problem is delay() blocks anything from happening for the duration of the value you set.
So get the millis() approach clear first, if not already.
kutenda:
I have got the accelerometer working and I am able to see all the degrees etc when I put it at an angle but I am having difficulty getting the code to having the accelerometer working with the buttons and the led.
This demo about merging sketches and this Thread about planning and implementing a program may be of some use.
...R