Hi all
I am trying to set up a wireless network - ANT. I got 2 sets of "Transceiver nRF24AP1 with Trace Antenna" that I bought from SparkFun. They were connected with 2 arduinoes seperately. One of them I set it to transmit data (Master) and the other one I set it to receive data (Slave). Following are the connections between the Transceiver and Arduino :
MASTER :
Arduino 3.3v --> Transceiver vcc
Arduino TX --> Transceiver RX
Arduino GND --> Transceiver GND
SLAVE :
Arduino 3.3v --> Transceiver vcc
Arduino RX --> Transceiver TX
Arduino GND --> Transceiver GND
On the Arduinoes I installed following codes :
//// Master Arduino code ///
void setup()
{
Serial.begin(4800);
//reset()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x01); // LENGTH Byte
Serial.print(0x4a); // Message ID Byte ( ANT_RestSystem() )
Serial.print(0x00); // Data Byte N (N=LENGTH)
Serial.print(0xef); // Checksum
delay(1000); //delay 1sec
}
void loop(){
//assignch()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x03); // LENGTH Byte
Serial.print(0x42); // Message ID Byte ( ANT_AssignChannel() )
Serial.print(0x00); // Channel no. 0
Serial.print(0x10); // Channel type
Serial.print(0x00); // Network no. 0
Serial.print(0xf5); // Checksum
delay(1000); //delay 1sec
//setchid()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x05); // LENGTH Byte
Serial.print(0x51); // Message ID Byte ( ANT_SetChannelId() )
Serial.print(0x00); // Channel no. 0
Serial.print(0x31); // Device no. = 0x0031
Serial.print(0x00); // Device no.
Serial.print(0x01); // Device Type Id
Serial.print(0x05); // Man Id
Serial.print(0xc5); // Checksum
delay(1000); //delay 1sec
//opench()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x01); // LENGTH Byte
Serial.print(0x4b); // Message ID Byte ( ANT_OpenChannel() )
Serial.print(0x00); // Channel no. 0
Serial.print(0xee); // Checksum
delay(1000); //delay 1sec
//send()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x09); // LENGTH Byte
Serial.print(0x4e); // Message ID Byte ( ANT_SendBroadcastData->ChannelEventFunc() )
Serial.print(0x00); // Channel no. 0
Serial.print(0xaa); //Data
Serial.print(0xaa); //Data
Serial.print(0xaa); //Data
Serial.print(0xaa); //Data
Serial.print(0xaa); //Data
Serial.print(0xaa); //Data
Serial.print(0xaa); //Data
Serial.print(0xaa); //Data
Serial.print(0xe3); // Checksum
Serial.println();
Serial.print("Hello world. I am master");
Serial.println();
}
---
///// Slave Arduino code ///
void setup()
{
Serial.begin(4800);
//reset()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x01); // LENGTH Byte
Serial.print(0x4a); // Message ID Byte ( ANT_RestSystem() )
Serial.print(0x00); // Data Byte N (N=LENGTH)
Serial.print(0xef); // Checksum
delay(1000); //delay 1sec
}
void loop(){
//assignch()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x03); // LENGTH Byte
Serial.print(0x42); // Message ID Byte ( ANT_AssignChannel() )
Serial.print(0x00); // Channel no. 0
Serial.print(0x00); // Channel type
Serial.print(0x00); // Network no. 0
Serial.print(0xe5); // Checksum
delay(1000); //delay 1sec
//setchid()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x05); // LENGTH Byte
Serial.print(0x51); // Message ID Byte ( ANT_SetChannelId() )
Serial.print(0x00); // Channel no. 0
Serial.print(0x00); // Device no. = 0x0000
Serial.print(0x00); // Device no.
Serial.print(0x00); // Device Type Id
Serial.print(0x00); // Man Id
Serial.print(0xf0); // Checksum
delay(1000); //delay 1sec
//opench()
Serial.print(0xa4); // SYNC Byte
Serial.print(0x01); // LENGTH Byte
Serial.print(0x4b); // Message ID Byte ( ANT_OpenChannel() )
Serial.print(0x00); // Channel no. 0
Serial.print(0xee); // Checksum
delay(1000); //delay 1sec
//receive()
// read the incoming byte:
int incomingByte = Serial.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
*} *
Regret, they cannot communicate to each other. ![]()
Pls help!!