为什么强制转换值声明而不是函数参数会导致不同的行为?
以下操作挂起:
let duration = uint32 500
...
brick.DirectCommand.TurnMotorAtPowerForTimeAsync(motors, power, duration, breakEnabled) |> ignore
以下操作成功:
brick.DirectCommand.TurnMotorAtPowerForTimeAsync(motors, power, uint32 500, breakEnabled) |> ignore
有什么不同?
代码:
let volume = 100
let frequency = uint16 1000
let duration = uint32 500
let power = 100
let motors = OutputPort.B ||| OutputPort.C
let breakEnabled = false
let moveAsync = async {
let brick = Brick(UsbCommunication())
brick.ConnectAsync() |> ignore
brick.DirectCommand.TurnMotorAtPowerForTimeAsync(motors, power, duration, breakEnabled) |> ignore
}
Async.RunSynchronously moveAsync