mirror of
https://github.com/kidoman/embd
synced 2025-07-03 11:57:38 +02:00
spi: finishing touches
This commit is contained in:
parent
0f23150374
commit
67d316851a
7 changed files with 49 additions and 45 deletions
|
@ -18,12 +18,19 @@ func main() {
|
|||
}
|
||||
defer embd.CloseSPI()
|
||||
|
||||
bus := embd.NewSPIBus(embd.SpiMode0, 0, 1000000, 8, 0)
|
||||
channel := 0
|
||||
speed := 1000000
|
||||
bpw := 8
|
||||
delay := 0
|
||||
bus := embd.NewSPIBus(embd.SPIMode0, channel, speed, bpw, delay)
|
||||
defer bus.Close()
|
||||
|
||||
for i := 0; i < 30; i++ {
|
||||
time.Sleep(1 * time.Second)
|
||||
val, _ := getSensorValue(bus)
|
||||
val, err := getSensorValue(bus)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Printf("value is: %v\n", val)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue