RGB led

Dependencies:   mbed

Revision:
0:e6a9e4183550
--- /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