Fork of original senior design repo
Dependencies: SDFileSystem mbed-rtos mbed wave_player emic2
Fork of BAT_senior_design by
Diff: buttonArray.cpp
- Revision:
- 23:b2e53ce54b3e
- Parent:
- 22:23970cf718ee
- Child:
- 24:3c4ebc4fde0f
--- a/buttonArray.cpp Fri Nov 10 15:59:21 2017 +0000
+++ b/buttonArray.cpp Fri Nov 10 16:22:04 2017 +0000
@@ -66,13 +66,15 @@
{
int* pinsup;
char* braille = getBraille(val);
- int j = 0;
+ int j = 1;
for (int i = 0; i < 6; i++) {
if (braille[i] == '0') {
+ j++;
pinsup[j] = i+1;
- j++;
}
}
+ // record size of array in the first element
+ pinsup[0] = j;
return pinsup;
}
@@ -87,10 +89,12 @@
int j = 0;
for (int i = 0; i < 6; i++) {
if(inarr[i] != actarr[i]) {
+ j++;
wrong[j] = i+1;
- j++;
}
}
+ // record size of array in the first element
+ wrong[0] = j;
return wrong;
}
@@ -102,4 +106,41 @@
button1.setState(3);
button1.setPress(0);
}
+ if (button2.getPress()) {
+ button2.moveServoOut();
+ button2.setState(3);
+ button2.setPress(0);
+ }
+ if (button3.getPress()) {
+ button3.moveServoOut();
+ button3.setState(3);
+ button3.setPress(0);
+ }
+ if (button4.getPress()) {
+ button4.moveServoOut();
+ button4.setState(3);
+ button4.setPress(0);
+ }
+ if (button5.getPress()) {
+ button5.moveServoOut();
+ button5.setState(3);
+ button5.setPress(0);
+ }
+ if (button6.getPress()) {
+ button6.moveServoOut();
+ button6.setState(3);
+ button6.setPress(0);
+ }
}
+
+void buttonArray::setup()
+{
+ // servos begin at 30 degrees
+ // replace with a button setup function
+ button1.setup();
+ button2.setup();
+ button3.setup();
+ button4.setup();
+ button5.setup();
+ button6.setup();
+}
\ No newline at end of file
