Lab that has to do with basic IO on mbed.
Dependencies: DebounceIn mbed PinDetect
Diff: JessesLab1/main.cpp
- Revision:
- 40:430e3884226a
- Parent:
- 39:8bd6d99afa67
- Child:
- 41:5bcf3ab83113
--- a/JessesLab1/main.cpp Sun Jan 17 22:01:08 2016 -0500 +++ b/JessesLab1/main.cpp Sun Jan 17 22:32:41 2016 -0500 @@ -4,15 +4,31 @@ #include "PinDetect.h" PinDetect pb(p8); -DigitalOut led(p21); +PwmOut led(p21); int main() { +float pwr = 0; + pb.mode(PullUp); while(1) { - led = !pb; + if(pb) { + + pwr = pwr + 0.1; + + if (pwr >= 1) { + pwr = 0; + } + + led.write(pwr); + } + else { + led.write(0); + } + + //led = !pb; } }