Other Parts Discussed in Thread: CC2541
else if ( simpleBLEState == BLE_STATE_CONNECTED &&
GUA_CHAR1_Hdl != 0 )
{
//香瓜
uint8 status;
// Do a read or write as long as no other read or write is in progress
if ( simpleBLEDoWrite )
{
// Do a write
attWriteReq_t req;
req.handle = GUA_CHAR1_Hdl; //simpleBLECharHdl;
req.len = 1;
req.value[0] = simpleBLECharVal;
req.sig = 0;
req.cmd = 0;
status = GATT_WriteCharValue( simpleBLEConnHandle, &req, simpleBLETaskId );
NPI_PrintString("Write OK!");
}
// else
// {
// // Do a read
// attReadReq_t req;
//
// req.handle = simpleBLECharHdl;
// status = GATT_ReadCharValue( simpleBLEConnHandle, &req, simpleBLETaskId );
// }
if ( status == SUCCESS )
{
//simpleBLEProcedureInProgress = TRUE;
simpleBLEDoWrite = simpleBLEDoWrite;
}
//香瓜
}
我主机CC2541开发板用Notify方式发送数据给蓝牙模块(从机),
代码如上。可是只有第一次管用。
就是蓝牙模块收到数据,指示灯取反,第一次发送取反。第二次第三次则不反应。
判断应该是蓝牙模块没有收到。
因为用手机发送给蓝牙模块,每次指示灯都取反。
大神看看,哪里有问题?谢谢!



