nRF24L01的字符串传输的例子修正
http://arduino-info.wikispaces.com/nRF24L01-Mirf-Examples这个例子不错,不过里面有2个BUG。
1. Server:Serial.print(c)需要修改为 Serial.print((char)c);
void loop()
{
byte c;
// is there any data pending?
if( Mirf.dataReady() )
{
// well, get it
Mirf.getData(&c);
// ... and write it out to the PC
Serial.print(c);
}
}
Sensor 的Setup 函数里面缺一行
在Mirf.init(); 前面加一行:
Mirf.spi = &MirfHardwareSpi;
void setup()
{
// init the transceiver
Mirf.init();
// we transmit only a single byte each time
Mirf.payload = 1;
// selecting a channel which is not too noisy
Mirf.channel = 90;
Mirf.config();
// Set 1MHz data rate
Mirf.configRegister(RF_SETUP,0x06);
// Set address - this one must match the
// address the receiver is using!
Mirf.setTADDR((byte *)"TX_01");
}
两个陷阱,过分,给没用过的朋友提个醒。
谢谢楼主分享,正在学习这个
页:
[1]