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@9:a6bed03648e5, 2018-01-05 (annotated)
- Committer:
- Pokitto
- Date:
- Fri Jan 05 02:29:59 2018 +0000
- Revision:
- 9:a6bed03648e5
- Parent:
- 8:1f8f91d671a5
- Child:
- 10:f5dfd33d5431
PokittoLib updated
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 | 9:a6bed03648e5 | 24 | pokitto.display.color=led0+1; |
| Pokitto | 9:a6bed03648e5 | 25 | pokitto.display.setCursor(0,0); |
| Pokitto | 9:a6bed03648e5 | 26 | if (led0==0) pokitto.display.print("Hello World!"); |
| Pokitto | 9:a6bed03648e5 | 27 | else pokitto.display.print("Hei Etlari!"); |
| Pokitto | 8:1f8f91d671a5 | 28 | |
| Pokitto | 8:1f8f91d671a5 | 29 | // if the A button is pressed |
| Pokitto | 8:1f8f91d671a5 | 30 | if(pokitto.buttons.aBtn()) |
| Pokitto | 8:1f8f91d671a5 | 31 | { |
| Pokitto | 8:1f8f91d671a5 | 32 | // send a high signal to turn the LED on |
| Pokitto | 8:1f8f91d671a5 | 33 | led0.write(1); |
| Pokitto | 8:1f8f91d671a5 | 34 | } |
| Pokitto | 8:1f8f91d671a5 | 35 | |
| Pokitto | 8:1f8f91d671a5 | 36 | // if the B button is pressed |
| Pokitto | 8:1f8f91d671a5 | 37 | if(pokitto.buttons.bBtn()) |
| Pokitto | 8:1f8f91d671a5 | 38 | { |
| Pokitto | 8:1f8f91d671a5 | 39 | // send a low signal to turn the LED off |
| Pokitto | 8:1f8f91d671a5 | 40 | led0.write(0); |
| Pokitto | 8:1f8f91d671a5 | 41 | } |
| Pokitto | 8:1f8f91d671a5 | 42 | } |
| Pokitto | 8:1f8f91d671a5 | 43 | } |
| Pokitto | 8:1f8f91d671a5 | 44 | |
| Pokitto | 8:1f8f91d671a5 | 45 | return 1; |
| Pokitto | 0:2d2a3994d55d | 46 | } |
