forked from gioblu/PJON
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimpleSwitch.ino
27 lines (21 loc) · 893 Bytes
/
SimpleSwitch.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <PJONSwitch.h>
#include <PJONSoftwareBitBang.h>
/* Route packets between a collection of buses with the same
or different strategies or media.
PJONSimpleSwitch routes between buses of the same strategy.
It uses less storage and RAM than the more general PJONSwitch.
__________ ________ __________
| | Pin 7 | | Pin 12 | |
| DEVICE 1 |_______________| SWITCH |_______________| DEVICE 2 |
|__________| Bus 0.0.0.1 |________| Bus 0.0.0.2 |__________| */
PJONSoftwareBitBang bus1((const uint8_t[4]){0, 0, 0, 1}, PJON_NOT_ASSIGNED),
bus2((const uint8_t[4]){0, 0, 0, 2}, PJON_NOT_ASSIGNED);
PJONSimpleSwitch<SoftwareBitBang> router(bus1, bus2);
void setup() {
bus1.strategy.set_pin(7);
bus2.strategy.set_pin(12);
router.begin();
}
void loop() {
router.loop();
}