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

Dependencies:   mbed

main.cpp

Committer:
chapfohn
Date:
2014-03-07
Revision:
2:81628a105aa0
Parent:
1:35dabcdf9c02

File content as of revision 2:81628a105aa0:

#include "mbed.h"

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()
{
    r.period(0.001);
    g.period(0.001);
    b.period(0.001);
    
    while(1) {
    
        r = rP; //read onboard POT
        g = gP; //read onboard POT
        b = bP; //read external variable resistive element in votage divider network
        
        wait (t); //change in i/o declarations
    }
    
}