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: libmDot mbed-rtos mbed
Fork of mDot_Connect_IoTClub_one_wire_4ch_8_24 by
Diff: main.cpp
- Revision:
- 14:0616e4361f0c
- Parent:
- 13:5d050b414f16
- Child:
- 15:04b37f329c84
diff -r 5d050b414f16 -r 0616e4361f0c main.cpp
--- a/main.cpp Sat Aug 20 11:43:09 2016 +0000
+++ b/main.cpp Wed Aug 24 11:52:28 2016 +0000
@@ -15,19 +15,19 @@
//#define NO_MULTITECH_GATEWAY
//Define the number of channels
-#define NUM_OF_CH 1
+#define NUM_OF_CH 4
-AnalogPHSensor CH0_PH(PB_0, 0.0, 0.0);
+AnalogPHSensor CH1_PH(PB_1, 0.0, 0.0);
#if (NUM_OF_CH >1)
- AnalogPHSensor CH1_PH(PB_1, 0.0, 0.0);
+ AnalogPHSensor CH2_PH(PB_0, 0.0, 0.0);
#endif
#if (NUM_OF_CH >2)
- AnalogPHSensor CH2_PH(PA_5, 0.0, 0.0);
+ AnalogPHSensor CH3_PH(PA_5, 0.0, 0.0);
#endif
#if (NUM_OF_CH >3)
- AnalogPHSensor CH3_PH(PA_4, 0.0, 0.0);
+ AnalogPHSensor CH4_PH(PA_4, 0.0, 0.0);
#endif
// these options must match the settings on your Conduit
@@ -46,7 +46,11 @@
int i, k;
int send_failed;
bool alarm_on;
-
+ const uint32_t baud = 1200;
+
+ int32_t setBaud(const uint32_t& baud);
+ uint32_t getBaud();
+
// get a mDot handle
dot = mDot::getInstance();
@@ -131,17 +135,17 @@
send_failed = 0;
alarm_on = false;
// Read the PH values
- for(k=0; k<NUM_OF_CH; k++){
+ for(k=1; k<(NUM_OF_CH+1); k++){
switch(k){
- case 0: phValue = CH0_PH; break;
+ case 1: phValue = CH1_PH; break;
#if (NUM_OF_CH >1)
- case 1: phValue = CH1_PH; break;
+ case 2: phValue = CH2_PH; break;
#endif
#if (NUM_OF_CH >2)
- case 2: phValue = CH2_PH; break;
+ case 3: phValue = CH3_PH; break;
#endif
#if (NUM_OF_CH >3)
- case 3: phValue = CH3_PH; break;
+ case 4: phValue = CH4_PH; break;
#endif
default:
break;
