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.
Dependencies: EthernetInterface mbed-rtos mbed
Diff: main.cpp
- Revision:
- 2:c1d4ea63ab89
- Parent:
- 1:95407c4ef69e
- Child:
- 3:82cf87db7ef4
--- a/main.cpp Thu Nov 08 07:41:57 2012 +0000
+++ b/main.cpp Thu Nov 08 08:10:37 2012 +0000
@@ -29,10 +29,6 @@
meter_LED_outside.period_ms (1);
- int i = 0;
- //int j = 0;
- int mode = (buffer[0] - 'A');
-
while (1) {
TCPSocketConnection client;
server.accept(client);
@@ -42,45 +38,37 @@
char buffer[256];
while (true) {
int n = client.receive(buffer, sizeof(buffer));
-
+ int mode = (buffer[0] - 'A');
if (n > 0) {
- //int target = (buffer[1] - '0') * 100 + (buffer[2] - '0') * 10 + (buffer[3] - '0');
- if (i == 1) {
- while (1) {
- digitalclock_colon = 1;
- wait (0.5);
- digitalclock_colon = 0;
- wait (0.5);
- }
- }
- if (buffer[0] == 'A') {
+ int target = (buffer[1] - '0') * 100 + (buffer[2] - '0') * 10 + (buffer[3] - '0');
- if (i <= 0) {
- for(float p = 0.0f; p < 1.0f; p += 0.01f) {
+ switch (mode) {
+ case 0:
+ for(float p = 0.0f; p < 1.0f; p += 0.02f) {
meter_LED_outside = p;
wait(0.01);
}
- for(float p = 0.0f; p < 1.0f; p += 0.01f) {
+ for(float p = 0.0f; p < 1.0f; p += 0.02f) {
meter_LED_inside = p;
wait(0.01);
}
- for(float p = 0.0f; p < 1.0f; p += 0.01f) {
+ for(float p = 0.0f; p < 1.0f; p += 0.02f) {
range_LED_3 = p;
wait(0.01);
}
- for(float p = 0.0f; p < 1.0f; p += 0.01f) {
+ for(float p = 0.0f; p < 1.0f; p += 0.02f) {
range_LED_2 = p;
wait(0.01);
}
- for(float p = 0.0f; p < 1.0f; p += 0.01f) {
+ for(float p = 0.0f; p < 1.0f; p += 0.02f) {
range_LED_1 = p;
wait(0.01);
}
- for(float p = 0.0f; p < 1.0f; p += 0.01f) {
+ for(float p = 0.0f; p < 1.0f; p += 0.02f) {
needle_LED = p;
wait(0.01);
}
- for(float p = 1.0f; p > 0.0f; p -= 0.01f) {
+ for(float p = 1.0f; p > 0.0f; p -= 0.02f) {
meter_LED_outside = p;
meter_LED_inside = p;
range_LED_3 = p;
@@ -95,8 +83,13 @@
signal_LED_L = 0;
signal_LED_R = 0;
wait (0.5);
+ signal_LED_L = 1;
+ signal_LED_R = 1;
+ wait (0.5);
+ signal_LED_L = 0;
+ signal_LED_R = 0;
+ wait (0.5);
- wait(1.0);
for(float p = 0.0f; p < 0.2f; p += 0.01f) {
meter_LED_outside = p;
meter_LED_inside = p;
@@ -106,29 +99,35 @@
needle_LED = (p + 0.8);
wait(0.05);
}
- i = 1;
digitalclock = 1;
- }
- } else if (buffer[0] == 'B') {
- digitalclock = 0;
- digitalclock_colon = 0;
- for(float p = 0.8f; p > 0.0f; p -= 0.01f) {
- meter_LED_outside = p;
- meter_LED_inside = p;
- range_LED_3 = p;
- range_LED_2 = p;
- range_LED_1 = p;
- needle_LED = p;
- wait(0.01);
- }
- } else if (buffer[0] == 'F') {
+ break;
+
+ case 1:
+ digitalclock = 0;
+ digitalclock_colon = 0;
+ for(float p = 0.8f; p > 0.0f; p -= 0.01f) {
+ meter_LED_outside = p;
+ meter_LED_inside = p;
+ range_LED_3 = p;
+ range_LED_2 = p;
+ range_LED_1 = p;
+ needle_LED = p;
+ wait(0.01);
+ }
+ break;
+ }
+ if (buffer[0] == 'F') {
meter_LED_outside = (target / 10.0)-0.2;
} else if (buffer[0] == 'G') {
meter_LED_inside = (target / 10.0)-0.2;
}
+ }
+ digitalclock_colon = 1;
+ wait (0.5);
+ digitalclock_colon = 0;
+ //wait (0.25);
+ }
- }
- }
}
}
