Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bluetooth Bluegiga BGScript:如何在显示器上显示uint8值?_Bluetooth_Bluetooth Lowenergy_Bluegiga - Fatal编程技术网

Bluetooth Bluegiga BGScript:如何在显示器上显示uint8值?

Bluetooth Bluegiga BGScript:如何在显示器上显示uint8值?,bluetooth,bluetooth-lowenergy,bluegiga,Bluetooth,Bluetooth Lowenergy,Bluegiga,我正在使用蓝牙程序的BGScript。BGScript提供了H/W中断侦听器API。侦听器API名称为硬件\u io\u端口\u状态增量、端口、irq、状态 我想看到的值是irq和state。BGScript可以使用SPI接口显示值。API接口为硬件spi传输通道、数据长度、值数据 我可以像这样显示字符串值 call hardware_spi_transfer(0,15,"Button 0 ") # OK call hardware_spi_transfer(0,15,state)

我正在使用蓝牙程序的BGScript。BGScript提供了H/W中断侦听器API。侦听器API名称为硬件\u io\u端口\u状态增量、端口、irq、状态

我想看到的值是irq和state。BGScript可以使用SPI接口显示值。API接口为硬件spi传输通道、数据长度、值数据

我可以像这样显示字符串值

call hardware_spi_transfer(0,15,"Button 0       ") # OK

call hardware_spi_transfer(0,15,state) # NG Build Error
根据API参考,我必须将uint8array格式的值设置为值\数据。但我不知道如何从unit转换为unit8array

API参考


你能帮我吗?谢谢。

问题不在于您在SPI呼叫中将长度设置为15 而您只想发送1个字节

调用硬件\u spi\u传输0,1,状态

如果不起作用,请尝试以下操作,将状态显式保存到缓冲区变量中:

暗淡状态 暗buf1 调用硬件\u io\u端口\u状态增量、端口、irq、状态 buf0:1=状态 调用硬件\u spi\u transfer0,1,buf0:1


在上面的文章中,用你的值替换delta、port、irq。

除了这篇文章之外:我可能错了,但要注意传出格式。在第一次通话中,您可能使用ASCII格式!因此,如果状态为1,则显示器上可能不会显示1。