Search mauweb.net

ad$ @ |¥|@uWεb ↓

Link to YouTube video

Sample code:


/*
חנוכה
*/
int ner1 = 2;
int ner2 = 3;
int ner3 = 4;
int ner4 = 5;
int shamosh = 6;
int ner6 = 7;
int ner7 = 8;
int ner8 = 9;
int ner9 = 10;
int buttonPin = 11;
int reset = 12;
int day = 1;

int buttonPushCounter = 0; // counter for the number of button presses
int buttonState = 0; // current state of the button
int lastButtonState = 0; // previous state of the button

// the setup function runs once when you press reset or power the board
void setup() {
pinMode(buttonPin, INPUT);
pinMode(reset, INPUT);

pinMode(ner1, OUTPUT);
pinMode(ner2, OUTPUT);
pinMode(ner3, OUTPUT);
pinMode(ner4, OUTPUT);
pinMode(shamosh, OUTPUT);
pinMode(ner6, OUTPUT);
pinMode(ner7, OUTPUT);
pinMode(ner8, OUTPUT);
pinMode(ner9, OUTPUT);

}

// the loop function runs over and over again forever
void loop() {
if(digitalRead(reset) == HIGH){
buttonPushCounter = 0;
}
buttonState = digitalRead(buttonPin); // read the pushbutton input pin:

if (buttonState != lastButtonState) { // compare the buttonState to its previous state
if (buttonState == HIGH) { // if the state has changed, increment the counter
buttonPushCounter++;
} else { // if the current state is LOW then the button
}
delay(50); // Delay a little bit to avoid bouncing
}
lastButtonState = buttonState; // save the current state as the last state, for next time through the loop

day = buttonPushCounter;

switch (day) {
case 1: //day 1
digitalWrite(shamosh, HIGH);
digitalWrite(ner1, HIGH);
break;
case 2: //day 2
digitalWrite(shamosh, HIGH);
digitalWrite(ner1, HIGH);
digitalWrite(ner2, HIGH);
break;
case 3: //day 3
digitalWrite(shamosh, HIGH);
digitalWrite(ner1, HIGH);
digitalWrite(ner2, HIGH);
digitalWrite(ner3, HIGH);
break;
case 4: //day 4
digitalWrite(shamosh, HIGH);
digitalWrite(ner1, HIGH);
digitalWrite(ner2, HIGH);
digitalWrite(ner3, HIGH);
digitalWrite(ner4, HIGH);
break;
case 5: //day 5
digitalWrite(shamosh, HIGH);
digitalWrite(ner1, HIGH);
digitalWrite(ner2, HIGH);
digitalWrite(ner3, HIGH);
digitalWrite(ner4, HIGH);
digitalWrite(ner6, HIGH);
break;
case 6: //day 6
digitalWrite(shamosh, HIGH);
digitalWrite(ner1, HIGH);
digitalWrite(ner2, HIGH);
digitalWrite(ner3, HIGH);
digitalWrite(ner4, HIGH);
digitalWrite(ner6, HIGH);
digitalWrite(ner7, HIGH);
break;
case 7: //day 7
digitalWrite(shamosh, HIGH);
digitalWrite(ner1, HIGH);
digitalWrite(ner2, HIGH);
digitalWrite(ner3, HIGH);
digitalWrite(ner4, HIGH);
digitalWrite(ner6, HIGH);
digitalWrite(ner7, HIGH);
digitalWrite(ner8, HIGH);
break;
case 8: //day 8
digitalWrite(shamosh, HIGH);
digitalWrite(ner1, HIGH);
digitalWrite(ner2, HIGH);
digitalWrite(ner3, HIGH);
digitalWrite(ner4, HIGH);
digitalWrite(ner6, HIGH);
digitalWrite(ner7, HIGH);
digitalWrite(ner8, HIGH);
digitalWrite(ner9, HIGH);
break;
default:
digitalWrite(shamosh, HIGH);
digitalWrite(ner1, LOW);
digitalWrite(ner2, LOW);
digitalWrite(ner3, LOW);
digitalWrite(ner4, LOW);
digitalWrite(ner6, LOW);
digitalWrite(ner7, LOW);
digitalWrite(ner8, LOW);
digitalWrite(ner9, LOW);
break;
}
}

 

World visitors

 This website supports:

 
mauwebstore opening

|¥|@µWεß.nετ is designed and published from Israel by M@µ®¡ © Some rights reserved 

This work is licensed under a Creative Commons Attribution-Noncommercial 3.0 License 

free
hit counter
Designed by |¥|@µ®¡