Shane Barton
/
sbart_lightsense_kl46z_PWM_simple
SB_HW_3-2
Fork of lightsense_kl46z_PWM_simple by
Diff: main.cpp
- Revision:
- 9:cc1bae13d6be
- Parent:
- 8:ea818c9220fc
diff -r ea818c9220fc -r cc1bae13d6be main.cpp --- a/main.cpp Mon Jan 25 16:10:38 2016 +0000 +++ b/main.cpp Sun Feb 05 06:53:04 2017 +0000 @@ -7,8 +7,6 @@ #define LCDLEN 10 #define LIGHTSENSORPORT PTE22 - - SLCD slcd; //define LCD display globally define Serial pc(USBTX, USBRX); Timer LEDTimer; @@ -17,6 +15,8 @@ slcd.Home(); slcd.clear(); slcd.printf(lMess); + + slcd.DP(0, false); //Disables the decimal point in position 0 } int main() { @@ -35,14 +35,14 @@ while(true) { if (LEDTimer.read_ms() > timeToChangeDF){ // check for timer time out transtion - lightData = (1.0 - LightSensor.read()); // show as increasiing with increasing intensity - greenColor.write(1.0- lightData); - redColor.write(1.0-lightData); + lightData = (1.0 - LightSensor.read()) * 100; // show as increasiing with increasing intensity + greenColor.write(1.0 - lightData); + redColor.write(1.0 - lightData); sprintf(lcdData,"%4.3f",lightData); LCDMess(lcdData); pc.printf("%4.3f\r\n",lightData); timeToChangeDF = DATATIME; LEDTimer.reset(); } - }// emd while + }// end while }