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.
Dependencies: C12832_lcd mbed
Fork of app-board-Joystick-with-LCD by
main.cpp
00001 #include "mbed.h" 00002 #include "C12832_lcd.h" 00003 00004 // LCD and Joystick Setting 00005 C12832_LCD lcd; 00006 00007 BusIn Up(p15); 00008 BusIn Down(p12); 00009 BusIn Left(p13); 00010 BusIn Right(p16); 00011 BusOut Reset(p14); 00012 00013 DigitalOut myled(LED1); 00014 DigitalOut myled2(LED2); 00015 DigitalOut myled3(LED3); 00016 DigitalOut myled4(LED4); 00017 00018 int x = 0; 00019 float y =0.0; 00020 00021 // Custom Function 00022 void initialize(); 00023 void LCD_Anzeige(); 00024 void LED_Blinky(); 00025 00026 00027 // Main 00028 int main() 00029 { 00030 initialize(); 00031 while(1) 00032 { 00033 LCD_Anzeige(); 00034 LED_Blinky(); 00035 x++; 00036 y=sqrt(float(x)); 00037 lcd.printf("%d,%f",x,y); 00038 wait(1.0); 00039 } 00040 } 00041 void initialize() 00042 { 00043 lcd.cls(); 00044 lcd.locate(0,0); 00045 lcd.printf("Hallo Bielefeld!"); 00046 } 00047 00048 void LED_Blinky(){ 00049 myled = 1; 00050 wait(0.2); 00051 myled = 0; 00052 wait(0.2); 00053 00054 myled2 = 1; 00055 wait(0.2); 00056 myled2 = 0; 00057 wait(0.2); 00058 00059 myled3 = 1; 00060 wait(0.2); 00061 myled3 = 0; 00062 wait(0.2); 00063 00064 myled4 = 1; 00065 wait(0.2); 00066 myled4 = 0; 00067 wait(0.2); 00068 } 00069 00070 void LCD_Anzeige(){ 00071 lcd.cls(); 00072 lcd.locate(0,0); 00073 lcd.printf("Hallo Bielefeld!"); 00074 lcd.locate(0,15); // Set Location print a text 00075 // Operations by Joystic 00076 if (Up) 00077 00078 lcd.printf("UP"); 00079 if (Down) 00080 00081 lcd.printf("Down"); 00082 if (Left) 00083 00084 lcd.printf("Left"); 00085 if (Right) 00086 00087 lcd.printf("Right"); 00088 if (Reset) 00089 initialize(); 00090 00091 }
Generated on Sun Aug 7 2022 00:09:29 by
1.7.2
