Skip to content

Commit 3de2269

Browse files
committed
1 parent df0f3e4 commit 3de2269

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.pio
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+

0 commit comments

Comments
 (0)