小编Yev*_*kov的帖子

无法在 strconv.ParseFloat 问题的参数中使用 (type []byte) 作为类型字符串

pi@raspberrypi:~/Desktop/go $ go run shell1.go
Run Code Online (Sandbox Code Playgroud)

结果我得到:

pi@raspberrypi:~/Desktop/go $ go run shell1.go
# command-line-arguments
./shell1.go:29: undefined: n
./shell1.go:29: cannot use b (type []byte) as type string in argument to strconv.ParseFloat
./shell1.go:32: undefined: n
Run Code Online (Sandbox Code Playgroud)

Go文件( shell1.go)代码为:

package main

import (
    //    "net/http"
    //    "github.com/julienschmidt/httprouter"
    "fmt"
    "log"
    "os/exec"
    "strconv"
    "time"
    //"bytes"
    //"encoding/binary"
)
import _ "github.com/go-sql-driver/mysql"
import _ "database/sql"

func main() {
    for {
        time.Sleep(10 * time.Millisecond)
        cmd := exec.Command("gpio.bash")

        b, err := cmd.Output()
        if err != nil {
            log.Fatal(err)
        }
        n, …
Run Code Online (Sandbox Code Playgroud)

go gpio

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

go ×1

gpio ×1