daily pastebin goal
64%
SHARE
TWEET

Untitled

a guest Nov 22nd, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void setup() {
  2.   // initialize digital pin LED_BUILTIN as an output.
  3.   pinMode(LED_BUILTIN, OUTPUT);
  4.   pinMode(2, INPUT);
  5.   pinMode(8, OUTPUT);
  6.   pinMode(9, OUTPUT);
  7.   pinMode(10, OUTPUT);
  8. }
  9.  
  10. int mode = 0;
  11.  
  12. void loop() {
  13.     if(digitalRead(2) == LOW)
  14.     {
  15.        delay(1500);
  16.        if(mode == 0)
  17.        {
  18.           mode = 1;
  19.        }
  20.        else
  21.        {
  22.         mode = 0;
  23.        }
  24.     }
  25.     if(mode == 0)
  26.     {
  27.       while(digitalRead(2) == HIGH)
  28.       {
  29.         digitalWrite(9, LOW);
  30.         digitalWrite(10, HIGH);
  31.         delay(500);
  32.         digitalWrite(9, HIGH);
  33.         delay(500);
  34.         digitalWrite(10, LOW);
  35.         digitalWrite(9, LOW);
  36.         digitalWrite(8, HIGH);
  37.         delay(500);
  38.         digitalWrite(8, LOW);
  39.         digitalWrite(9, HIGH);
  40.         delay(500);
  41.       }
  42.     }
  43.     else
  44.     {
  45.       digitalWrite(10, LOW);
  46.       digitalWrite(8, LOW);
  47.       digitalWrite(9, HIGH);
  48.       delay(200);
  49.       digitalWrite(9, LOW);
  50.       delay(200);
  51.     }
  52. }
RAW Paste Data
Top