Sonnenschutz_001.ino
1 |
| 2 | int a = 2;
| 3 | int B = 0;
| 4 | int n;
| 5 | int x;
| 6 | int y;
| 7 | int z;
| 8 | int W = 10;
| 9 | int X = 11;
| 10 | int Y = 12;
| 11 | int Z = 13;
| 12 | int h = 4;
| 13 | int i = 5;
| 14 | int j = 6;
| 15 | int k = 7;
| 16 |
| 17 |
| 18 | void setup() {
| 19 |
| 20 | pinMode(a,INPUT_PULLUP); // HIGH bei Sonne
| 21 | pinMode(h,INPUT_PULLUP); // Unterbrecher unten rechts
| 22 | pinMode(i,INPUT_PULLUP); // Unterbrecher oben rechts
| 23 | pinMode(j,INPUT_PULLUP); // Unterbrecher unten links
| 24 | pinMode(k,INPUT_PULLUP); // Unterbrecher oben links
| 25 | pinMode(W,OUTPUT);
| 26 | pinMode(X,OUTPUT); // wx Motor rechts
| 27 | pinMode(Y,OUTPUT);
| 28 | pinMode(Z,OUTPUT); // yz Motor links
| 29 | pinMode(B,OUTPUT); // interne Rechengröße
| 30 | }
| 31 |
| 32 | void loop() {
| 33 |
| 34 | if (digitalRead(a) == HIGH) // a Sensoren Eingang Pin 2
| 35 | {
| 36 | digitalWrite(B,LOW);
| 37 | digitalWrite(Y,LOW);
| 38 | }
| 39 | else
| 40 | {
| 41 | digitalWrite(B,HIGH); // b ist gleich a invertiert
| 42 | digitalWrite(Y,HIGH);
| 43 | }
| 44 | n = digitalRead(B) && digitalRead(h);
| 45 | if (digitalRead(n) == HIGH) // W an Pin 10
| 46 | {
| 47 | digitalWrite(W,HIGH);
| 48 | }
| 49 | else
| 50 | {
| 51 | digitalWrite(W,LOW);
| 52 | }
| 53 | }
|
|