找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2690|回复: 0
打印 上一主题 下一主题
收起左侧

求助!蓝牙测试不成功

[复制链接]
跳转到指定楼层
楼主
程序如下
/*
  Receives Test Events from your phone.
  After it gets a test message the led 13 will blink
  for one second.
*/

#include <MeetAndroid.h>

MeetAndroid meetAndroid;
int onboardLed = 13;
int x;
void setup()  
{
  // use the baud rate your bluetooth module is configured to
  // not all baud rates are working well, i.e. ATMEGA168 works best with 57600
  Serial.begin(57600);

  // register callback functions, which will be called when an associated event occurs.
  // - the first parameter is the name of your function (see below)
  // - match the second parameter ('A', 'B', 'a', etc...) with the flag on your Android application
  meetAndroid.registerFunction(testEvent, 'A');  

  pinMode(onboardLed, OUTPUT);
  digitalWrite(onboardLed, HIGH);

}

void loop()
{
  while(Serial.available())
  {
  x=Serial.read();
  Serial.println(x);
  }
  meetAndroid.receive(); // you need to keep this in your loop() to receive events
}

/*
* This method is called constantly.
* note: flag is in this case 'A' and numOfValues is 0 (since test event doesn't send any data)
*/
void testEvent(byte flag, byte numOfValues)
{
  flushLed(300);
  flushLed(300);
}

void flushLed(int time)
{
  digitalWrite(onboardLed, LOW);
  delay(time);
  digitalWrite(onboardLed, HIGH);
  delay(time);
}








无论输入什么参数,结果都是0或者224,这是什么情况???
手机上使用的是Amarino2.0界面如下

509295489885451895.jpg (88.06 KB, 下载次数: 162)

509295489885451895.jpg
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表