Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Blinky by
main.cpp@8:1f8f91d671a5, 2017-11-22 (annotated)
- Committer:
- Pokitto
- Date:
- Wed Nov 22 22:33:43 2017 +0000
- Revision:
- 8:1f8f91d671a5
- Parent:
- 5:c4a0391b43ac
- Child:
- 9:a6bed03648e5
Initial commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Pokitto | 0:2d2a3994d55d | 1 | #include "Pokitto.h" |
| Pokitto | 0:2d2a3994d55d | 2 | |
| Pokitto | 8:1f8f91d671a5 | 3 | // the pokitto core library |
| Pokitto | 8:1f8f91d671a5 | 4 | Pokitto::Core pokitto; |
| Pokitto | 8:1f8f91d671a5 | 5 | |
| Pokitto | 8:1f8f91d671a5 | 6 | // create a 'DigitalOut' object to represent |
| Pokitto | 8:1f8f91d671a5 | 7 | // the digital output pin used to communicated with the LED |
| Pokitto | 8:1f8f91d671a5 | 8 | // the object is set to use the EXT0 pin for output |
| Pokitto | 8:1f8f91d671a5 | 9 | DigitalOut led0 = DigitalOut(EXT0); |
| Pokitto | 8:1f8f91d671a5 | 10 | |
| Pokitto | 8:1f8f91d671a5 | 11 | int main () |
| Pokitto | 8:1f8f91d671a5 | 12 | { |
| Pokitto | 8:1f8f91d671a5 | 13 | // initialise the Pokitto |
| Pokitto | 8:1f8f91d671a5 | 14 | pokitto.begin(); |
| Pokitto | 0:2d2a3994d55d | 15 | |
| Pokitto | 8:1f8f91d671a5 | 16 | // the main loop |
| Pokitto | 8:1f8f91d671a5 | 17 | while (pokitto.isRunning()) |
| Pokitto | 8:1f8f91d671a5 | 18 | { |
| Pokitto | 8:1f8f91d671a5 | 19 | // update the Pokitto's state |
| Pokitto | 8:1f8f91d671a5 | 20 | if (pokitto.update()) |
| Pokitto | 8:1f8f91d671a5 | 21 | { |
| Pokitto | 8:1f8f91d671a5 | 22 | // write 'Hello World!' to the screen |
| Pokitto | 8:1f8f91d671a5 | 23 | // this is so you can tell the Pokitto is running |
| Pokitto | 8:1f8f91d671a5 | 24 | pokitto.display.print("Hello World!"); |
| Pokitto | 8:1f8f91d671a5 | 25 | |
| Pokitto | 8:1f8f91d671a5 | 26 | // if the A button is pressed |
| Pokitto | 8:1f8f91d671a5 | 27 | if(pokitto.buttons.aBtn()) |
| Pokitto | 8:1f8f91d671a5 | 28 | { |
| Pokitto | 8:1f8f91d671a5 | 29 | // send a high signal to turn the LED on |
| Pokitto | 8:1f8f91d671a5 | 30 | led0.write(1); |
| Pokitto | 8:1f8f91d671a5 | 31 | } |
| Pokitto | 8:1f8f91d671a5 | 32 | |
| Pokitto | 8:1f8f91d671a5 | 33 | // if the B button is pressed |
| Pokitto | 8:1f8f91d671a5 | 34 | if(pokitto.buttons.bBtn()) |
| Pokitto | 8:1f8f91d671a5 | 35 | { |
| Pokitto | 8:1f8f91d671a5 | 36 | // send a low signal to turn the LED off |
| Pokitto | 8:1f8f91d671a5 | 37 | led0.write(0); |
| Pokitto | 8:1f8f91d671a5 | 38 | } |
| Pokitto | 8:1f8f91d671a5 | 39 | } |
| Pokitto | 8:1f8f91d671a5 | 40 | } |
| Pokitto | 8:1f8f91d671a5 | 41 | |
| Pokitto | 8:1f8f91d671a5 | 42 | return 1; |
| Pokitto | 0:2d2a3994d55d | 43 | } |
