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:
- 27:27cffdb2e9d3
- Parent:
- 11:4c3876be77b1
- Child:
- 37:1251e35fe43e
--- a/main.cpp Mon Jan 09 17:12:34 2017 +0100
+++ b/main.cpp Mon Jan 09 23:26:52 2017 +0000
@@ -1,24 +1,32 @@
+#include "common.h"
#include "master.h"
-#include "sensor_main.h"
-#include "common.h"
+#include "sensor_board.h"
-#define MASTER 0
-#define SLAVE1 1
+const int MASTER_MODE = 0;
+const int BOARD1_MODE = 1;
+const int BOARD2_MODE = 2;
+const int BOARD3_MODE = 3;
-
-// ATTENTION: choose mode in flag!
+// Note: choose mode using MODE macro!
int main() {
switch(MODE) {
- case MASTER:
+ case MASTER_MODE: {
master_loop();
break;
- case SLAVE1:
- // TODO vector of description for multiple sensors
- // TODO sensor class
- SensorDescription description(PIR1, PIR1_ADDRESS, MASTER_ADDRESS);
- sensor_loop(description);
+ } case BOARD1_MODE: {
+ DigitalSensor pir1(PIR1);
+ AnalogSensor sound_sensor(SOUND);
+ Board(BOARD1_ADDRESS, &pir1, &sound_sensor).run();
break;
+ } case BOARD2_MODE: {
+ DigitalSensor pir2(PIR2);
+ Board(BOARD2_ADDRESS, &pir2, NULL).run();
+ break;
+ } case BOARD3_MODE: {
+ AnalogSensor distance_sensor(DISTANCE);
+ Board(BOARD3_ADDRESS, NULL, &distance_sensor).run();
+ break;
+ }
}
-
return 0;
}
\ No newline at end of file