Lab that has to do with basic IO on mbed.
Dependencies: DebounceIn mbed PinDetect
Diff: JessesLab1/main.cpp
- Revision:
- 43:a07c473ee4c7
- Parent:
- 42:841b1bf3f173
- Child:
- 44:30abfd5d24f2
--- a/JessesLab1/main.cpp Mon Jan 18 10:00:29 2016 -0500 +++ b/JessesLab1/main.cpp Mon Jan 18 15:10:33 2016 +0000 @@ -4,37 +4,16 @@ #include "PinDetect.h" PinDetect light(p8); -DebounceIn dimmer(p15); PwmOut led(p21); int main() { -float ind = 0; -float bright = 0; - - pb.mode(PullUp); + light.mode(PullUp); while(1) { - if(!dimmer) { - ind = ind + 1; - wait(1); - if(ind <= 4) { - ind = 0; - } - } - - bright = ind * 0.25; - - if(!light) { - - led.write(bright); + + led.write(!light); } - else { - led.write(0); - } - //led = !pb; - - } }