blink D3 LED on UDK2 board
Dependencies: mbed
main.cpp@0:6c83a2dfae11, 2015-09-25 (annotated)
- Committer:
- mfiore
- Date:
- Fri Sep 25 15:47:01 2015 +0000
- Revision:
- 0:6c83a2dfae11
initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mfiore | 0:6c83a2dfae11 | 1 | #include "mbed.h" |
mfiore | 0:6c83a2dfae11 | 2 | |
mfiore | 0:6c83a2dfae11 | 3 | DigitalOut led(LED1); |
mfiore | 0:6c83a2dfae11 | 4 | Ticker tick; |
mfiore | 0:6c83a2dfae11 | 5 | |
mfiore | 0:6c83a2dfae11 | 6 | void tock() { |
mfiore | 0:6c83a2dfae11 | 7 | led = !led; |
mfiore | 0:6c83a2dfae11 | 8 | } |
mfiore | 0:6c83a2dfae11 | 9 | |
mfiore | 0:6c83a2dfae11 | 10 | int main() { |
mfiore | 0:6c83a2dfae11 | 11 | // call the tock() function every 0.5 seconds |
mfiore | 0:6c83a2dfae11 | 12 | tick.attach(&tock, 0.5); |
mfiore | 0:6c83a2dfae11 | 13 | |
mfiore | 0:6c83a2dfae11 | 14 | while (true); |
mfiore | 0:6c83a2dfae11 | 15 | } |