【问题标题】:Redpark Serial Cable not receiving data on iPad 4Redpark 串行电缆未在 iPad 4 上接收数据
【发布时间】:2013-06-03 08:16:51
【问题描述】:

我目前正在尝试让 iPad 4 与 Arbotix RoboController(具有许多引脚的类似 Arduino 的控制器)对话。我正在使用 iPad 4,Lightning to 30-pin Adapter 连接到 RedPark C2-TTL 电缆。在

下正确识别电缆
Settings -> General -> About -> Serial TTL Cable

.

但是我没有按照 RedPark SDK 中的串行电缆 SDK / 用户指南进行操作。 Arbotix 设置为每 300 毫秒将“Hello World”写入串行,但方法

- (void) readBytesAvailable:(UInt32)numBytes {
    ...
}

根本没有被调用。也从未调用过cableConnected。

我确定我已将双方的波特率设置为 9600,正如this question 的答案所建议的那样。

虽然我有疑问,但有可能是适配器的使用存在问题。 有什么想法吗?

编辑:

解决方法如下:我在iPad 4+ Adapter上重新测试,发现没有问题。太棒了!

【问题讨论】:

  • 我拿到了一台 iPad 第一代,并重复测试。我仍然没有运气:RedPark SDK 调用cableDisconnected,但不调用cableConnected。我知道这一点,因为我将调试消息设置为在调用任何这些方法时显示在屏幕上。

标签: ios ipad arduino


【解决方案1】:

我解决了!我没有在.plist 文件中声明电缆。按照this page的步骤11的指示添加Supported external accessory protocols后,我能够按预期接收所有事件。

我如此卡住的原因是因为上面的链接和“带有 Arduino 的 iOS 传感器应用程序”一书中的链接都声明该属性是一个可选步骤,我选择省略。我认为这一定是由于需要显示一个额外的对话框来要求用户访问 App Store 而导致的时间或线程问题,从而搞砸了这些事件的正确委派。

在网页上:

This step is optional, but it will avoid the problem of you seeing an error message ("This accessory requires an application...") each time you plug in the cable.

在书上:

Finally, we need to declare support for the cable in our application’s Info.plist file. If we don’t do this, we’ll get something that looks like Figure 2-13 every time we plug the cable into the device.

【讨论】:

    【解决方案2】:

    在 info.plist 中,您是否使用“com.redpark.hobdb9”来声明电缆?我一直在想是否需要将 C2-TTL 电缆声明为其他东西,但在网上没有找到任何这样说的资源。

    【讨论】:

    • 是的,没错。 Supported external accessory protocols 应设置为 com.redpark.hobdb9。尽管许多消息来源说它是可选的,但它实际上是必要的。我正在使用 TTL 电缆。
    • 面对同样的问题,一些委托方法如 readBytesAvailable: 不会调用。我正在使用 RedPark L2-DB9V。 com.redpark.hobdb9vcom.redpark.ser45vcom.redpark.ser45 com.redpark.nmeaxcom.redpark.appgpscom.redpark.serdb9com.redpark.serEvalcom. redpark.hobdb9com.redpark.L2-DB9Vcom.redpark.DB9V 但没有运气接收数据。任何帮助将不胜感激。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多