Working with LED and ADC

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
div1104
Date:
Sat Jan 23 16:50:22 2021 +0000
Commit message:
LED and ADC

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 e7b738bf1ffc main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Jan 23 16:50:22 2021 +0000
@@ -0,0 +1,16 @@
+#include "mbed.h"
+
+AnalogIn ain(A1);
+PwmOut led(LED1);
+
+int main() 
+{
+    float adc_value;
+    while(1) 
+    {
+        adc_value=ain.read();
+        led=1-adc_value;
+        wait_ms(40);
+    }
+}
+
diff -r 000000000000 -r e7b738bf1ffc mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Jan 23 16:50:22 2021 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/64910690c574
\ No newline at end of file