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:
- 6:9eb153e1d472
- Parent:
- 5:1afe17a20a5b
--- a/include/SerialPrompt.h Thu Aug 13 15:52:19 2015 +0000
+++ b/include/SerialPrompt.h Sat Aug 15 11:47:53 2015 +0000
@@ -4,13 +4,15 @@
#include "VoltageGetter.h"
#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* help = "h - help d - drive driving unit\n\r v - get input voltage s - get collision sensor distance \n\r";
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();
+extern const char* distMsg;
+extern float actualDistance;
void displayPrompt(Serial* pcConnection)
{
pcConnection->printf(prompt);
@@ -45,6 +47,10 @@
{
displayMessage(voltage, pcConnection, getVoltage(&voltagePin));
return 3;
+ }else if(msg == 's')
+ {
+ displayMessage(distMsg, pcConnection, actualDistance);
+ return 4;
}
}
return 0;