首页 文章

BLE112带有Arduino代码

提问于
浏览
0

我正在尝试用Arduino读取传感器,然后通过BLE112将信号传输到iPhone设备 .

我读了很多关于这个设备的内容,并更新了固件(Gatta和hardware.xml文件) . 有一个库可以使用它(BGlib),但我不知道从哪里开始,因为没有足够的评论 .

我用BLUEGUI连接了它 . 我可以在iPhone中的BLE应用程序中看到它,我需要使用的服务(UUID) . 我设法使用API与它(BLUEGUI)进行通信,但是使用Arduino我可以连接到它但不与它通信 . 我不知道如何处理它(Arduino中的硬件连接RX和TX与ble112中的TX和RX)

有没有人对此有任何想法?

1 回答

  • 0

    请看一篇我写的关于通过UART将设备连接到BLE112的博客文章(该设备是Arduino):http://www.sureshjoshi.com/embedded/ble112-uart-watermarks-example/

    这是需要运行BLE112的串行端口代码

    event system_endpoint_watermark_rx(endpoint, size)
      if endpoint = system_endpoint_uart1 then
        in_len = size
        call system_endpoint_set_watermarks(system_endpoint_uart1, 0, $ff) # disable RX watermark
        call system_endpoint_rx(system_endpoint_uart1, in_len)(result, in_len, in(0:in_len)) # read data from UART
        call system_endpoint_set_watermarks(system_endpoint_uart1, 10, $ff) # enable RX watermark
        call attributes_write(xgatt_test, 0, in_len, in(0:in_len)) # Write data to GATT
      end if
    end
    

    此外,这是一个关于RX / TX连接的片段

    哦,只是因为我还没有在网上看过它,我还会提到[usart channel =“1 alternate =”1“...]对应P0_4(TX)和P0_5(RX) (根据版本1.26 - 2012年7月BLE112数据表)

相关问题