Esercitazione 2 - 1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
MDevolution
Date:
Mon Oct 10 09:32:02 2016 +0000
Commit message:
Esercitazione 2 - 1

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 d5d4964911b6 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Oct 10 09:32:02 2016 +0000
@@ -0,0 +1,18 @@
+//Program Example 1: Uses analog input to control a LED
+
+#include "mbed.h"
+AnalogIn Ain(PA_0); //defines analog input on Pin A0
+DigitalOut led(D3);
+int main()
+{
+    float val=0;
+    const float treshold = 0.5;
+    led = 0;
+    while(1) {
+        val = Ain.read();
+        if (val>treshold)
+            led=1;
+        else
+            led=0;
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r d5d4964911b6 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Oct 10 09:32:02 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3
\ No newline at end of file