Esercitazione 2 - 2

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
MDevolution
Date:
Mon Oct 10 09:34:00 2016 +0000
Commit message:
Esercitazione 2 -2

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 1340878988a7 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Oct 10 09:34:00 2016 +0000
@@ -0,0 +1,13 @@
+//Program Example 2: Uses analog input to control PWM duty cycle, fixed period
+
+#include "mbed.h"
+
+PwmOut PWM1(D5);
+AnalogIn Ain(A0);           //defines analog input on A0
+int main(){
+    while(1){
+        PWM1.period(0.010); // set PWM period to 10 ms
+        PWM1=Ain;           //Analog in value becomes PWM duty, both are type float
+        wait(0.1);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 1340878988a7 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Oct 10 09:34:00 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3
\ No newline at end of file