|
发表于 2014-2-5 18:49:00
|
显示全部楼层
本帖最后由 junf97 于 2014-2-5 19:27 编辑
我在另外一个帖子里回你啦。。去看看把、
以下内容为回复在另一个帖子里的:
robotC自带大量的实例程序,位于主界面File菜单下Open Sample Program,或者直接去安装目录下Sample Programs文件夹里找。
我帮你看了一下,就在实例程序里有一整个文件夹的蓝牙实例程序(文件夹名为Bluetooth Communication),以下是我帮你摘出来的程序片段:
发送:
int x=2;
while (true)
{
//Sends x over Bluetooth, increments its value, and waits 300 milliseconds before repeating process
sendMessage(x);
x=x+1;
wait1Msec(300);
}
接收:
while(true)
{
//Receives message and formats into a 'Value: y' format for display
y=message;
StringFormat(display, "Value: %d", y);
//Displays the 'display' string, waits 300 milliseconds, clears the screen, and repeats code
nxtDisplayCenteredTextLine(3, display);
wait1Msec(300);
ClearMessage();
}
|
|