Hi devlinse!
Thanks for you information. It is hard to find others who knows 24AP1 here. javascript:emoticon(‘
’). I got two 24AP1 from SparkFun but so far, I still can not find the way to let them reading each other simply. It makes me very frustrated. I connected them with 2 arduinos seperately. MASTER with this code :
///// Master ///
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 with this code :
///// Slave ///
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 could not communicate to each other. Now I have no other way to test the 24AP1 modules are workable or not. I am planning to buy ANT’s dev kit. May be this is the simpliest way to go.
My goal was trying to use a 24AP1 + program to communicate with Suunto HR belt but seems it is impossible except I can get the network key from Suunto directly. However, I found some codes from Garmin dev forum ( http://developer.garmin.com/forum/viewt … +ant+stick ) . If download this : http://www.vernazza.org/hr_win.zip . You can find keys inside the src. But I’ve ever tried it coz I’ve not yet got the HR belt. Now, I will not use Suunto and Garmin anymore because of the private network key problem. Moreover, there are many small brands’ HR belts in the market recently. Some of them are using 24AP1 and may be using public network.