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.
Diff: include/SerialPrompt.h
- Revision:
- 5:1afe17a20a5b
- Parent:
- 4:cc391b3f3e57
- Child:
- 6:9eb153e1d472
--- a/include/SerialPrompt.h Tue Aug 04 09:05:16 2015 +0000
+++ b/include/SerialPrompt.h Thu Aug 13 15:52:19 2015 +0000
@@ -5,10 +5,12 @@
#include "mbed.h"
const char* prompt = "$>";
const char* help = "h - help d - drive driving unit\n\r v - get input voltage\n\r";
-const char* drivingMode = "Going to driving mode.\n\r Available commands: f - forwards\n\r b - backwards\n\r r - right\n\r l - left\n\r e - exit from driving mode ";
+const char* drivingMode = "Going to driving mode.\n\r Available commands: e - exit from driving mode \n\r";
const char* voltage = "Actual voltage: %g \n\r";
bool isDriving = false;
AnalogIn voltagePin(A0);
+extern int inState[4];
+extern void applyStates();
void displayPrompt(Serial* pcConnection)
{
pcConnection->printf(prompt);
@@ -37,32 +39,15 @@
}else if(msg == 'd')
{
displayMessage(drivingMode, pcConnection);
- isDriving = true;
+ isDriving = true;
return 2;
}else if(msg == 'v')
{
displayMessage(voltage, pcConnection, getVoltage(&voltagePin));
+ return 3;
}
}
return 0;
}
-void getDrivingModeInput(Serial* pcConnection)
-{
- if(pcConnection->readable() && isDriving)
- {
- while(isDriving)
- {
- char msg = pcConnection->getc();
- if(msg == 'f')
- {
-
- }else if(msg == 'e')
- {
- isDriving = false;
- break;
- displayPrompt(pcConnection);
- }
- }
- }
-}
+
#endif // SERIALPROMPT_H
\ No newline at end of file