完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我正在做一个大学的项目,包括通过PIC管理引擎的速度,最近通过Android实现了一个Android应用程序并通过蓝牙进行通信。这个应用程序将有一个滑块,它将控制速度。问题是这个滑块把数据发送给我。在XC8中,例如,EuStudiaRead();我存储了一个类型的char,我需要存储一个完整的字符串,然后把它传递给整数。谢谢你的帮助。
以上来自于百度翻译 以下为原文 I'm doing a project for the university which consists of managing the speed of an engine through a pic, recently implemented an android app and communicated through a bluetooth this app will have a slider, which will control the speed. The problem is that this sliber sends me the data as a string, and in XC8 for example the EUSART_Read (); I store a bit of type char, and I need to store an entire string and then pass it to integer. How would I do it? Thank you in advance for your help. |
|
相关推荐
4个回答
|
|
我建议你在跑步之前学会走路。有很多很好的C课本。否则,当你的问题出现时,你只会要求不断地提供解决方案。
以上来自于百度翻译 以下为原文 I suggest you learn to walk before trying to run. There are plenty of good C text books available. Otherwise you will just be asking for a constant drip-feed of solutions as your problems crop up. |
|
|
|
将数组中的char存储在一个数组中。用null char’0’终止数组。然后只需将该字符串中的ASCII代码转换为一个数字。还可以在字符到达时将字符转换为char。您需要知道的是字符串长度或STR中有一个特殊的终止字符。因此,在PIC方面,您知道何时接收到完整的字符串。但是,当您对发送端(Android应用程序)有控制时,您可以定义协议细节,因此在任何一方都没有惊喜。 以上来自于百度翻译 以下为原文 Hi Store the char in the received sequence in an array. Terminate the array with a NULL char ' |