Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
jemsbhai authored Sep 11, 2022
1 parent 77c72c6 commit d85f5a6
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions backendandandsomehardware/motorcontrol.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
String a;
bool motorState = false;
int motorpin = 8;

void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Motor ready.");
pinMode(motorpin, OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:

if (Serial.available()) {
int state = Serial.parseInt();
if (state == 1) {
digitalWrite(motorpin, HIGH);
delay(10000);
digitalWrite(motorpin, LOW);
} else if (state == 2) {
digitalWrite(motorpin, LOW);
}
}
}

0 comments on commit d85f5a6

Please sign in to comment.