This commit is contained in:
filip 2021-04-12 14:47:49 +02:00
parent 3db183fd00
commit 4ffe66ceac

View File

@ -3,11 +3,42 @@ void setup() {
} }
class button() { void motor(direction) {
public: break;
}
void moveTo(targetLevel) {
break;
if (currentLevel == targetLevel) {
loop()
}
if (currentLevel > targetLevel) {
motor("up");
}
if (currentLevel < targetLevel) {
motor("down")
}
}
void button() {
int button1 = 22; int button1 = 22;
int button2 = 23; int button2 = 23;
int button3 = 24; int button3 = 24;
while (1){
switch (HIGH) {
case digitalRead(button1):
led(1);
break;
case digitalRead(button2):
led(2);
break;
case digitalRead(button3):
led(3);
break;
}}
}; };
class 7segment() { class 7segment() {
@ -17,11 +48,30 @@ class 7segment() {
} }
}; };
class led() { void led(led) {
public: int led1 = 8;
int led1 = 4; int led2 = 9;
int led2 = 5; int led3 = 10;
int led3 = 6;
//turn off all leds;
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
switch (led) {
case 1:
digitalWrite(led1, HIGH);
break;
case 2:
digitalWrite(led2, HIGH);
break;
case 3:
digitalWrite(led3, HIGH);
break;
}
moveTo(led);
}; };
class detectors() { class detectors() {