Variation - reads external variable resistor in voltages divider network on pin 18. Transition time defined.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
chapfohn
Date:
Fri Mar 07 07:50:19 2014 +0000
Parent:
1:35dabcdf9c02
Commit message:
Variation - reads external variable resistor in voltages divider network on pin 18.; Transition time also defined.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 35dabcdf9c02 -r 81628a105aa0 main.cpp
--- a/main.cpp	Mon Dec 16 10:55:24 2013 +0000
+++ b/main.cpp	Fri Mar 07 07:50:19 2014 +0000
@@ -3,9 +3,12 @@
 PwmOut r (p23);
 PwmOut g (p24);
 PwmOut b (p25);
+
 AnalogIn  rP (p19);
 AnalogIn  gP (p20);
+AnalogIn  bP (p18);
 
+float t = .001; //change time between new readings 
 
 int main()
 {
@@ -15,12 +18,11 @@
     
     while(1) {
     
-        r = rP;
-        g = gP;
+        r = rP; //read onboard POT
+        g = gP; //read onboard POT
+        b = bP; //read external variable resistive element in votage divider network
         
-        b = 0.5;  
-        
-        wait (0.01);
+        wait (t); //change in i/o declarations
     }
     
 }