examples: update MCU central examples to use ldflags to pass the desired device to connect to
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
ec80e0111e
commit
8f92747a18
2 changed files with 14 additions and 6 deletions
|
@ -6,11 +6,15 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// replace this with the MAC address of the Bluetooth peripheral you want to connect to.
|
// DeviceAddress is the MAC address of the Bluetooth peripheral you want to connect to.
|
||||||
const deviceAddress = "E4:B7:F4:11:8D:33"
|
// Replace this by using -ldflags="-X main.DeviceAddress=[MAC ADDRESS]"
|
||||||
|
// where [MAC ADDRESS] is the actual MAC address of the peripheral.
|
||||||
|
// For example:
|
||||||
|
// tinygo flash -target circuitplay-bluefruit -ldflags="-X main.DeviceAddress=7B:36:98:8C:41:1C" ./examples/discover/
|
||||||
|
var DeviceAddress string
|
||||||
|
|
||||||
func connectAddress() string {
|
func connectAddress() string {
|
||||||
return deviceAddress
|
return DeviceAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait on baremetal, proceed immediately on desktop OS.
|
// wait on baremetal, proceed immediately on desktop OS.
|
||||||
|
|
|
@ -6,11 +6,15 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// replace this with the MAC address of the Bluetooth peripheral you want to connect to.
|
// DeviceAddress is the MAC address of the Bluetooth peripheral you want to connect to.
|
||||||
const deviceAddress = "E4:B7:F4:11:8D:33"
|
// Replace this by using -ldflags="-X main.DeviceAddress=[MAC ADDRESS]"
|
||||||
|
// where [MAC ADDRESS] is the actual MAC address of the peripheral.
|
||||||
|
// For example:
|
||||||
|
// tinygo flash -target circuitplay-bluefruit -ldflags="-X main.DeviceAddress=7B:36:98:8C:41:1C" ./examples/heartrate-monitor/
|
||||||
|
var DeviceAddress string
|
||||||
|
|
||||||
func connectAddress() string {
|
func connectAddress() string {
|
||||||
return deviceAddress
|
return DeviceAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
// done just blocks forever, allows USB CDC reset for flashing new software.
|
// done just blocks forever, allows USB CDC reset for flashing new software.
|
||||||
|
|
Loading…
Reference in a new issue