成功连接乐高积木后,我无法观察到任何操作。
此代码有效:
let brick = Brick(BluetoothCommunication "COM3")
let result = brick.ConnectAsync().RunSynchronously
但是,我无法观察到连续命令(即声音和电机)的任何确认。
客户代码:
open MyLego.Core
[<EntryPoint>]
let main argv =
let example = LegoExample()
0 // return an integer exit code
域名逻辑
namespace MyLego.Core
open Lego.Ev3.Core
open Lego.Ev3.Desktop
type LegoExample() =
let volume = 100
let frequency = 1000
let duration = 300
let power = 50
let breakSetting = false
let brick = Brick(BluetoothCommunication "COM3")
do brick.BrickChanged.Add(fun e -> printfn "Brick changed")
let result = brick.ConnectAsync().RunSynchronously
let move = brick.DirectCommand.TurnMotorAtPowerForTimeAsync(
OutputPort.B ||| OutputPort.C, power, uint32 duration, breakSetting).RunSynchronously
let playTone = brick.DirectCommand.PlayToneAsync(
volume, uint16 frequency, uint16 duration).RunSynchronously
请注意,我在构造函数中执行所有这些操作。那可以吗?
我引用了以下文档:
答案 0 :(得分:0)
事实证明我有蓝牙连接问题。
当我使用USB时,我会观察到预期的行为。
显然吞下了以下异常:
&#34;指定的登录会话&#34;
没有用户会话密钥
但是,只有在C#实现中才会出现此异常。