Fixes LED issues as discussed in #562
Removing MY_LED_BLINKING_FEATURE, as we now are using MY_DEFAULT_LED_xx_PIN defines to enable LED blinking feature. updated Gateway sketches to not refer to MY_LED_BLINKING_FEATURE any more fixes #562
This commit is contained in:
@@ -20,34 +20,34 @@
|
||||
*
|
||||
* REVISION HISTORY
|
||||
* Version 1.0 - Henrik EKblad
|
||||
* Contribution by a-lurker and Anticimex,
|
||||
* Contribution by a-lurker and Anticimex,
|
||||
* Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
|
||||
* Contribution by Ivo Pullens (ESP8266 support)
|
||||
*
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The EthernetGateway sends data received from sensors to the WiFi link.
|
||||
* The EthernetGateway sends data received from sensors to the WiFi link.
|
||||
* The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
|
||||
*
|
||||
* VERA CONFIGURATION:
|
||||
* Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin.
|
||||
* Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin.
|
||||
* E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003
|
||||
*
|
||||
* LED purposes:
|
||||
* - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
|
||||
* - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs in your sketch, only the LEDs that is defined is used.
|
||||
* - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
|
||||
* - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
|
||||
* - ERR (red) - fast blink on error during transmission error or recieve crc error
|
||||
*
|
||||
* - ERR (red) - fast blink on error during transmission error or recieve crc error
|
||||
*
|
||||
* See http://www.mysensors.org/build/esp8266_gateway for wiring instructions.
|
||||
* nRF24L01+ ESP8266
|
||||
* VCC VCC
|
||||
* CE GPIO4
|
||||
* CE GPIO4
|
||||
* CSN/CS GPIO15
|
||||
* SCK GPIO14
|
||||
* MISO GPIO12
|
||||
* MOSI GPIO13
|
||||
* GND GND
|
||||
*
|
||||
*
|
||||
* Not all ESP8266 modules have all pins available on their external interface.
|
||||
* This code has been tested on an ESP-12 module.
|
||||
* The ESP8266 requires a certain pin configuration to download code, and another one to run code:
|
||||
@@ -56,10 +56,10 @@
|
||||
* - Connect CH_PD via 10K resistor to VCC
|
||||
* - Connect GPIO2 via 10K resistor to VCC
|
||||
* - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch')
|
||||
*
|
||||
*
|
||||
* Inclusion mode button:
|
||||
* - Connect GPIO5 via switch to GND ('inclusion switch')
|
||||
*
|
||||
*
|
||||
* Hardware SHA204 signing is currently not supported!
|
||||
*
|
||||
* Make sure to fill in your ssid and WiFi password below for ssid & pass.
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
|
||||
// Enable debug prints to serial monitor
|
||||
#define MY_DEBUG
|
||||
#define MY_DEBUG
|
||||
|
||||
// Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
|
||||
#define MY_BAUD_RATE 9600
|
||||
@@ -95,14 +95,14 @@
|
||||
#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
|
||||
#define MY_IP_SUBNET_ADDRESS 255,255,255,0
|
||||
|
||||
// The port to keep open on node server mode
|
||||
#define MY_PORT 5003
|
||||
// The port to keep open on node server mode
|
||||
#define MY_PORT 5003
|
||||
|
||||
// How many clients should be able to connect to this gateway (default 1)
|
||||
#define MY_GATEWAY_MAX_CLIENTS 2
|
||||
|
||||
// Controller ip address. Enables client mode (default is "server" mode).
|
||||
// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
|
||||
// Controller ip address. Enables client mode (default is "server" mode).
|
||||
// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
|
||||
//#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68
|
||||
|
||||
// Enable inclusion mode
|
||||
@@ -111,16 +111,15 @@
|
||||
// Enable Inclusion mode button on gateway
|
||||
// #define MY_INCLUSION_BUTTON_FEATURE
|
||||
// Set inclusion mode duration (in seconds)
|
||||
#define MY_INCLUSION_MODE_DURATION 60
|
||||
#define MY_INCLUSION_MODE_DURATION 60
|
||||
// Digital pin used for inclusion mode button
|
||||
#define MY_INCLUSION_MODE_BUTTON_PIN 3
|
||||
#define MY_INCLUSION_MODE_BUTTON_PIN 3
|
||||
|
||||
|
||||
|
||||
// Flash leds on rx/tx/err
|
||||
// #define MY_LEDS_BLINKING_FEATURE
|
||||
// Set blinking period
|
||||
// #define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
|
||||
// Flash leds on rx/tx/err
|
||||
// Led pins used if blinking feature is enabled above
|
||||
#define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin
|
||||
#define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin
|
||||
@@ -134,17 +133,14 @@
|
||||
|
||||
#include <MySensors.h>
|
||||
|
||||
void setup() {
|
||||
void setup() {
|
||||
}
|
||||
|
||||
void presentation() {
|
||||
// Present locally attached sensors here
|
||||
// Present locally attached sensors here
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
// Send locally attached sensors data here
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,26 +20,26 @@
|
||||
*
|
||||
* REVISION HISTORY
|
||||
* Version 1.0 - Henrik Ekblad
|
||||
*
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The ESP8266 MQTT gateway sends radio network (or locally attached sensors) data to your MQTT broker.
|
||||
* The node also listens to MY_MQTT_TOPIC_PREFIX and sends out those messages to the radio network
|
||||
*
|
||||
* LED purposes:
|
||||
* - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
|
||||
* - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs in your sketch
|
||||
* - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
|
||||
* - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
|
||||
* - ERR (red) - fast blink on error during transmission error or recieve crc error
|
||||
*
|
||||
* - ERR (red) - fast blink on error during transmission error or recieve crc error
|
||||
*
|
||||
* See http://www.mysensors.org/build/esp8266_gateway for wiring instructions.
|
||||
* nRF24L01+ ESP8266
|
||||
* VCC VCC
|
||||
* CE GPIO4
|
||||
* CE GPIO4
|
||||
* CSN/CS GPIO15
|
||||
* SCK GPIO14
|
||||
* MISO GPIO12
|
||||
* MOSI GPIO13
|
||||
*
|
||||
*
|
||||
* Not all ESP8266 modules have all pins available on their external interface.
|
||||
* This code has been tested on an ESP-12 module.
|
||||
* The ESP8266 requires a certain pin configuration to download code, and another one to run code:
|
||||
@@ -48,10 +48,10 @@
|
||||
* - Connect CH_PD via 10K resistor to VCC
|
||||
* - Connect GPIO2 via 10K resistor to VCC
|
||||
* - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch')
|
||||
*
|
||||
*
|
||||
* Inclusion mode button:
|
||||
* - Connect GPIO5 via switch to GND ('inclusion switch')
|
||||
*
|
||||
*
|
||||
* Hardware SHA204 signing is currently not supported!
|
||||
*
|
||||
* Make sure to fill in your ssid and WiFi password below for ssid & pass.
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
|
||||
// Enable debug prints to serial monitor
|
||||
#define MY_DEBUG
|
||||
#define MY_DEBUG
|
||||
|
||||
// Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
|
||||
#define MY_BAUD_RATE 9600
|
||||
@@ -87,7 +87,7 @@
|
||||
#define MY_ESP8266_PASSWORD "MyVerySecretPassword"
|
||||
|
||||
// Set the hostname for the WiFi Client. This is the hostname
|
||||
// it will pass to the DHCP server if not static.
|
||||
// it will pass to the DHCP server if not static.
|
||||
// #define MY_ESP8266_HOSTNAME "mqtt-sensor-gateway"
|
||||
|
||||
// Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
|
||||
@@ -98,27 +98,26 @@
|
||||
#define MY_IP_SUBNET_ADDRESS 255,255,255,0
|
||||
|
||||
|
||||
// MQTT broker ip address.
|
||||
// MQTT broker ip address.
|
||||
#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68
|
||||
|
||||
// The MQTT broker port to to open
|
||||
#define MY_PORT 1883
|
||||
// The MQTT broker port to to open
|
||||
#define MY_PORT 1883
|
||||
|
||||
/*
|
||||
// Flash leds on rx/tx/err
|
||||
#define MY_LEDS_BLINKING_FEATURE
|
||||
// Set blinking period
|
||||
#define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
|
||||
// Enable inclusion mode
|
||||
#define MY_INCLUSION_MODE_FEATURE
|
||||
// Enable Inclusion mode button on gateway
|
||||
#define MY_INCLUSION_BUTTON_FEATURE
|
||||
// Set inclusion mode duration (in seconds)
|
||||
#define MY_INCLUSION_MODE_DURATION 60
|
||||
#define MY_INCLUSION_MODE_DURATION 60
|
||||
// Digital pin used for inclusion mode button
|
||||
#define MY_INCLUSION_MODE_BUTTON_PIN 3
|
||||
#define MY_INCLUSION_MODE_BUTTON_PIN 3
|
||||
|
||||
// Set blinking period
|
||||
#define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
|
||||
// Flash leds on rx/tx/err
|
||||
#define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin
|
||||
#define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin
|
||||
#define MY_DEFAULT_TX_LED_PIN 16 // the PCB, on board LED
|
||||
@@ -127,17 +126,14 @@
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <MySensors.h>
|
||||
|
||||
void setup() {
|
||||
void setup() {
|
||||
}
|
||||
|
||||
void presentation() {
|
||||
// Present locally attached sensors here
|
||||
// Present locally attached sensors here
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
// Send locally attech sensors data here
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -21,34 +21,34 @@
|
||||
* REVISION HISTORY
|
||||
* Version 1.0 - Henrik EKblad
|
||||
* Contribution by tekka,
|
||||
* Contribution by a-lurker and Anticimex,
|
||||
* Contribution by a-lurker and Anticimex,
|
||||
* Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
|
||||
* Contribution by Ivo Pullens (ESP8266 support)
|
||||
*
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The EthernetGateway sends data received from sensors to the WiFi link.
|
||||
* The EthernetGateway sends data received from sensors to the WiFi link.
|
||||
* The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
|
||||
*
|
||||
* VERA CONFIGURATION:
|
||||
* Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin.
|
||||
* Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin.
|
||||
* E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003
|
||||
*
|
||||
* LED purposes:
|
||||
* - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
|
||||
* - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
|
||||
* - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
|
||||
* - ERR (red) - fast blink on error during transmission error or recieve crc error
|
||||
*
|
||||
* - ERR (red) - fast blink on error during transmission error or recieve crc error
|
||||
*
|
||||
* See http://www.mysensors.org/build/esp8266_gateway for wiring instructions.
|
||||
* nRF24L01+ ESP8266
|
||||
* VCC VCC
|
||||
* CE GPIO4
|
||||
* CE GPIO4
|
||||
* CSN/CS GPIO15
|
||||
* SCK GPIO14
|
||||
* MISO GPIO12
|
||||
* MOSI GPIO13
|
||||
* GND GND
|
||||
*
|
||||
*
|
||||
* Not all ESP8266 modules have all pins available on their external interface.
|
||||
* This code has been tested on an ESP-12 module.
|
||||
* The ESP8266 requires a certain pin configuration to download code, and another one to run code:
|
||||
@@ -57,10 +57,10 @@
|
||||
* - Connect CH_PD via 10K resistor to VCC
|
||||
* - Connect GPIO2 via 10K resistor to VCC
|
||||
* - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch')
|
||||
*
|
||||
*
|
||||
* Inclusion mode button:
|
||||
* - Connect GPIO5 via switch to GND ('inclusion switch')
|
||||
*
|
||||
*
|
||||
* Hardware SHA204 signing is currently not supported!
|
||||
*
|
||||
* Make sure to fill in your ssid and WiFi password below for ssid & pass.
|
||||
@@ -69,7 +69,7 @@
|
||||
#include <ArduinoOTA.h>
|
||||
|
||||
// Enable debug prints to serial monitor
|
||||
#define MY_DEBUG
|
||||
#define MY_DEBUG
|
||||
|
||||
// Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
|
||||
#define MY_BAUD_RATE 9600
|
||||
@@ -97,14 +97,14 @@
|
||||
#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
|
||||
#define MY_IP_SUBNET_ADDRESS 255,255,255,0
|
||||
|
||||
// The port to keep open on node server mode
|
||||
#define MY_PORT 5003
|
||||
// The port to keep open on node server mode
|
||||
#define MY_PORT 5003
|
||||
|
||||
// How many clients should be able to connect to this gateway (default 1)
|
||||
#define MY_GATEWAY_MAX_CLIENTS 2
|
||||
|
||||
// Controller ip address. Enables client mode (default is "server" mode).
|
||||
// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
|
||||
// Controller ip address. Enables client mode (default is "server" mode).
|
||||
// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
|
||||
//#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68
|
||||
|
||||
// Enable inclusion mode
|
||||
@@ -113,16 +113,15 @@
|
||||
// Enable Inclusion mode button on gateway
|
||||
// #define MY_INCLUSION_BUTTON_FEATURE
|
||||
// Set inclusion mode duration (in seconds)
|
||||
#define MY_INCLUSION_MODE_DURATION 60
|
||||
#define MY_INCLUSION_MODE_DURATION 60
|
||||
// Digital pin used for inclusion mode button
|
||||
#define MY_INCLUSION_MODE_BUTTON_PIN 3
|
||||
#define MY_INCLUSION_MODE_BUTTON_PIN 3
|
||||
|
||||
|
||||
|
||||
// Flash leds on rx/tx/err
|
||||
// #define MY_LEDS_BLINKING_FEATURE
|
||||
// Set blinking period
|
||||
// #define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
|
||||
// Flash leds on rx/tx/err
|
||||
// Led pins used if blinking feature is enabled above
|
||||
#define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin
|
||||
#define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin
|
||||
@@ -136,8 +135,8 @@
|
||||
|
||||
#include <MySensors.h>
|
||||
|
||||
void setup() {
|
||||
|
||||
void setup() {
|
||||
|
||||
ArduinoOTA.onStart([]() {
|
||||
Serial.println("ArduinoOTA start");
|
||||
});
|
||||
@@ -163,7 +162,7 @@ void setup() {
|
||||
}
|
||||
|
||||
void presentation() {
|
||||
// Present locally attached sensors here
|
||||
// Present locally attached sensors here
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +170,3 @@ void loop() {
|
||||
// Send locally attech sensors data here
|
||||
ArduinoOTA.handle();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,25 +19,25 @@
|
||||
*******************************
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The ArduinoGateway prints data received from sensors on the serial link.
|
||||
* The ArduinoGateway prints data received from sensors on the serial link.
|
||||
* The gateway accepts input on seral which will be sent out on radio network.
|
||||
*
|
||||
* The GW code is designed for Arduino Nano 328p / 16MHz
|
||||
*
|
||||
* Wire connections (OPTIONAL):
|
||||
* - Inclusion button should be connected between digital pin 3 and GND
|
||||
* - Inclusion button should be connected between digital pin 3 and GND
|
||||
* - RX/TX/ERR leds need to be connected between +5V (anode) and digital pin 6/5/4 with resistor 270-330R in a series
|
||||
*
|
||||
* LEDs (OPTIONAL):
|
||||
* - To use the feature, uncomment MY_LEDS_BLINKING_FEATURE in MyConfig.h
|
||||
* - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs
|
||||
* - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
|
||||
* - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
|
||||
* - ERR (red) - fast blink on error during transmission error or recieve crc error
|
||||
*
|
||||
* - ERR (red) - fast blink on error during transmission error or recieve crc error
|
||||
*
|
||||
*/
|
||||
|
||||
// Enable debug prints to serial monitor
|
||||
#define MY_DEBUG
|
||||
#define MY_DEBUG
|
||||
|
||||
|
||||
// Enable and select radio type attached
|
||||
@@ -45,7 +45,7 @@
|
||||
//#define MY_RADIO_RFM69
|
||||
|
||||
// Set LOW transmit power level as default, if you have an amplified NRF-module and
|
||||
// power your radio separately with a good regulator you can turn up PA level.
|
||||
// power your radio separately with a good regulator you can turn up PA level.
|
||||
#define MY_RF24_PA_LEVEL RF24_PA_LOW
|
||||
|
||||
// Enable serial gateway
|
||||
@@ -56,14 +56,6 @@
|
||||
#define MY_BAUD_RATE 38400
|
||||
#endif
|
||||
|
||||
// Flash leds on rx/tx/err
|
||||
#define MY_LEDS_BLINKING_FEATURE
|
||||
// Set blinking period
|
||||
#define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
|
||||
// Inverses the behavior of leds
|
||||
//#define MY_WITH_LEDS_BLINKING_INVERSE
|
||||
|
||||
// Enable inclusion mode
|
||||
#define MY_INCLUSION_MODE_FEATURE
|
||||
// Enable Inclusion mode button on gateway
|
||||
@@ -73,30 +65,32 @@
|
||||
//#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
|
||||
|
||||
// Set inclusion mode duration (in seconds)
|
||||
#define MY_INCLUSION_MODE_DURATION 60
|
||||
#define MY_INCLUSION_MODE_DURATION 60
|
||||
// Digital pin used for inclusion mode button
|
||||
//#define MY_INCLUSION_MODE_BUTTON_PIN 3
|
||||
//#define MY_INCLUSION_MODE_BUTTON_PIN 3
|
||||
|
||||
// Set blinking period
|
||||
#define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
|
||||
// Inverses the behavior of leds
|
||||
//#define MY_WITH_LEDS_BLINKING_INVERSE
|
||||
|
||||
// Flash leds on rx/tx/err
|
||||
// Uncomment to override default HW configurations
|
||||
//#define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin
|
||||
//#define MY_DEFAULT_RX_LED_PIN 6 // Receive led pin
|
||||
//#define MY_DEFAULT_TX_LED_PIN 5 // the PCB, on board LED
|
||||
|
||||
#include <MySensors.h>
|
||||
#include <MySensors.h>
|
||||
|
||||
void setup() {
|
||||
void setup() {
|
||||
// Setup locally attached sensors
|
||||
}
|
||||
|
||||
void presentation() {
|
||||
// Present locally attached sensors
|
||||
// Present locally attached sensors
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// Send locally attached sensor data here
|
||||
void loop() {
|
||||
// Send locally attached sensor data here
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,23 +19,22 @@
|
||||
*******************************
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The RS485 Gateway prints data received from sensors on the serial link.
|
||||
* The RS485 Gateway prints data received from sensors on the serial link.
|
||||
* The gateway accepts input on seral which will be sent out on
|
||||
* the RS485 link.
|
||||
*
|
||||
* Wire connections (OPTIONAL):
|
||||
* - Inclusion button should be connected between digital pin 3 and GND
|
||||
* - Inclusion button should be connected between digital pin 3 and GND
|
||||
* - RX/TX/ERR leds need to be connected between +5V (anode) and digital pin 6/5/4 with resistor 270-330R in a series
|
||||
*
|
||||
* LEDs (OPTIONAL):
|
||||
* - To use the feature, uncomment MY_LEDS_BLINKING_FEATURE in MyConfig.h
|
||||
* - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
|
||||
* - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
|
||||
* - ERR (red) - fast blink on error during transmission error or recieve crc error
|
||||
*
|
||||
* The gateway uses AltSoftSerial to handle two serial links
|
||||
* - ERR (red) - fast blink on error during transmission error or recieve crc error
|
||||
*
|
||||
* The gateway uses AltSoftSerial to handle two serial links
|
||||
* on one Arduino. Use the following pins for RS485 link
|
||||
*
|
||||
*
|
||||
* Board Transmit Receive PWM Unusable
|
||||
* ----- -------- ------- ------------
|
||||
* Teensy 3.0 & 3.1 21 20 22
|
||||
@@ -46,16 +45,16 @@
|
||||
* Arduino Mega 46 48 44, 45
|
||||
* Wiring-S 5 6 4
|
||||
* Sanguino 13 14 12
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
// Enable debug prints to serial monitor
|
||||
#define MY_DEBUG
|
||||
#define MY_DEBUG
|
||||
|
||||
// Enable RS485 transport layer
|
||||
#define MY_RS485
|
||||
|
||||
// Define this to enables DE-pin management on defined pin
|
||||
// Define this to enables DE-pin management on defined pin
|
||||
#define MY_RS485_DE_PIN 2
|
||||
|
||||
// Set RS485 baud rate to use
|
||||
@@ -64,39 +63,34 @@
|
||||
// Enable serial gateway
|
||||
#define MY_GATEWAY_SERIAL
|
||||
|
||||
// Flash leds on rx/tx/err
|
||||
#define MY_LEDS_BLINKING_FEATURE
|
||||
// Set blinking period
|
||||
#define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
|
||||
// Enable inclusion mode
|
||||
#define MY_INCLUSION_MODE_FEATURE
|
||||
// Enable Inclusion mode button on gateway
|
||||
#define MY_INCLUSION_BUTTON_FEATURE
|
||||
// Set inclusion mode duration (in seconds)
|
||||
#define MY_INCLUSION_MODE_DURATION 60
|
||||
#define MY_INCLUSION_MODE_DURATION 60
|
||||
// Digital pin used for inclusion mode button
|
||||
#define MY_INCLUSION_MODE_BUTTON_PIN 3
|
||||
#define MY_INCLUSION_MODE_BUTTON_PIN 3
|
||||
|
||||
// Set blinking period
|
||||
#define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
|
||||
// Flash leds on rx/tx/err
|
||||
#define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin
|
||||
#define MY_DEFAULT_RX_LED_PIN 5 // Receive led pin
|
||||
#define MY_DEFAULT_TX_LED_PIN 6 // the PCB, on board LED
|
||||
|
||||
#include <MySensors.h>
|
||||
#include <MySensors.h>
|
||||
|
||||
void setup() {
|
||||
void setup() {
|
||||
// Setup locally attached sensors
|
||||
}
|
||||
|
||||
void presentation() {
|
||||
// Present locally attached sensors
|
||||
// Present locally attached sensors
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// Send locally attached sensor data here
|
||||
void loop() {
|
||||
// Send locally attached sensor data here
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -42,68 +42,67 @@
|
||||
*/
|
||||
|
||||
// Enable debug prints to serial monitor
|
||||
#define MY_DEBUG
|
||||
#define MY_DEBUG
|
||||
|
||||
// Enable and select radio type attached
|
||||
#define MY_RADIO_NRF24
|
||||
//#define MY_RADIO_RFM69
|
||||
|
||||
// Enable gateway ethernet module type
|
||||
// Enable gateway ethernet module type
|
||||
#define MY_GATEWAY_W5100
|
||||
|
||||
// W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
|
||||
//#define MY_W5100_SPI_EN 4
|
||||
//#define MY_W5100_SPI_EN 4
|
||||
|
||||
// Enable Soft SPI for NRF radio (note different radio wiring is required)
|
||||
// The W5100 ethernet module seems to have a hard time co-operate with
|
||||
// The W5100 ethernet module seems to have a hard time co-operate with
|
||||
// radio on the same spi bus.
|
||||
#if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
|
||||
#define MY_SOFTSPI
|
||||
#define MY_SOFT_SPI_SCK_PIN 14
|
||||
#define MY_SOFT_SPI_MISO_PIN 16
|
||||
#define MY_SOFT_SPI_MOSI_PIN 15
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// When W5100 is connected we have to move CE/CSN pins for NRF radio
|
||||
#ifndef MY_RF24_CE_PIN
|
||||
#ifndef MY_RF24_CE_PIN
|
||||
#define MY_RF24_CE_PIN 5
|
||||
#endif
|
||||
#ifndef MY_RF24_CS_PIN
|
||||
#ifndef MY_RF24_CS_PIN
|
||||
#define MY_RF24_CS_PIN 6
|
||||
#endif
|
||||
|
||||
// Enable to UDP
|
||||
// Enable to UDP
|
||||
//#define MY_USE_UDP
|
||||
|
||||
#define MY_IP_ADDRESS 192,168,178,66 // If this is disabled, DHCP is used to retrieve address
|
||||
// Renewal period if using DHCP
|
||||
//#define MY_IP_RENEWAL_INTERVAL 60000
|
||||
// The port to keep open on node server mode / or port to contact in client mode
|
||||
#define MY_PORT 5003
|
||||
#define MY_PORT 5003
|
||||
|
||||
// Controller ip address. Enables client mode (default is "server" mode).
|
||||
// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
|
||||
//#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254
|
||||
|
||||
// Controller ip address. Enables client mode (default is "server" mode).
|
||||
// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
|
||||
//#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254
|
||||
|
||||
// The MAC address can be anything you want but should be unique on your network.
|
||||
// Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
|
||||
// Note that most of the Ardunio examples use "DEAD BEEF FEED" for the MAC address.
|
||||
#define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
||||
|
||||
// Flash leds on rx/tx/err
|
||||
#define MY_LEDS_BLINKING_FEATURE
|
||||
// Set blinking period
|
||||
#define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
|
||||
// Enable inclusion mode
|
||||
#define MY_INCLUSION_MODE_FEATURE
|
||||
// Enable Inclusion mode button on gateway
|
||||
//#define MY_INCLUSION_BUTTON_FEATURE
|
||||
// Set inclusion mode duration (in seconds)
|
||||
#define MY_INCLUSION_MODE_DURATION 60
|
||||
#define MY_INCLUSION_MODE_DURATION 60
|
||||
// Digital pin used for inclusion mode button
|
||||
//#define MY_INCLUSION_MODE_BUTTON_PIN 3
|
||||
//#define MY_INCLUSION_MODE_BUTTON_PIN 3
|
||||
|
||||
// Set blinking period
|
||||
#define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
|
||||
// Flash leds on rx/tx/err
|
||||
// Uncomment to override default HW configurations
|
||||
//#define MY_DEFAULT_ERR_LED_PIN 7 // Error led pin
|
||||
//#define MY_DEFAULT_RX_LED_PIN 8 // Receive led pin
|
||||
@@ -123,4 +122,3 @@ void setup()
|
||||
|
||||
void loop() {
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*
|
||||
* REVISION HISTORY
|
||||
* Version 1.0 - Henrik Ekblad
|
||||
*
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The W5100 MQTT gateway sends radio network (or locally attached sensors) data to your MQTT broker.
|
||||
* The node also listens to MY_MQTT_TOPIC_PREFIX and sends out those messages to the radio network
|
||||
@@ -29,17 +29,17 @@
|
||||
* - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
|
||||
* - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
|
||||
* - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
|
||||
* - ERR (red) - fast blink on error during transmission error or recieve crc error
|
||||
*
|
||||
* - ERR (red) - fast blink on error during transmission error or recieve crc error
|
||||
*
|
||||
* See http://www.mysensors.org/build/esp8266_gateway for wiring instructions.
|
||||
* nRF24L01+ ESP8266
|
||||
* VCC VCC
|
||||
* CE GPIO4
|
||||
* CE GPIO4
|
||||
* CSN/CS GPIO15
|
||||
* SCK GPIO14
|
||||
* MISO GPIO12
|
||||
* MOSI GPIO13
|
||||
*
|
||||
*
|
||||
* Not all ESP8266 modules have all pins available on their external interface.
|
||||
* This code has been tested on an ESP-12 module.
|
||||
* The ESP8266 requires a certain pin configuration to download code, and another one to run code:
|
||||
@@ -48,10 +48,10 @@
|
||||
* - Connect CH_PD via 10K resistor to VCC
|
||||
* - Connect GPIO2 via 10K resistor to VCC
|
||||
* - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch')
|
||||
*
|
||||
*
|
||||
* Inclusion mode button:
|
||||
* - Connect GPIO5 via switch to GND ('inclusion switch')
|
||||
*
|
||||
*
|
||||
* Hardware SHA204 signing is currently not supported!
|
||||
*
|
||||
* Make sure to fill in your ssid and WiFi password below for ssid & pass.
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
|
||||
// Enable debug prints to serial monitor
|
||||
#define MY_DEBUG
|
||||
#define MY_DEBUG
|
||||
|
||||
// Enables and select radio type (if attached)
|
||||
#define MY_RADIO_NRF24
|
||||
@@ -75,23 +75,23 @@
|
||||
#define MY_MQTT_CLIENT_ID "mysensors-1"
|
||||
|
||||
// W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
|
||||
//#define MY_W5100_SPI_EN 4
|
||||
//#define MY_W5100_SPI_EN 4
|
||||
|
||||
// Enable Soft SPI for NRF radio (note different radio wiring is required)
|
||||
// The W5100 ethernet module seems to have a hard time co-operate with
|
||||
// The W5100 ethernet module seems to have a hard time co-operate with
|
||||
// radio on the same spi bus.
|
||||
#if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
|
||||
#define MY_SOFTSPI
|
||||
#define MY_SOFT_SPI_SCK_PIN 14
|
||||
#define MY_SOFT_SPI_MISO_PIN 16
|
||||
#define MY_SOFT_SPI_MOSI_PIN 15
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// When W5100 is connected we have to move CE/CSN pins for NRF radio
|
||||
#ifndef MY_RF24_CE_PIN
|
||||
#ifndef MY_RF24_CE_PIN
|
||||
#define MY_RF24_CE_PIN 5
|
||||
#endif
|
||||
#ifndef MY_RF24_CS_PIN
|
||||
#ifndef MY_RF24_CS_PIN
|
||||
#define MY_RF24_CS_PIN 6
|
||||
#endif
|
||||
|
||||
@@ -106,28 +106,27 @@
|
||||
#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
|
||||
#define MY_IP_SUBNET_ADDRESS 255,255,255,0
|
||||
|
||||
// MQTT broker ip address or url. Define one or the other.
|
||||
// MQTT broker ip address or url. Define one or the other.
|
||||
//#define MY_CONTROLLER_URL_ADDRESS "m20.cloudmqtt.com"
|
||||
#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68
|
||||
|
||||
// The MQTT broker port to to open
|
||||
#define MY_PORT 1883
|
||||
// The MQTT broker port to to open
|
||||
#define MY_PORT 1883
|
||||
|
||||
/*
|
||||
// Flash leds on rx/tx/err
|
||||
#define MY_LEDS_BLINKING_FEATURE
|
||||
// Set blinking period
|
||||
#define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
|
||||
// Enable inclusion mode
|
||||
#define MY_INCLUSION_MODE_FEATURE
|
||||
// Enable Inclusion mode button on gateway
|
||||
//#define MY_INCLUSION_BUTTON_FEATURE
|
||||
// Set inclusion mode duration (in seconds)
|
||||
#define MY_INCLUSION_MODE_DURATION 60
|
||||
#define MY_INCLUSION_MODE_DURATION 60
|
||||
// Digital pin used for inclusion mode button
|
||||
//#define MY_INCLUSION_MODE_BUTTON_PIN 3
|
||||
//#define MY_INCLUSION_MODE_BUTTON_PIN 3
|
||||
|
||||
// Set blinking period
|
||||
#define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
|
||||
// Flash leds on rx/tx/err
|
||||
// Uncomment to override default HW configurations
|
||||
//#define MY_DEFAULT_ERR_LED_PIN 16 // Error led pin
|
||||
//#define MY_DEFAULT_RX_LED_PIN 16 // Receive led pin
|
||||
@@ -137,17 +136,14 @@
|
||||
#include <Ethernet.h>
|
||||
#include <MySensors.h>
|
||||
|
||||
void setup() {
|
||||
void setup() {
|
||||
}
|
||||
|
||||
void presentation() {
|
||||
// Present locally attached sensors here
|
||||
// Present locally attached sensors here
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
// Send locally attached sensors data here
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,33 +19,33 @@
|
||||
*******************************
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The ArduinoGateway prints data received from sensors on the serial link.
|
||||
* The ArduinoGateway prints data received from sensors on the serial link.
|
||||
* The gateway accepts input on seral which will be sent out on radio network.
|
||||
*
|
||||
* This GW code is designed for Sensebender GateWay / Arduino Zero
|
||||
*
|
||||
* Wire connections (OPTIONAL):
|
||||
* - Inclusion button should be connected between digital pin 3 and GND
|
||||
* - Inclusion button should be connected between digital pin 3 and GND
|
||||
* - RX/TX/ERR leds need to be connected between +5V (anode) and digital pin 6/5/4 with resistor 270-330R in a series
|
||||
*
|
||||
* LEDs (OPTIONAL):
|
||||
* - To use the feature, uncomment MY_LEDS_BLINKING_FEATURE in MyConfig.h
|
||||
* - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs
|
||||
* - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
|
||||
* - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
|
||||
* - ERR (red) - fast blink on error during transmission error or recieve crc error
|
||||
*
|
||||
* - ERR (red) - fast blink on error during transmission error or recieve crc error
|
||||
*
|
||||
*/
|
||||
|
||||
#define SKETCH_VERSION "0.1"
|
||||
// Enable debug prints to serial monitor
|
||||
#define MY_DEBUG
|
||||
#define MY_DEBUG
|
||||
|
||||
// Enable and select radio type attached
|
||||
#define MY_RADIO_NRF24
|
||||
//#define MY_RADIO_RFM69
|
||||
|
||||
// Set LOW transmit power level as default, if you have an amplified NRF-module and
|
||||
// power your radio separately with a good regulator you can turn up PA level.
|
||||
// power your radio separately with a good regulator you can turn up PA level.
|
||||
#define MY_RF24_PA_LEVEL RF24_PA_HIGH
|
||||
|
||||
// Enable serial gateway
|
||||
@@ -56,14 +56,6 @@
|
||||
#define MY_BAUD_RATE 38400
|
||||
#endif
|
||||
|
||||
// Flash leds on rx/tx/err
|
||||
#define MY_LEDS_BLINKING_FEATURE
|
||||
// Set blinking period
|
||||
#define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
|
||||
// Inverses the behavior of leds
|
||||
//#define MY_WITH_LEDS_BLINKING_INVERSE
|
||||
|
||||
// Enable inclusion mode
|
||||
#define MY_INCLUSION_MODE_FEATURE
|
||||
// Enable Inclusion mode button on gateway
|
||||
@@ -73,10 +65,17 @@
|
||||
//#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
|
||||
|
||||
// Set inclusion mode duration (in seconds)
|
||||
#define MY_INCLUSION_MODE_DURATION 60
|
||||
#define MY_INCLUSION_MODE_DURATION 60
|
||||
// Digital pin used for inclusion mode button
|
||||
//#define MY_INCLUSION_MODE_BUTTON_PIN 3
|
||||
//#define MY_INCLUSION_MODE_BUTTON_PIN 3
|
||||
|
||||
// Set blinking period
|
||||
#define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
|
||||
// Inverses the behavior of leds
|
||||
//#define MY_WITH_LEDS_BLINKING_INVERSE
|
||||
|
||||
// Flash leds on rx/tx/err
|
||||
// Uncomment to override default HW configurations
|
||||
//#define MY_DEFAULT_ERR_LED_PIN 4 // Error led pin
|
||||
//#define MY_DEFAULT_RX_LED_PIN 6 // Receive led pin
|
||||
@@ -93,16 +92,16 @@ Sd2Card card;
|
||||
static uint8_t num_of_leds = 5;
|
||||
static uint8_t leds[] = {LED_BLUE, LED_RED, LED_GREEN, LED_YELLOW, LED_ORANGE};
|
||||
|
||||
void setup() {
|
||||
void setup() {
|
||||
// Setup locally attached sensors
|
||||
}
|
||||
|
||||
void presentation() {
|
||||
// Present locally attached sensors
|
||||
// Present locally attached sensors
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// Send locally attached sensor data here
|
||||
void loop() {
|
||||
// Send locally attached sensor data here
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +141,7 @@ void preHwInit() {
|
||||
digitalWrite(LED_YELLOW, HIGH);
|
||||
tests++;
|
||||
}
|
||||
|
||||
|
||||
if (testEEProm()) {
|
||||
digitalWrite(LED_ORANGE, HIGH);
|
||||
tests++;
|
||||
@@ -155,7 +154,7 @@ void preHwInit() {
|
||||
digitalWrite(leds[i], LOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
while (1) {
|
||||
digitalWrite(LED_RED, HIGH);
|
||||
@@ -164,7 +163,7 @@ void preHwInit() {
|
||||
delay(200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool testSha204(){
|
||||
@@ -243,7 +242,7 @@ bool testEEProm() {
|
||||
delay(500);
|
||||
eeprom_d2 = i2c_eeprom_read_byte(EEPROM_VERIFICATION_ADDRESS);
|
||||
if (eeprom_d1 == eeprom_d2) {
|
||||
SerialUSB.println("PASSED");
|
||||
SerialUSB.println("PASSED");
|
||||
i2c_eeprom_write_byte(EEPROM_VERIFICATION_ADDRESS, ~eeprom_d1);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user