Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:93eba49d1dc1, committed 2021-03-26
- Comitter:
- BertieHarte
- Date:
- Fri Mar 26 10:21:16 2021 +0000
- Commit message:
- make public
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Mar 26 10:21:16 2021 +0000
@@ -0,0 +1,37 @@
+//Write a program use pot values as color mixer on 2 channels of the RGB LED.
+
+#include "mbed.h"
+// setup analog inputs (pots) and digital outputs.
+// digital outputs are only required to turn the RGB LED fully off on ititialising.
+DigitalOut R(p23); //Red pin of RGB LED
+DigitalOut G(p24); //Green pin of RGB LED
+DigitalOut B(p25); //Blue pin of RGB LED
+
+// declare PwmOut on red(p23) & blue(p25) of RGB.
+PwmOut g(p24);
+PwmOut r(p23);
+
+
+int main() {
+
+R = G = B = 1; // init RGB led to off (all 1)
+
+while(1)
+
+{
+AnalogIn pot1(p19);// input from pot 1
+AnalogIn pot2(p20);// input from pot 2
+ printf("pot value 1 = %f \n\r", pot1);
+// g.period(4.0f);
+ g.write (1 /pot1);
+ printf("pot value 2 = %f \n\r", pot2);
+ r.write (1 /pot2);
+ wait (0.1);
+
+
+
+
+
+}
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Mar 26 10:21:16 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file