I need to flash an LED after push button is pushed until second button is pushed.
I have 3 of these to write but if I can get help with one I can figure out the others.
I have written a code and I think it is workable up to line 34. Nothing I try after that works. Thanks for your help
Please look at my code and if I am on the rite track. If sotell me how to make "BlinkLightLed ==1" blink LightLed at interval_1 of 250ms
If not tell me where i am going wrong.
const int pin_lightOn = 43;//button to turn on light
const int pin_lightOff = 45;//button to turn off light
const byte LightLed = 36; //light on led
bool pushed_lightOn = false;
bool pushed_lightOff = false;
int LightLedState = LOW; // ledState used to set the LED
long previousMillis = 0; // will store last time LED was updated
long interval = 200;// interval at which to blink (milliseconds)
int BlinkLightLed;//lightLed ready to blink
void setup ()//(void)
{
Serial.begin(9600);
pinMode (pin_lightOn, INPUT_PULLUP);
pinMode (pin_lightOff, INPUT_PULLUP);
pinMode (LightLed, OUTPUT);
}
void loop ()
{
bool prev_lightOff = pushed_lightOff;
bool prev_lightOn = pushed_lightOn;
pushed_lightOn = digitalRead (pin_lightOn) == LOW;
pushed_lightOff = digitalRead (pin_lightOff) == LOW;
unsigned long currentMillis = millis();
if (pushed_lightOn) {//push button to turn light on w/o timers
BlinkLightLed = 1;
if (pushed_lightOff) {//push button to shut off light
digitalWrite(lightLed, LOW);// //turn light LED off
}
Because it's not finished. I need help finishing it. If you want I can delete everything that keeps it from compiling but I thought if I left it this way you could see what I'm trying to do I need help from line 34 on down.
Here is the same code with the part that turns LightLed off removed. It compiles
const int pin_lightOn = 43;//button to turn on light
const int pin_lightOff = 45;//button to turn off light
const byte LightLed = 36; //light on led
bool pushed_lightOn = false;
bool pushed_lightOff = false;
int LightLedState = LOW; // ledState used to set the LED
long previousMillis = 0; // will store last time LED was updated
long interval = 200;// interval at which to blink (milliseconds)
int BlinkLightLed;//lightLed ready to blink
void setup ()//(void)
{
Serial.begin(9600);
pinMode (pin_lightOn, INPUT_PULLUP);
pinMode (pin_lightOff, INPUT_PULLUP);
pinMode (LightLed, OUTPUT);
}
void loop ()
{
bool prev_lightOff = pushed_lightOff;
bool prev_lightOn = pushed_lightOn;
pushed_lightOn = digitalRead (pin_lightOn) == LOW;
pushed_lightOff = digitalRead (pin_lightOff) == LOW;
unsigned long currentMillis = millis();
if (pushed_lightOn) {//push button to turn light on w/o timers
BlinkLightLed = 1;
if (pushed_lightOff) {//push button to shut off light
digitalWrite(lightLed, LOW);// //turn light LED off
}
I'm new at this but I'm using Arduino 1.6.5 and when I hit the check mark in the upper left corner it compiles the sketch and down on the bottom it says " done compiling" Am I doing something wrong?
I don't know what you're talking about.
Look at reply #2.
It has a code box.
In that code box, there is a "select" control.
Use the select control, copy the code thus selected into your IDE and compile it.
I don't know what your talking about I can select code but all that does is high lite code so it can be copied. There is no "select control" perhaps you have it because you are a moderator or because you are not a newbie. I don't have it.
Anyway what difference does it make if it compiles or not? I know it does not work....it's not complete. I need help completing it.
Anyway what difference does it make if it compiles or not?
You asked in your first post to check your code.
I pointed out that the code you posted doesn't compile.
If it doesn't compile, you haven't run the code.
If you haven't run the code, you can't have formed any opinion as to its performance, so now I'm struggling to see the point of continuing following this thread.
So I'm not.
There is no "select control"
You really need to pay more attention to the placement of quotation marks.