My attempt at using the mbed without the mbed libraries.
Here is a main.cpp, that uses the registers library.
Diff: main.cpp
- Revision:
- 7:411ae6b21c9b
- Parent:
- 6:d40cd917854d
diff -r d40cd917854d -r 411ae6b21c9b main.cpp --- a/main.cpp Thu Jan 03 05:10:49 2013 +0000 +++ b/main.cpp Thu Jan 03 05:25:38 2013 +0000 @@ -1,6 +1,6 @@ #include "registers.h" DigitalOut led1(p20); -DigitalOut led2(LED2); +DigitalOut led2(p19); DigitalOut led3(LED3); DigitalOut led4(LED4); DigitalIn switch1(p21); @@ -10,6 +10,7 @@ Timeout tock; Ticker tock2; +Ticker tock3; extern "C" void turnOff(void) { led1 = 0; @@ -17,13 +18,19 @@ extern "C" void turnOn(void) { led1 = 1; - tock.attach(&turnOff, 0.05); + tock.attach(&turnOff, 0.0001); +} + +extern "C" void led2flip(void) +{ + led2 = !led2; } int main() { //Timer and Ticker demonstration switch1.mode(PULLDOWN); t.start(); - tock2.attach(&turnOn, 0.5); + tock2.attach(&turnOn, 0.005); + tock3.attach(&led2flip, 0.0025); while(1) { double time = t;