Bonjour à tous.
J'utilise debian avec le ble, j'ai testé pour meconnecter avec mon smartphone c'est ok https://wiki.debian.org/BluetoothUser#Pairing_using_CLI
Mais avec golang j'ai des erreurs https://gobot.io/documentation/platforms/ble/
Quand je lance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
28
29 package main import ( "fmt" "os" "time" "gobot.io/x/gobot" "gobot.io/x/gobot/platforms/ble" ) func main() { bleAdaptor := ble.NewClientAdaptor(os.Args[1]) battery := ble.NewBatteryDriver(bleAdaptor) work := func() { gobot.Every(5*time.Second, func() { fmt.Println("Battery level:", battery.GetBatteryLevel()) }) } robot := gobot.NewRobot("bleBot", []gobot.Connection{bleAdaptor}, []gobot.Device{battery}, work, ) robot.Start() }j'ai les erreurs
Code : Sélectionner tout - Visualiser dans une fenêtre à part /usr/local/go/bin/go run main.go 64:A2:F9:A7:EF:40
avec sudo
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 /usr/local/go/bin/go run main.go 64:A2:F9:A7:EF:40 2020/10/26 15:14:26 Initializing connections... 2020/10/26 15:14:26 Initializing connection BLEClient-6FFB105646EF9D4E ... 2020/10/26 15:14:26 Initializing devices... 2020/10/26 15:14:26 Initializing device Battery-1C666D252F46283B ... 2020/10/26 15:14:26 Robot bleBot initialized. 2020/10/26 15:14:26 Starting Robot bleBot ... 2020/10/26 15:14:26 Starting connections... 2020/10/26 15:14:26 Starting connection BLEClient-6FFB105646EF9D4E... 2020/10/26 15:14:26 1 error occurred: * can't connect to device default: can't get device: can't init hci: no devices available: (hci0: can't down device: operation not permitted)
Merci de votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 sudo /usr/local/go/bin/go run main.go 64:A2:F9:A7:EF:40 [sudo] Mot de passe de kevin : main.go:8:9: cannot find package "gobot.io/x/gobot" in any of: /usr/local/go/src/gobot.io/x/gobot (from $GOROOT) /root/go/src/gobot.io/x/gobot (from $GOPATH) main.go:9:9: cannot find package "gobot.io/x/gobot/platforms/ble" in any of: /usr/local/go/src/gobot.io/x/gobot/platforms/ble (from $GOROOT) /root/go/src/gobot.io/x/gobot/platforms/ble (from $GOPATH)
Partager