Drakkheen

Untitled

Jun 11th, 2021
704
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define taste 4
  2. unsigned long previousMillis = 0;        // will store last time LED was updated
  3. const long pause = 1000;           // interval at which to blink (milliseconds)
  4. int muster1[24] {0, 1, 1, 0, 0, 2, 2, 0, 0, 3, 3, 0, 1, 2, 2, 1, 1, 3, 3, 1, 2, 3, 3, 2};
  5.  
  6. void setup()
  7. {
  8.   for (int i = 0; i < 5; i++) {
  9.     pinMode(i, INPUT);
  10.   }
  11.  
  12.  // Serial.begin(9600);
  13. }
  14.  
  15. void loop()
  16. {
  17.   unsigned long currentMillis = millis();
  18.  
  19.   for (int i = 0; i < 25; i = i + 2) {
  20.  
  21.     if (currentMillis - previousMillis >= pause) {
  22.       previousMillis = currentMillis;
  23.  
  24.       set_pins(muster1[i], muster1[i + 1]);
  25.    //   Serial.println(muster1[i]);
  26.      // Serial.println(muster1[i + 1]);
  27.     }
  28.   }
  29. }
  30.  
  31. void set_pins(int high_pin, int low_pin)
  32. {
  33.   // reset all the pins
  34.   reset_pins();
  35.  
  36.   // set the high and low pins to output
  37.   pinMode(high_pin, OUTPUT);
  38.   pinMode(low_pin, OUTPUT);
  39.  
  40.   // set high pin to logic high, low to logic low
  41.   digitalWrite(high_pin, HIGH);
  42.   digitalWrite(low_pin, LOW);
  43. }
  44.  
  45. void reset_pins()
  46. {
  47.   // start by ensuring all pins are at input and low
  48.   for (int i = 0; i < 4; i++) {
  49.     pinMode(i, INPUT);
  50.     digitalWrite(i, LOW);
  51.   }
  52. }
RAW Paste Data