1
1
// ////////////////////////////////////////////////////////////////////////////
2
2
// ////////////////////////////////////////////////////////////////////////////
3
3
4
+ // This file contains funcitons that help the arduino communitate with the raspberry pi
5
+
6
+ // ////////////////////////////////////////////////////////////////////////////
7
+ // ////////////////////////////////////////////////////////////////////////////
8
+
9
+ // handles the recieving of data over the serial port
4
10
void RecvWithStartEndMarkers () {
5
11
static boolean recvInProgress = false ;
6
12
static byte ndx = 0 ;
@@ -34,10 +40,7 @@ void RecvWithStartEndMarkers() {
34
40
35
41
}
36
42
37
- // ////////////////////////////////////////////////////////////////////////////
38
- // ////////////////////////////////////////////////////////////////////////////
39
-
40
-
43
+ // helps get a particular value from the incoming data string
41
44
String getValue (String data, char separator, int index)
42
45
{
43
46
int found = 0 ;
@@ -54,35 +57,15 @@ String getValue(String data, char separator, int index)
54
57
return found > index ? data.substring (strIndex[0 ], strIndex[1 ]) : " " ;
55
58
}
56
59
57
- // ////////////////////////////////////////////////////////////////////////////
58
- // ////////////////////////////////////////////////////////////////////////////
59
-
60
- void ShowNewData () {
61
- if (newData == true ) {
62
- newData = false ;
63
- Serial.println (" <" );
64
- Serial.print (" Arduino: " );
65
- Serial.println (receivedChars);
66
- // NOT SURE IF I NEED THIS MARKER
67
- // Serial.println(" >");
68
- // From here we execute the commands that were send via the message
69
- ProcessData ();
70
- }
71
- }
72
-
73
- // ////////////////////////////////////////////////////////////////////////////
74
- // ////////////////////////////////////////////////////////////////////////////
75
-
60
+ // sends message back to raspberry pi saying the command has been executed
76
61
void Finished () {
77
62
Serial.println (" Finished Current Job" );
78
63
Serial.println (" ---------" );
79
64
Serial.println (" Ready for New Job" );
80
65
Serial.println (" >" );
81
66
}
82
67
83
- // ////////////////////////////////////////////////////////////////////////////
84
- // ////////////////////////////////////////////////////////////////////////////
85
-
68
+ // sends error message back to raspberry pi
86
69
void Invalid () {
87
70
Serial.println (" <" );
88
71
Serial.print (" Arduino: " );
0 commit comments