Skip to content

Commit

Permalink
examples: modify FindMy example so you can run it from Linux command …
Browse files Browse the repository at this point in the history
…line as well as on MCUs

Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Jan 8, 2025
1 parent 13d71b4 commit 907a378
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/findmy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
//
// To build:
// tinygo flash -target nano-rp2040 -ldflags="-X main.PublicKey='SGVsbG8sIFdvcmxkIQ=='" ./examples/findmy
//
// For Linux:
// go run ./examples/findmy SGVsbG8sIFdvcmxkIQ==
package main

import (
Expand All @@ -16,9 +19,6 @@ import (

var adapter = bluetooth.DefaultAdapter

// PublicKey is the public key of the device. Must be base64 encoded.
var PublicKey string

func main() {
time.Sleep(2 * time.Second) // wait for USB serial to be available

Expand Down
6 changes: 6 additions & 0 deletions examples/findmy/mcu.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//go:build tinygo

package main

// PublicKey is the public key of the device. Must be base64 encoded.
var PublicKey string
8 changes: 8 additions & 0 deletions examples/findmy/os.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build !tinygo

package main

import "os"

// PublicKey is the public key of the device. Must be base64 encoded.
var PublicKey = os.Args[1]

0 comments on commit 907a378

Please sign in to comment.