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: easy-connect-v16 Watchdog FP MQTTPacket RecordType-v-16 watersenor_and_temp_code
Diff: main.cpp
- Revision:
- 29:3636503b2539
- Parent:
- 26:f40cc4d011b0
--- a/main.cpp Thu Jan 04 17:17:42 2018 +0000
+++ b/main.cpp Mon Jan 08 15:00:28 2018 +0000
@@ -1,3 +1,5 @@
+// For receiving message handles, search "Message Handles" in SimpleMQTT.h
+
/***************************************************************
* Includes
***************************************************************/
@@ -24,7 +26,7 @@
uint32_t uploadPeriod = 4; /* Period between each time upload all data = uploadPeriod*readSecond = 20 s */
uint32_t uploadPeriodCounter = 0;
-struct UploadValue DataStruct = {17, 18, 0, 1, 0, 65, 80, 10};
+struct UploadValue DataStruct = {19, 25, 0, 1, 0, 65, 80, 10};
/* Analog Handles */
float ADC_PHVal;
@@ -36,6 +38,8 @@
static Serial pc(SERIAL_TX, SERIAL_RX);
DigitalOut myled(LED1);
+DigitalOut led1(RELAY_1_PIN);
+DigitalOut led2(RELAY_2_PIN);
Timer UploadTimer;
/***************************************************************
@@ -45,7 +49,15 @@
/***************************************************************
* Unity function declarations
***************************************************************/
-
+void MQTT_MessageHandles(uint8_t ControlSignal) {
+ switch(ControlSignal) {
+ case (1): led1 = !led1;
+ break;
+ case (2): led2 = !led2;
+ break;
+ default: break;
+ }
+}
/***************************************************************
@@ -55,7 +67,7 @@
pc.baud(115200);
UploadTimer.start();
lastRead = 0;
-// set_time(1513125870);
+ set_time(1515445620);
pc.printf("\r\nX-NUCLEO-IDW01M1 mbed Application\r\n");
pc.printf("\r\nconnecting to AP\r\n");