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.
Diff: main.cpp
- Revision:
- 0:97e5dad63cdd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Apr 27 03:07:20 2013 +0000
@@ -0,0 +1,60 @@
+#include "mbed.h"
+
+PwmOut led1(LED2);
+PwmOut led2(LED1);
+PwmOut led3(LED3);
+
+Serial pc(USBTX, USBRX);
+
+void ledCheck(double *led, double current, double high, double low);
+
+
+int main() {
+
+ int press;
+ double d1 = 0.01;
+ double d2 = 0.01;
+ double d3 = 0.01;
+ led1.period(0.001);
+ led2.period(0.001);
+ led3.period(0.001);
+ led1 = 0.33;
+ led2 = 0.66;
+ led3 = 1.0;
+ double current;
+
+ wait(1.0);
+
+ while(true) {
+
+
+ wait(0.02);
+ led1 = led1 + d1;
+ wait(0.02);
+ led2 = led2 + d2;
+ wait(0.02);
+ led3 = led3 + d3;
+
+ current = led1;
+ ledCheck(&d1, current, 1.0, 0.0);
+ current = led2;
+ ledCheck(&d2, current, 1.0, 0.0);
+ current = led3;
+ ledCheck(&d3, current, 1.0, 0.0);
+
+
+
+ }
+ }
+
+
+
+void ledCheck(double *led, double current, double high, double low){
+
+ if(current <= low){
+ *led = 0.01;
+ }else if(current >= high){
+ *led = -0.01;
+ }else{}
+
+}