91 lines
1.3 KiB
C++
91 lines
1.3 KiB
C++
void setup() {
|
|
// put your setup code here, to run once:
|
|
|
|
}
|
|
|
|
void motor(direction) {
|
|
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 button2 = 23;
|
|
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() {
|
|
public:
|
|
void display(numberToDisplay) {
|
|
//bcd code
|
|
}
|
|
};
|
|
|
|
void led(led) {
|
|
int led1 = 8;
|
|
int led2 = 9;
|
|
int led3 = 10;
|
|
|
|
//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() {
|
|
public:
|
|
int detector1b = 25;
|
|
int detector1t = 26;
|
|
int detector1b = 27;
|
|
int detector2t = 28;
|
|
int detector3b = 29;
|
|
int detector3t = 30;
|
|
};
|
|
|
|
void loop() {
|
|
// put your main code here, to run repeatedly:
|
|
|
|
}
|