Проблемы с блютузом помогите пожалуйста
- Войдите на сайт для отправки комментариев
Втр, 19/04/2016 - 10:08
Все делаю вроде по урокам, а все равно не выходит. Заказывал блютузку с китая. Вроде как подключается но не может получить данные, пишет "соединение установлено, но стройство не отвечает". Вот код:
//////////////////////////////////////////////
// RemoteXY include library //
// use library version 2.1.3 or up //
// use ANDROID app version 3.4.1 or up //
//////////////////////////////////////////////
/* RemoteXY select connection mode and include library */
#define REMOTEXY_MODE__HC05_SOFTSERIAL
#include <SoftwareSerial.h>
#include <RemoteXY.h>
/* RemoteXY connection settings */
#define REMOTEXY_SERIAL_RX 2
#define REMOTEXY_SERIAL_TX 3
#define REMOTEXY_SERIAL_SPEED 9600
/* RemoteXY configurate */
unsigned char RemoteXY_CONF[] =
{ 1, 0, 11, 0, 4, 5, 1, 0, 29, 13
, 36, 36, 2, 88, 0
};
/* this structure defines all the variables of your control interface */
struct {
/* input variable */
unsigned char button_1; /* =1 if button pressed, else =0 */
/* other variable */
unsigned char connect_flag; /* =1 if wire connected, else =0 */
} RemoteXY;
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
#define PIN_BUTTON_1 13
void setup()
{
RemoteXY_Init ();
pinMode (PIN_BUTTON_1, OUTPUT);
// TODO you setup code
}
void loop()
{
RemoteXY_Handler ();
digitalWrite(PIN_BUTTON_1, (RemoteXY.button_1 == 0) ? LOW : HIGH);
// TODO you loop code
// use the RemoteXY structure for data transfer
}
Все заработало. Выключил. Подождал 20 минут. Включил и заработало.)))