mirror of
https://github.com/kidoman/embd
synced 2025-07-03 03:47:33 +02:00
l3gd20: its actually the orientation delta
This commit is contained in:
parent
236cd2fd33
commit
58a1eb5a56
2 changed files with 12 additions and 19 deletions
|
@ -17,10 +17,10 @@ func main() {
|
|||
defer gyro.Close()
|
||||
|
||||
x, y, z := 0.0, 0.0, 0.0
|
||||
dt := 0.02
|
||||
dt := 0.1 // Seconds
|
||||
|
||||
for {
|
||||
dx, dy, dz, err := gyro.Orientation()
|
||||
dx, dy, dz, err := gyro.OrientationDelta()
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
|
@ -29,14 +29,7 @@ func main() {
|
|||
y += dy * dt
|
||||
z += dz * dt
|
||||
|
||||
log.Printf("Orientation is (%v, %v, %v)", x, y, z)
|
||||
|
||||
temp, err := gyro.Temperature()
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
|
||||
log.Printf("Temperature is %v", temp)
|
||||
log.Printf("%v", z)
|
||||
|
||||
time.Sleep(time.Duration(dt*1000) * time.Millisecond)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue