/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * REVISION HISTORY * WARNING: I use MySensors V1.6.0 (dev branch) (https://github.com/mysensors/Arduino/tree/development/libraries) * * Version 1.0 - Hubert Mickael (https://github.com/Mickaelh51) * - Clean ino code * - Add MY_DEBUG mode in library * Version 0.2 (Beta 2) - Hubert Mickael (https://github.com/Mickaelh51) * - Auto detect Oregon 433Mhz * - Add battery level * - etc ... * Version 0.1 (Beta 1) - Hubert Mickael (https://github.com/Mickaelh51) * ******************************* * DESCRIPTION * This sketch provides an example how to implement a humidity/temperature from Oregon sensor. * - Oregon sensor's battery level * - Oregon sensor's id * - Oregon sensor's type * - Oregon sensor's channel * - Oregon sensor's temperature * - Oregon sensor's humidity * * MySensors gateway <=======> Arduino UNO <-- (PIN 2) --> 433Mhz receiver <=============> Oregon sensors */ // Enable debug prints #define MY_DEBUG #define MY_NODE_ID 10 // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #include #include #include //Define pin where is 433Mhz receiver (here, pin 2) #define MHZ_RECEIVER_PIN 2 //Define maximum Oregon sensors (here, 3 differents sensors) #define COUNT_OREGON_SENSORS 3 #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 #define CHILD_ID_BAT 2 MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgBat(CHILD_ID_BAT, V_VAR1); void setup () { Serial.println("Setup started"); //Setup received data attachInterrupt(digitalPinToInterrupt(MHZ_RECEIVER_PIN), ext_int_1, CHANGE); Serial.println("Setup completed"); } void presentation() { // Send the Sketch Version Information to the Gateway sendSketchInfo("Oregon Sensor", "1.0"); // Present all sensors to controller for (int i=0; i