My personal projects

Revision:
0:ecd984e9f637
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jan 19 11:27:16 2021 +0200
@@ -0,0 +1,41 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2019 ARM Limited
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include "mbed.h"
+
+
+// Blinking rate in milliseconds
+#define BLINKING_RATE     500ms
+
+
+int main()
+{
+    // Initialise the digital pin LED1 as an output
+    float x = 0.0f;
+    AnalogIn volume(p15);
+    DigitalOut ledone(LED1);
+    DigitalOut ledtwo(LED2);
+    DigitalOut ledthree(LED3);
+    DigitalOut ledfour(LED4);
+
+
+
+
+
+    while (true) {
+        x = volume.read()
+        if (x<0.25){
+            ledone.write(1)
+        }
+        else if ((x >= 0.25) (&& x< 0.5)){
+            ledotwo.write(1)
+        } else if((x >= 0.5) (&& x<0.75)){
+            ledthree.write(1)
+        } else(x>0.75){
+            ledfour.write(1)
+        }
+        ThisThread::sleep_for(5s);
+    }
+}