diff --git a/Dockerfile b/Dockerfile index 0ebf38e..dbd7697 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] \ No newline at end of file +CMD ["/mpu-test"] diff --git a/main.go b/main.go index f26e90b..ecefd68 100644 --- a/main.go +++ b/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) } }