Changed compilation. Changed logging.
This commit is contained in:
parent
760f8d9556
commit
9f9899d2cc
@ -2,9 +2,9 @@ FROM golang:1.22.5
|
||||
|
||||
WORKDIR /app
|
||||
COPY ./ ./
|
||||
RUN go mod download
|
||||
RUN go get .
|
||||
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o /modem-test
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o /mpu-test
|
||||
|
||||
CMD ["/modem-test"]
|
||||
CMD ["/mpu-test"]
|
||||
|
16
main.go
16
main.go
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/CGSG-2021-AE4/mpu-test/mpu6050"
|
||||
)
|
||||
@ -23,21 +24,20 @@ func mainE() error {
|
||||
log.Println("LOOP")
|
||||
log.Println("ACCEL")
|
||||
for {
|
||||
temp, err := mpu.GetTemp()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Println("Temp:", temp)
|
||||
|
||||
// temp, err := mpu.GetTemp()
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
accel, err := mpu.GetAccel(false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Println("Accel:", accel)
|
||||
gyro, err := mpu.GetGyro()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Println("Gyro:", gyro)
|
||||
log.Printf("%9.6f\t%9.6f\t%9.6f\t%9.6f\t%9.6f\t%9.6f\n", accel[0], accel[1], accel[2], gyro[0], gyro[1], gyro[2])
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user