LCD Hello mbed World!

Dependencies:   mbed TextLCD

Files at this revision

API Documentation at this revision

Comitter:
ksestak
Date:
Fri Jun 19 15:55:05 2020 +0000
Parent:
0:0a5c73c2369a
Commit message:
Regulacija napona potenciometrom

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 0a5c73c2369a -r b501f964e376 TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Fri Jun 19 15:55:05 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/pangsk/code/TextLCD/#ec079a141883
diff -r 0a5c73c2369a -r b501f964e376 main.cpp
--- 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
+