diff options
-rw-r--r-- | ROBOARM/ROBOARM.ino | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/ROBOARM/ROBOARM.ino b/ROBOARM/ROBOARM.ino new file mode 100644 index 0000000..64d7699 --- /dev/null +++ b/ROBOARM/ROBOARM.ino @@ -0,0 +1,62 @@ +#include <Servo.h> + +#define B_S 7 +#define J_S 8 +#define M_S 9 +#define T_S 10 +Servo bases; +Servo joints; +Servo mans; +Servo turns; +int basea = 90; +int jointa = 60; +int mana = 30; +int turna = 90; +char in = 0; +void setup() { + pinMode(B_S,OUTPUT); + pinMode(J_S,OUTPUT); + pinMode(T_S,OUTPUT); + pinMode(M_S,OUTPUT); + bases.attach(B_S); + joints.attach(J_S); + mans.attach(M_S); + turns.attach(T_S); + Serial.begin(9600); + +} + +void loop() { + if (Serial.available()) { + in = Serial.read(); + Serial.print(in,HEX); + switch (in) { + case 'A' : + basea = basea + 5; + Serial.print(basea,DEC); + break; + case 'S' : + basea = basea - 5; + Serial.print(basea,DEC); + break; + + + case 'X' : + jointa = jointa + 5; + break; + case 'C' : + jointa = jointa - 5; + break; + case 'W' : + mana = mana + 1; + break; + case 'E' : + mana = mana - 1; + break; + } + } + bases.write(basea); + joints.write(jointa); + mans.write(mana); + +} |