Updated serial gateway

This commit is contained in:
Simon 2017-08-16 15:27:29 +02:00
parent 79e5557907
commit c977fde48a
4 changed files with 91 additions and 4 deletions

View File

@ -6,7 +6,7 @@
*/
#define SKETCH_NAME "Serial gateway"
#define SKETCH_VERSION "1.0"
#define SKETCH_VERSION "1.1"
/**********************************
* MySensors node configuration
@ -15,13 +15,15 @@
// General settings
#define MY_BAUD_RATE 9600
#define MY_DEBUG
//#define MY_NODE_ID 100
//#define MY_NODE_ID 32
// NRF24 radio settings
#define MY_RADIO_NRF24
//#define MY_RF24_ENABLE_ENCRYPTION
//#define MY_RF24_CHANNEL 76
//#define MY_RF24_PA_LEVEL RF24_PA_HIGH
#define MY_RF24_PA_LEVEL RF24_PA_HIGH
#define MY_RF24_PA_LEVEL_GW RF24_PA_HIGH
//#define MY_DEBUG_VERBOSE_RF24
// RFM69 radio settings
@ -40,7 +42,7 @@
* MySensors gateway configuration
*/
// Common gateway settings
//#define MY_REPEATER_FEATURE
#define MY_REPEATER_FEATURE
// Serial gateway settings
#define MY_GATEWAY_SERIAL

36
passive/lib/readme.txt Normal file
View File

@ -0,0 +1,36 @@
This directory is intended for the project specific (private) libraries.
PlatformIO will compile them to static libraries and link to executable file.
The source code of each library should be placed in separate directory, like
"lib/private_lib/[here are source files]".
For example, see how can be organized `Foo` and `Bar` libraries:
|--lib
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |- readme.txt --> THIS FILE
|- platformio.ini
|--src
|- main.c
Then in `src/main.c` you should use:
#include <Foo.h>
#include <Bar.h>
// rest H/C/CPP code
PlatformIO will find your libraries automatically, configure preprocessor's
include paths and build them.
More information about PlatformIO Library Dependency Finder
- http://docs.platformio.org/page/librarymanager/ldf.html

5
passive/platformio.ini Normal file
View File

@ -0,0 +1,5 @@
[env:pro8MHzatmega328]
platform = atmelavr
framework = arduino
board = pro8MHzatmega328

44
passive/src/passive.ino Normal file
View File

@ -0,0 +1,44 @@
// Enable debug prints
#define MY_DEBUG
// Enable passive mode
#define MY_PASSIVE_NODE
#define MY_REPEATER_FEATURE
// Passive mode requires static node ID
#define MY_NODE_ID 100
// Enable and select radio type attached
#define MY_RADIO_NRF24
#define MY_RF24_PA_LEVEL RF24_PA_HIGH
//#define MY_RADIO_NRF5_ESB
//#define MY_RADIO_RFM69
//#define MY_RADIO_RFM95
#include <MySensors.h>
#define CHILD_ID 0 // Id of the sensor child
// Initialize general message
MyMessage msg(CHILD_ID, V_TEMP);
void setup()
{
}
void presentation()
{
// Send the sketch version information to the gateway and controller
sendSketchInfo("Passive node", "1.0");
// Register all sensors to gw (they will be created as child devices)
present(CHILD_ID, S_TEMP);
}
void loop()
{
// generate some random data
send(msg.set(25.0+random(0,30)/10.0,2));
wait(10000);
}