-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8af7e49
commit 76ae721
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
mcu/Arduino_code/Arduino_Servo_Serial/Arduino_Servo_Serial.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include <Servo.h> | ||
|
||
|
||
Servo servo1; | ||
Servo servo2; | ||
|
||
void setup(){ | ||
servo1.attach(3); | ||
servo2.attach(5); | ||
servo1.write(30); | ||
servo2.write(130); | ||
Serial.begin(9600); | ||
|
||
} | ||
|
||
void loop() | ||
{ | ||
if(Serial.available()){ | ||
char ch = Serial.read(); | ||
switch(ch){ | ||
case 'd' : | ||
|
||
servo1.write(30); | ||
servo2.write(130); | ||
|
||
break; | ||
|
||
case 'u': | ||
servo1.write(120); | ||
servo2.write(30); | ||
|
||
break; | ||
} | ||
} | ||
} |