File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed
projects/era-node/software/mysensors-arduino-test Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ .pio
Original file line number Diff line number Diff line change
1
+ ; PlatformIO Project Configuration File
2
+ ;
3
+ ; Build options: build flags, source filter
4
+ ; Upload options: custom upload port, speed and extra flags
5
+ ; Library options: dependencies, extra library storages
6
+ ; Advanced options: extra scripting
7
+ ;
8
+ ; Please visit documentation for the other options and examples
9
+ ; https://docs.platformio.org/page/projectconf.html
10
+
11
+ [env:d1_mini]
12
+ framework = arduino
13
+
14
+ board = d1_mini
15
+ lib_deps =
16
+ https://github.com/d-a-v/MySensors# noCoreRedefinition
Original file line number Diff line number Diff line change
1
+ #include < Arduino.h>
2
+
3
+ #define MY_DEBUG
4
+ #define MY_RS485
5
+ #define MY_RS485_DE_PIN D1
6
+ #define MY_RS485_BAUD_RATE 9600
7
+ #define MY_RS485_HWSERIAL Serial
8
+
9
+ #include < MySensors.h>
10
+
11
+ #define CHILD_ID 1
12
+
13
+ MyMessage msg (CHILD_ID, V_TRIPPED);
14
+
15
+ bool state = false ;
16
+
17
+ void setup () {
18
+ Serial.begin (9600 );
19
+ }
20
+
21
+ void presentation () {
22
+ sendSketchInfo (" Motion Sensor" , " 1.0" );
23
+ present (CHILD_ID, S_MOTION);
24
+ }
25
+
26
+ void loop () {
27
+ send (msg.set (state ? " 1" : " 0" ));
28
+ state = state ? false : true ;
29
+ delay (5000 );
30
+ }
31
+
You can’t perform that action at this time.
0 commit comments