File tree Expand file tree Collapse file tree 4 files changed +34
-12
lines changed Expand file tree Collapse file tree 4 files changed +34
-12
lines changed Original file line number Diff line number Diff line change @@ -23,20 +23,20 @@ Builds/flashes atcmd console application with simulator instead of actual LoRa r
23
23
tinygo flash -target pico ./examples/lora/lorawan/atcmd/
24
24
```
25
25
26
- ## PyBadge with LoRa Featherwing
26
+ ## PyBadge with LoRa Featherwing for EU868 region
27
27
28
28
Builds/flashes atcmd console application on PyBadge using LoRa Featherwing (RFM95/SX1276).
29
29
30
30
```
31
- tinygo flash -target pybadge -tags featherwing ./examples/lora/lorawan/atcmd/
31
+ tinygo flash -target pybadge -tags featherwing -ldflags="-X main.reg=EU868" ./examples/lora/lorawan/atcmd/
32
32
```
33
33
34
- ## LoRa-E5
34
+ ## LoRa-E5 for US915 region
35
35
36
36
Builds/flashes atcmd console application on Lora-E5 using onboard SX126x.
37
37
38
38
```
39
- tinygo flash -target lorae5 ./examples/lora/lorawan/atcmd/
39
+ tinygo flash -target lorae5 -ldflags="-X main.reg=US915" ./examples/lora/lorawan/atcmd/
40
40
```
41
41
42
42
## Joining a Public Lorawan Network
Original file line number Diff line number Diff line change 32
32
defaultTimeout uint32 = 1000
33
33
)
34
34
35
+ var reg string
36
+
35
37
func main () {
36
38
uart .Configure (machine.UARTConfig {TX : tx , RX : rx })
37
39
@@ -45,7 +47,16 @@ func main() {
45
47
otaa = & lorawan.Otaa {}
46
48
lorawan .UseRadio (radio )
47
49
48
- lorawan .UseRegionSettings (region .EU868 ())
50
+ switch reg {
51
+ case "AU915" :
52
+ lorawan .UseRegionSettings (region .AU915 ())
53
+ case "EU868" :
54
+ lorawan .UseRegionSettings (region .EU868 ())
55
+ case "US915" :
56
+ lorawan .UseRegionSettings (region .US915 ())
57
+ default :
58
+ lorawan .UseRegionSettings (region .EU868 ())
59
+ }
49
60
50
61
for {
51
62
if uart .Buffered () > 0 {
Original file line number Diff line number Diff line change @@ -21,16 +21,16 @@ loraConnect: Connected !
21
21
tinygo flash -target pico ./examples/lora/lorawan/basic-demo
22
22
```
23
23
24
- ## PyBadge with LoRa Featherwing
24
+ ## PyBadge with LoRa Featherwing for EU868 region
25
25
26
26
```
27
- tinygo flash -target pybadge -tags featherwing ./examples/lora/lorawan/basic-demo
27
+ tinygo flash -target pybadge -tags featherwing -ldflags="-X main.reg=EU868" ./examples/lora/lorawan/basic-demo
28
28
```
29
29
30
- ## LoRa-E5
30
+ ## LoRa-E5 for US915 region
31
31
32
32
```
33
- tinygo flash -target lorae5 ./examples/lora/lorawan/basic-demo
33
+ tinygo flash -target lorae5 -ldflags="-X main.reg=US915" ./examples/lora/lorawan/basic-demo
34
34
```
35
35
36
36
Original file line number Diff line number Diff line change @@ -12,7 +12,10 @@ import (
12
12
"tinygo.org/x/drivers/lora/lorawan/region"
13
13
)
14
14
15
- var debug string
15
+ var (
16
+ reg string
17
+ debug string
18
+ )
16
19
17
20
const (
18
21
LORAWAN_JOIN_TIMEOUT_SEC = 180
@@ -67,8 +70,16 @@ func main() {
67
70
68
71
// Connect the lorawan with the Lora Radio device.
69
72
lorawan .UseRadio (radio )
70
-
71
- lorawan .UseRegionSettings (region .EU868 ())
73
+ switch reg {
74
+ case "AU915" :
75
+ lorawan .UseRegionSettings (region .AU915 ())
76
+ case "EU868" :
77
+ lorawan .UseRegionSettings (region .EU868 ())
78
+ case "US915" :
79
+ lorawan .UseRegionSettings (region .US915 ())
80
+ default :
81
+ lorawan .UseRegionSettings (region .EU868 ())
82
+ }
72
83
73
84
// Configure AppEUI, DevEUI, APPKey, and public/private Lorawan Network
74
85
setLorawanKeys ()
You can’t perform that action at this time.
0 commit comments