LCD Hello mbed World!

Dependencies:   mbed TextLCD

Revision:
1:b501f964e376
Parent:
0:0a5c73c2369a
--- a/main.cpp	Sun Aug 08 11:46:42 2010 +0000
+++ b/main.cpp	Fri Jun 19 15:55:05 2020 +0000
@@ -2,8 +2,49 @@
 #include "TextLCD.h"
 
 TextLCD lcd(p24, p25, p26, p27, p28, p29, p30); // rs, rw, e, d4, d5, d6, d7
+AnalogIn Ain(p17);
+DigitalOut ledica1(LED1);
+float napon;
+InterruptIn button(p5);    //define and name the interrupt input
+DigitalOut led(LED3);       
+DigitalOut flash(LED4);
+
+void led_switch(void);
+Ticker time_up;                         //define a Ticker, with name “time_up”
+DigitalOut myled(LED2);
+void led_switch(){                      //the function that Ticker will call
+    myled=!myled;       
+}
+
+
+void ISR1() {            //this is the response to interrupt, i.e. the ISR
+  led = !led;
+}
+
+int moja_funkcija(float napon){
+    if(napon > 2){
+        ledica1 = 1;
+        }
+    else{
+        ledica1 = 0;
+        }
+        return ledica1;
+    }
 
 int main() {
-      lcd.cls();
-      lcd.printf("Hello mbed world!");
-}
\ No newline at end of file
+    button.rise(&ISR1);
+    while(1){
+    napon=Ain*3.3; 
+    lcd.printf("%4.2f V",napon);
+    moja_funkcija(napon);
+    wait(0.002);
+    lcd.cls();
+    flash = !flash;
+    wait(0.25);
+    time_up.attach(&led_switch, 0.5);             
+
+    }
+}
+
+//TextLCD lcd(p24, p25, p26, p27, p28, p29, p30); // rs, rw, e, d4, d5, d6, d7
+