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.
Blinking_Leds_Forloop.cpp@4:f4fcecf27b0e, 2021-06-02 (annotated)
- Committer:
- kgabriel
- Date:
- Wed Jun 02 16:03:20 2021 +0000
- Revision:
- 4:f4fcecf27b0e
Blinking Led using for Loop
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kgabriel | 4:f4fcecf27b0e | 1 | #include "mbed.h" |
kgabriel | 4:f4fcecf27b0e | 2 | #include "C12832.h" |
kgabriel | 4:f4fcecf27b0e | 3 | |
kgabriel | 4:f4fcecf27b0e | 4 | DigitalIn pushButton(p9); |
kgabriel | 4:f4fcecf27b0e | 5 | C12832 lcd(SPI_MOSI,SPI_SCK,SPI_MISO,p8,p10); |
kgabriel | 4:f4fcecf27b0e | 6 | |
kgabriel | 4:f4fcecf27b0e | 7 | void display(char *lcdPrint){ |
kgabriel | 4:f4fcecf27b0e | 8 | lcd.cls(); |
kgabriel | 4:f4fcecf27b0e | 9 | lcd.printf(lcdPrint); |
kgabriel | 4:f4fcecf27b0e | 10 | lcd.locate(3,5); |
kgabriel | 4:f4fcecf27b0e | 11 | |
kgabriel | 4:f4fcecf27b0e | 12 | } |
kgabriel | 4:f4fcecf27b0e | 13 | |
kgabriel | 4:f4fcecf27b0e | 14 | int main(){ |
kgabriel | 4:f4fcecf27b0e | 15 | while(1){ |
kgabriel | 4:f4fcecf27b0e | 16 | int i; |
kgabriel | 4:f4fcecf27b0e | 17 | if(pushButton==1){ |
kgabriel | 4:f4fcecf27b0e | 18 | DigitalOut led(p5); |
kgabriel | 4:f4fcecf27b0e | 19 | for(i=0;i<3;i++){ |
kgabriel | 4:f4fcecf27b0e | 20 | led = 0; |
kgabriel | 4:f4fcecf27b0e | 21 | display("LED Blinking1"); |
kgabriel | 4:f4fcecf27b0e | 22 | wait(2); |
kgabriel | 4:f4fcecf27b0e | 23 | led=1; |
kgabriel | 4:f4fcecf27b0e | 24 | wait(2); |
kgabriel | 4:f4fcecf27b0e | 25 | } |
kgabriel | 4:f4fcecf27b0e | 26 | led=0; |
kgabriel | 4:f4fcecf27b0e | 27 | wait(1); |
kgabriel | 4:f4fcecf27b0e | 28 | } |
kgabriel | 4:f4fcecf27b0e | 29 | } |
kgabriel | 4:f4fcecf27b0e | 30 | |
kgabriel | 4:f4fcecf27b0e | 31 | } |