7
7
// ////////////////////////////////////////////////////////////////////////////
8
8
// ////////////////////////////////////////////////////////////////////////////
9
9
10
- void ProcessData () {
10
+ void ProcessData ()
11
+ {
11
12
12
13
PopulateArray ();
13
-
14
- /*
14
+ //
15
+ /*
15
16
// Print First Number
16
17
Serial.println("---------");
17
18
Serial.print("Motor 1: ");
@@ -50,31 +51,40 @@ void ProcessData() {
50
51
// ////////////////////////////////////////////////////////////////////////////
51
52
// ////////////////////////////////////////////////////////////////////////////
52
53
53
- void PopulateArray () {
54
+ void PopulateArray ()
55
+ {
54
56
55
- //
57
+ // temp string used to store the char array
58
+ // easier to do opperations on string than chars
56
59
String recieved_string = " " ;
60
+ // give the string the value of the char array
57
61
recieved_string = received_chars;
58
62
63
+ // now lets populate the motor command array with values from the recieved
64
+ // string
59
65
for (int i = 0 ; i < NUMBER_MOTORS; i++)
60
66
{
61
67
int search1 = (i * 2 );
62
- int search2 = ((i * 2 ) + 1 );
63
-
68
+ int search2 = ((i * 2 ) + 1 );
69
+
64
70
String value1 = getValue (recieved_string, ' ,' , search1);
65
- String value2 = getValue (recieved_string, ' ,' , search2);
66
-
67
- if (value1 == " Up" ) {
71
+ String value2 = getValue (recieved_string, ' ,' , search2);
72
+
73
+ if (value1 == " Up" )
74
+ {
68
75
motor_commands[i][1 ] = 0 ;
69
76
}
70
- else if (value1 == " Down" ) {
77
+ else if (value1 == " Down" )
78
+ {
71
79
motor_commands[i][1 ] = 1 ;
72
80
}
73
81
74
- else if (value1 == " None" ) {
82
+ else if (value1 == " None" )
83
+ {
75
84
motor_commands[i][1 ] = 2 ;
76
85
}
77
- else if (value1 == " Reset" ) {
86
+ else if (value1 == " Reset" )
87
+ {
78
88
motor_commands[i][1 ] = 3 ;
79
89
}
80
90
else
@@ -96,14 +106,13 @@ void PopulateArray() {
96
106
Serial.print (" - " );
97
107
Serial.println (motor_commands[i][2 ]);
98
108
}
99
-
100
-
101
109
}
102
110
103
111
// ////////////////////////////////////////////////////////////////////////////
104
112
// ////////////////////////////////////////////////////////////////////////////
105
113
106
- void CheckSwitch (int switchPort) {
114
+ void CheckSwitch (int switchPort)
115
+ {
107
116
// /* Step 1: Update the integrator based on the input signal. Note that the
108
117
// integrator follows the input, decreasing or increasing towards the limits
109
118
// as determined by the input state (0 or 1). */
0 commit comments