Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: HIDScope MODSERIAL QEI TextLCD mbed
Fork of TotalControlEmg2 by
Revision 35:012b2e045579, committed 2015-10-20
- Comitter:
- RichardRoos
- Date:
- Tue Oct 20 08:41:38 2015 +0000
- Parent:
- 34:60391fb72629
- Child:
- 36:549d1ce7b96b
- Commit message:
- LCD aangepast
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Oct 20 08:26:10 2015 +0000
+++ b/main.cpp Tue Oct 20 08:41:38 2015 +0000
@@ -180,7 +180,7 @@
if(aimState!=OFF){ // only if aim motor is rotating
pwmM2.write(0); // Aim motor freeze
aimState = OFF; // motor state is off
- pc.printf("Motor freeze\r\n"); // LCD
+ pc.printf("Motor freeze\r\n"); // LCD
L = false; // Modes must be first 1 for another action
R = false; // ""
}
@@ -290,6 +290,7 @@
}
}
}
+ lcd.cls();
break;
}
case AIM: {
@@ -297,6 +298,7 @@
int i = 0; // counter for lcd
while(state == AIM){
if(lcdFlag){
+ lcdFlag = false;
if(i%3 == 0){
PRINT("Flex left or right half to aim");
}
@@ -316,18 +318,30 @@
if(emgFlag){ // Go flag EMG sampel
emgFlag = false;
if(controlAim()){
- pc.printf("Position choosen, adjust shoot velocity\r\n");
+ pc.printf("Position chosen\r\n"); // terminal
state = BREAK; // Next state (BREAK)
}
}
- }
+ }
+ lcd.cls();
break;
}
case BREAK: {
pc.printf("Set break percentage, current is: %.0f\r\n", breakPerc);
L = false;
R = false;
- while(state == BREAK){
+ int i = 0; // counter for lcd
+ while(state == BREAK){
+ if(lcdFlag){
+ lcdFlag = false;
+ if(i%2 == 0){
+ PRINT("Flex L or R to adjust break");
+ }
+ else {
+ PRINT("Flex both to continue");
+ }
+ i++;
+ }
if(emgFlag){ // Go flag EMG sampelen
emgFlag = false;
int modeL = defMode(emgL, potL, true);
@@ -371,11 +385,13 @@
}
}
L = false; // modeL must be one for another action can take place
- R = false; // modeR ""
+ R = false; // modeR ""
+ lcd.cls();
break;
}
case FIRE: {
pc.printf("Shooting\r\n");
+ PRINT("FIRING");
servo.pulsewidth(servoL); // BREAK release
pwmM1.write(0.25); // beam motor on
bool servoPos = true;
