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.
Fork of kl46z_btn_slider_toSerial by
Diff: main.cpp
- Revision:
- 8:018b01e6b807
- Parent:
- 7:8f64ad5334ca
diff -r 8f64ad5334ca -r 018b01e6b807 main.cpp
--- a/main.cpp Mon Oct 12 03:19:22 2015 +0000
+++ b/main.cpp Sun Jan 22 23:37:06 2017 +0000
@@ -13,6 +13,8 @@
#define DATATIME 200 //milliseconds
#define LCDLEN 10
#define PROGNAME "kl46z_btn_slider_toSerial\r\n"
+#define COLOFF 0 // setting boolean to turn off colon
+#define COLON 1 // setting boolean to turn on colon
// Cap slider interface
SLCD slcd; //define LCD display
@@ -24,7 +26,9 @@
InterruptIn rtButton(RBUT);
InterruptIn lfButton(LBUT);
-char lcdData[LCDLEN];
+//char lcdData[LCDLEN];
+
+char noColData[LCDLEN];
Serial pc(USBTX, USBRX);// set up USB as communications to Host PC via USB connectons
@@ -43,18 +47,25 @@
void LCDMessNoDwell(char *lMess){
slcd.Home();
slcd.clear();
+ //using line below to turn off or on colon
+ slcd.Colon(COLOFF);
slcd.printf(lMess);
}
// --------------------------------
int main() {
float sliderValue = 0.0;
-
+ //int sliderValue = 0;
+
pc.printf(PROGNAME);
dataTimer.start();
- dataTimer.reset();
- sprintf (lcdData,"%4.3f",0.0);
- LCDMessNoDwell(lcdData);
+ dataTimer.reset();
+
+ //sprintf (lcdData,"%4.3f",0.0);
+ //LCDMessNoDwell(lcdData);
+
+ sprintf (noColData,"%4.3f", 0.0);
+ LCDMessNoDwell(noColData);
// Interrupt routine setups
rtButton.fall(&rtButtonPressed);
@@ -71,9 +82,11 @@
// Only do stuff with it if it's a new value or if it's not zero
if(newSliderValue > 0.0 && newSliderValue != sliderValue) {
sliderValue = newSliderValue;
- sprintf (lcdData,"%4.3f", sliderValue); // Just to make things user readable
+ //sprintf (lcdData,"%4.3f", sliderValue); // Just to make things user readable
+ sprintf (noColData, "%4.3f", sliderValue);
- LCDMessNoDwell(lcdData);
+ //LCDMessNoDwell(noColData);
+ LCDMessNoDwell(noColData);
pc.printf("slider: %4.3f\r\n", sliderValue);
}
dataTimer.reset();
