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_LED_PushButton.cpp
00001 #include "mbed.h" 00002 #include "C12832.h" 00003 00004 DigitalIn pushButton(p9); 00005 00006 C12832 lcd(SPI_MOSI, SPI_SCK, SPI_MISO, p8, p11); 00007 00008 char ledBlinking[] = "Led is blinking"; 00009 00010 // create an instance of LCD 00011 static void display(char *lcdPrint) { 00012 lcd.cls(); // Clear LCD 00013 lcd.locate(3,5); // get cursor to position x=3px and y=5px 00014 lcd.printf(lcdPrint); // Write text into LCD buffer 00015 lcd.copy_to_lcd(); 00016 // Clear LCD 00017 } 00018 00019 00020 DigitalOut led(LED1); 00021 int i=0; 00022 00023 void Blink(){ 00024 00025 while(i<3){ 00026 display(ledBlinking); 00027 led = 0; 00028 wait(0.5); 00029 led = 1; 00030 wait(0.5); 00031 i++; 00032 } 00033 00034 led =0; 00035 lcd.cls(); 00036 } 00037 00038 int main() { 00039 while (1) { 00040 00041 if(pushButton == 1) 00042 { 00043 Blink(); 00044 } 00045 i=0; 00046 wait(0.5); 00047 00048 } 00049 }
Generated on Wed Jul 27 2022 03:38:40 by
