Mihajlo Djordjevic 2020/0438

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mixidj
Date:
Sat Nov 13 08:59:34 2021 +0000
Commit message:
Test 2 Mihajlo Djordjevic

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 849fcc3d83a1 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Nov 13 08:59:34 2021 +0000
@@ -0,0 +1,44 @@
+// Mihajlo Djordjevic 2020/0438
+// Uvoz biblioteke
+#include "mbed.h"
+//Makro
+#define POLLING_PERIOD 20
+#define MAX_POT1 0.9f
+#define MAX_POT2 0.8f
+#define MAX_PERIOD 1.05
+// Glavne promenljive
+PwmOut buzzer(PA_11);
+AnalogIn pot1(PA_0);
+AnalogIn pot2(PA_1);
+InterruptIn button(PC_9);
+
+
+// Funkcije
+void ISR_procenat(void);
+
+int main () {
+    
+    
+    while(true) {
+        button.fall(ISR_procenat);
+        if(pot1.read() < MAX_POT1){
+            buzzer = pot1.read();
+            }
+        else buzzer = MAX_POT1;
+        
+        
+        printf(" pot1 : %1.2f pot2 : %1.2f \r", pot1.read(),pot2.read());
+        
+        float period;
+        if(pot2.read() < MAX_POT2){
+            period = 5 - pot2.read() * 4.95;
+            buzzer.period_ms(period);
+        }
+        else buzzer.period_ms(MAX_PERIOD);
+        wait_ms(POLLING_PERIOD);
+        }
+}
+void ISR_procenat(){
+    
+    }   
+    
\ No newline at end of file
diff -r 000000000000 -r 849fcc3d83a1 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Nov 13 08:59:34 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file