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.
Dependencies: 4DGL-uLCD-SE mbed
Diff: src/LEDControl.cpp
- Revision:
- 17:4d0e180cde20
- Parent:
- 10:99392075e1d0
- Child:
- 18:94536dca963c
--- a/src/LEDControl.cpp Tue Oct 20 09:32:35 2015 +0000
+++ b/src/LEDControl.cpp Tue Oct 20 12:38:02 2015 +0000
@@ -7,15 +7,24 @@
RGBLed myRGBled2(p24,p23,p25); //RGB PWM pins
-void LEDControl::update(int x){
- strength = x;
- if( strength==0 ){
- myRGBled1.write(1.0,0.0,0.0); //red
- myRGBled2.write(1.0,0.0,0.0); //red
- }
- else if( strength != 0){
- myRGBled1.write(0.0,1.0,0.0); //green
- myRGBled2.write(0.0,1.0,0.0); //green
- }
+void LEDControl::update(float stren){
+
+ Serial pc(USBTX, USBRX);
+ pc.baud(115200);
+
+ strength = stren;
+ wait(2);
+ pc.printf("Passed strength: %f\r\n", strength);
+
+ float green = (100-strength) / 95;
+ float red = strength / 100;
+ wait(1);
+ pc.printf("Calculated green: %f\r\n", green);
+ wait(2);
+ pc.printf("Calculated red: %f\r\n", red);
+
+
+ myRGBled1.write(red , green ,0.0); //red
+ myRGBled2.write(red,green,0.0); //red
}
\ No newline at end of file
