|
| 1 | +/** |
| 2 | +* The MySensors Arduino library handles the wireless radio link and protocol |
| 3 | +* between your home built sensors/actuators and HA controller of choice. |
| 4 | +* The sensors forms a self healing radio network with optional repeaters. Each |
| 5 | +* repeater and gateway builds a routing tables in EEPROM which keeps track of the |
| 6 | +* network topology allowing messages to be routed to nodes. |
| 7 | +* |
| 8 | +* Created by Henrik Ekblad <[email protected]> |
| 9 | +* Copyright (C) 2013-2019 Sensnology AB |
| 10 | +* Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors |
| 11 | +* |
| 12 | +* Documentation: http://www.mysensors.org |
| 13 | +* Support Forum: http://forum.mysensors.org |
| 14 | +* |
| 15 | +* This program is free software; you can redistribute it and/or |
| 16 | +* modify it under the terms of the GNU General Public License |
| 17 | +* version 2 as published by the Free Software Foundation. |
| 18 | +* |
| 19 | +******************************* |
| 20 | +* |
| 21 | +* DESCRIPTION |
| 22 | +* The ArduinoGateway prints data received from sensors on the serial link. |
| 23 | +* The gateway accepts input on serial which will be sent out on radio network. |
| 24 | +* |
| 25 | +* The GW code is designed for Arduino Nano 328p / 16MHz |
| 26 | +* |
| 27 | +* Wire connections (OPTIONAL): |
| 28 | +* - Inclusion button should be connected between digital pin 3 and GND |
| 29 | +* - RX/TX/ERR leds need to be connected between +5V (anode) and digital pin 6/5/4 with resistor 270-330R in a series |
| 30 | +* |
| 31 | +* LEDs (OPTIONAL): |
| 32 | +* - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs |
| 33 | +* - RX (green) - blink fast on radio message received. In inclusion mode will blink fast only on presentation received |
| 34 | +* - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly |
| 35 | +* - ERR (red) - fast blink on error during transmission error or receive crc error |
| 36 | +* |
| 37 | +*/ |
| 38 | + |
| 39 | +// Enable debug prints to serial monitor |
| 40 | +#define MY_DEBUG |
| 41 | +//#define MY_DEBUG_VERBOSE_CAN |
| 42 | + |
| 43 | + |
| 44 | +// Enable and select radio type attached |
| 45 | +#define MY_CAN |
| 46 | +//#define MY_RADIO_NRF5_ESB |
| 47 | +//#define MY_RADIO_RFM69 |
| 48 | +//#define MY_RADIO_RFM95 |
| 49 | + |
| 50 | +// Set LOW transmit power level as default, if you have an amplified NRF-module and |
| 51 | +// power your radio separately with a good regulator you can turn up PA level. |
| 52 | +//#define MY_RF24_PA_LEVEL RF24_PA_LOW/ |
| 53 | + |
| 54 | +// Enable serial gateway |
| 55 | +#define MY_GATEWAY_SERIAL |
| 56 | + |
| 57 | +// Define a lower baud rate for Arduinos running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender) |
| 58 | +//#if F_CPU == 8000000L/ |
| 59 | +//#define MY_BAUD_RATE 38400/ |
| 60 | +//#endif/ |
| 61 | + |
| 62 | +// Enable inclusion mode |
| 63 | +#define MY_INCLUSION_MODE_FEATURE |
| 64 | +// Enable Inclusion mode button on gateway |
| 65 | +//#define MY_INCLUSION_BUTTON_FEATURE |
| 66 | + |
| 67 | +// Inverses behavior of inclusion button (if using external pullup) |
| 68 | +//#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP |
| 69 | + |
| 70 | +// Set inclusion mode duration (in seconds) |
| 71 | +//#define MY_INCLUSION_MODE_DURATION 60 |
| 72 | +// Digital pin used for inclusion mode button |
| 73 | +//#define MY_INCLUSION_MODE_BUTTON_PIN 3 |
| 74 | + |
| 75 | +// Set blinking period |
| 76 | +//#define MY_DEFAULT_LED_BLINK_PERIOD 300 |
| 77 | + |
| 78 | +// Inverses the behavior of leds |
| 79 | +//#define MY_WITH_LEDS_BLINKING_INVERSE |
| 80 | + |
| 81 | +// Flash leds on rx/tx/err |
| 82 | +// Uncomment to override default HW configurations |
| 83 | +//#define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin |
| 84 | +//#define MY_DEFAULT_RX_LED_PIN 6 // Receive led pin |
| 85 | +//#define MY_DEFAULT_TX_LED_PIN 5 // the PCB, on board LED |
| 86 | + |
| 87 | +#include <MySensors.h> |
| 88 | + |
| 89 | +void setup() |
| 90 | +{ |
| 91 | + // Setup locally attached sensors |
| 92 | +} |
| 93 | + |
| 94 | +void presentation() |
| 95 | +{ |
| 96 | + // Present locally attached sensors |
| 97 | +} |
| 98 | + |
| 99 | +void loop() |
| 100 | +{ |
| 101 | + // Send locally attached sensor data here |
| 102 | +} |
0 commit comments