-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpieThrow.ino
53 lines (37 loc) · 979 Bytes
/
pieThrow.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
#include <SoftwareSerial.h>
#include <SerialCommand.h>
SerialCommand comm;
void setup() {
//Setup Channel A
Serial.begin(9600);
pinMode(12, OUTPUT); //Initiates Motor Channel A pin
pinMode(9, OUTPUT); //Initiates Brake Channel A pin
comm.addCommand("MOVE",throwPie);
comm.addDefaultHandler(unrecognized);
}
void freeze(){
digitalWrite(9, HIGH);
}
void loop(){
//forward @ full speed
freeze();
// Serial.print("\ntest\n");
//throwPie();
if (Serial.available() > 0) {
comm.readSerial();
Serial.println("I received ");
}
}
void throwPie(){
Serial.print("PIE");
digitalWrite(12, HIGH); //Establishes forward direction of Channel A
digitalWrite(9, LOW); //Disengage the Brake for Channel A
analogWrite(3, 255); //Spins the motor on Channel A at full speed
delay(200);
digitalWrite(9, HIGH);
//delay(7000);
}
void unrecognized() {
Serial.println("Command not recognized.");
}