From: rtrimana Date: Thu, 10 May 2018 23:19:46 +0000 (-0700) Subject: Completing IR-sensor and Temp sensor for Particle cloud---adding time indication... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f5943d65a7cf5fd1a1363a169e7ebb6f0c5e39f9;p=iotcloud.git Completing IR-sensor and Temp sensor for Particle cloud---adding time indication for motion detection. --- diff --git a/version2/src/others/IR-Sensor/IR-Sensor_Particle-Cloud.ino b/version2/src/others/IR-Sensor/IR-Sensor_Particle-Cloud.ino index ac9f45f..1e74a7a 100644 --- a/version2/src/others/IR-Sensor/IR-Sensor_Particle-Cloud.ino +++ b/version2/src/others/IR-Sensor/IR-Sensor_Particle-Cloud.ino @@ -8,7 +8,6 @@ // // Based on tutorial: http://henrysbench.capnfatz.com/henrys-bench/arduino-sensors-and-input/arduino-hc-sr501-motion-sensor-tutorial/ -int pirValue; // Place to store read PIR Value int64_t machineId; // Key and data char keyBuffer[80]; @@ -34,7 +33,7 @@ void loop() { // Machine ID sprintf(keyBuffer, "%04x", machineId); // Motion detection - sprintf(dataBuffer, "motion-detected"); + sprintf(dataBuffer, "%s -> motion-detected", Time.timeStr().c_str()); Particle.publish(keyBuffer, dataBuffer); delay(1000); diff --git a/version2/src/others/IR-Sensor/Makefile b/version2/src/others/IR-Sensor/Makefile index 456a715..f3ab16b 100644 --- a/version2/src/others/IR-Sensor/Makefile +++ b/version2/src/others/IR-Sensor/Makefile @@ -13,11 +13,14 @@ compile: rm -f *.bin particle compile photon -flash0: - particle flash IoT-0 photon*.bin +flash8: + particle flash IoT-8 photon*.bin -flash1: - particle flash IoT-1 photon*.bin +flash9: + particle flash IoT-9 photon*.bin + +flash10: + particle flash IoT-10 photon*.bin PHONY += clean clean: diff --git a/version2/src/others/IR-Sensor/photon_firmware_1525906569609.bin b/version2/src/others/IR-Sensor/photon_firmware_1525906569609.bin deleted file mode 100644 index 6d4abf6..0000000 Binary files a/version2/src/others/IR-Sensor/photon_firmware_1525906569609.bin and /dev/null differ diff --git a/version2/src/others/RPi/raspberry-pi_firmware_1525886634407.bin b/version2/src/others/RPi/raspberry-pi_firmware_1525886634407.bin deleted file mode 100644 index 48e438a..0000000 Binary files a/version2/src/others/RPi/raspberry-pi_firmware_1525886634407.bin and /dev/null differ diff --git a/version2/src/others/Temp-Sensor/Makefile b/version2/src/others/Temp-Sensor/Makefile index 456a715..9da3c7e 100644 --- a/version2/src/others/Temp-Sensor/Makefile +++ b/version2/src/others/Temp-Sensor/Makefile @@ -12,12 +12,30 @@ monitor: compile: rm -f *.bin particle compile photon - -flash0: - particle flash IoT-0 photon*.bin -flash1: - particle flash IoT-1 photon*.bin +flash3: + particle flash IoT-3 photon*.bin + +flash4: + particle flash IoT-4 photon*.bin + +flash5: + particle flash IoT-5 photon*.bin + +flash6: + particle flash IoT-6 photon*.bin + +flash7: + particle flash IoT-7 photon*.bin + +flash11: + particle flash IoT-11 photon*.bin + +flash12: + particle flash IoT-12 photon*.bin + +flash13: + particle flash IoT-13 photon*.bin PHONY += clean clean: diff --git a/version2/src/others/Temp-Sensor/Temp-Sensor_Particle-Cloud.ino b/version2/src/others/Temp-Sensor/Temp-Sensor_Particle-Cloud.ino index 9674a47..665d732 100644 --- a/version2/src/others/Temp-Sensor/Temp-Sensor_Particle-Cloud.ino +++ b/version2/src/others/Temp-Sensor/Temp-Sensor_Particle-Cloud.ino @@ -1,9 +1,6 @@ #include "application.h" #include "DHT.h" -SYSTEM_MODE(SEMI_AUTOMATIC) -SYSTEM_THREAD(ENABLED) - // System defines // Arduino #define DHTPIN 2 // Data pin @@ -48,13 +45,6 @@ void setup() { digitalWrite(PWRPIN, HIGH); // Arduino DHT dht.begin(); - // Connect to WiFi and Particle cloud - // Wait for a maximum amount of time - sleep if WiFi is not connected - // Wake up and try again afterwards - // TODO: either use this or just WiFi connection (below) - Particle.connect(); - if (!waitFor(Particle.connected, RETRY_TIME)) - System.sleep(SLEEP_MODE_DEEP, RETRY_SLEEP_TIME); // Prepare device key from MAC (just last 2 of 6 digits) byte mac[6]; diff --git a/version2/src/others/Temp-Sensor/photon_firmware_1525907284118.bin b/version2/src/others/Temp-Sensor/photon_firmware_1525907284118.bin deleted file mode 100644 index 00de6d1..0000000 Binary files a/version2/src/others/Temp-Sensor/photon_firmware_1525907284118.bin and /dev/null differ diff --git a/version2/src/others/ino/IR-Sensor/IR-Sensor_Particle-Cloud.ino b/version2/src/others/ino/IR-Sensor/IR-Sensor_Particle-Cloud.ino index ac9f45f..c3be4ab 100644 --- a/version2/src/others/ino/IR-Sensor/IR-Sensor_Particle-Cloud.ino +++ b/version2/src/others/ino/IR-Sensor/IR-Sensor_Particle-Cloud.ino @@ -8,6 +8,9 @@ // // Based on tutorial: http://henrysbench.capnfatz.com/henrys-bench/arduino-sensors-and-input/arduino-hc-sr501-motion-sensor-tutorial/ +SYSTEM_MODE(SEMI_AUTOMATIC) +SYSTEM_THREAD(ENABLED) + int pirValue; // Place to store read PIR Value int64_t machineId; // Key and data