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 lightsense_kl46z_basic by
Revision 10:cccc6a1739be, committed 2016-09-19
- Comitter:
- eseifert
- Date:
- Mon Sep 19 12:18:34 2016 +0000
- Parent:
- 9:f619cdaa7a65
- Commit message:
- ES_SSD541_HW_52a
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Sep 09 19:41:10 2016 +0000
+++ b/main.cpp Mon Sep 19 12:18:34 2016 +0000
@@ -13,30 +13,35 @@
Serial pc(USBTX, USBRX);
Timer LEDTimer;
-void LCDMess(char *lMess){
- slcd.Home();
- slcd.clear();
- slcd.printf(lMess);
-}
+void LCDMess(char *lMess)
+{
+ slcd.Home();
+ slcd.clear();
+ slcd.printf(lMess);
+}
-
-int main() {
+int main()
+{
AnalogIn LightSensor(LIGHTSENSORPORT);
- float lightData;
+ float lightData;
char lcdData[LCDLEN];
-
+
int timeToChangeDF = DATATIME;
LEDTimer.start();
LEDTimer.reset();
pc.printf(PROGNAME);
-
- while(true) {
- if (LEDTimer.read_ms() > timeToChangeDF){ // check for timer time out transtion
- lightData = (1.0 - LightSensor.read()); // show as increasiing with increasing intensity
- sprintf(lcdData,"%4.3f",lightData);
- LCDMess(lcdData);
+ PwmOut gled(LED_GREEN);
+ PwmOut rled(LED_RED);
+
+ while(true) {
+ if (LEDTimer.read_ms() > timeToChangeDF) { // check for timer time out transtion
+ lightData = (1.0 - LightSensor.read()); // show as increasiing with increasing intensity
+ sprintf(lcdData,"%4.3f",lightData);
+ LCDMess(lcdData);
+ gled = lightData;
+ rled = lightData;
timeToChangeDF = DATATIME;
LEDTimer.reset();
- }
+ }
}// emd while
}
