RGB led

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
rudolf5020
Date:
Wed Aug 19 12:47:23 2020 +0000
Commit message:
question3

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 e6a9e4183550 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Aug 19 12:47:23 2020 +0000
@@ -0,0 +1,18 @@
+#include "mbed.h"
+ 
+Serial pc(USBTX,USBRX);
+
+AnalogIn pot1(p19);/// potentiometer 1
+AnalogIn pot2(p20);//potentiometer 2
+PwmOut red(p23);//Pulse width modulator(red)
+PwmOut green(p24);//Pulse width modulator(green)
+
+ 
+int main(){
+    while (1) {
+        red = 1- pot1;
+        green = 1- pot2;
+        pc.printf("pot1 = %f    pot2 = %f   \r", pot1.read(),pot2.read());  
+        wait (0.5); //wait half a second
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r e6a9e4183550 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Aug 19 12:47:23 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file