stevech:
If you don’t have skills in wireless data protocols, low level, then you’d be better off just buying a pair of IEEE 802.15.4 modules such as Digi/Maxstream XBee. Plug and play and you concentrate on the application program, not the low level communications.
i defently think i will in future just for what im trying to do i thaught hay thats cheap and its used with a attiny32 and then went and brought the wrong one :oops: anyway heres my code im trying to make go on it but its not…
byte config_setup[119];
int txdata = 3;
int txclk = 4;
int txdr = 5;
int txcs = 6;
int txce = 7;
int rxdata = 8;
int rxclk = 9;
int rxdr = 10;
int rxcs = 11;
int rxce = 12;
byte tx_address[5] = {'B1', 'B0', 'B0', 'B0', 'B1'};
byte data[5] = {'B1', 'B0', 'B0', 'B1', 'B1'};
int recievedata[10];
int counter;
int packet_number;
void setup(){
pinMode(txdata, OUTPUT);
pinMode(txclk, OUTPUT);
pinMode(txdr, INPUT);
pinMode(txcs, OUTPUT);
pinMode(txce, OUTPUT);
pinMode(rxdata, OUTPUT);
pinMode(rxclk, OUTPUT);
pinMode(rxdr, INPUT);
pinMode(rxcs, OUTPUT);
pinMode(rxce, OUTPUT);
Serial.begin(9600);
setconfig();
configtx();
configrx();
pinMode(txdata, OUTPUT);
pinMode(rxdata, INPUT);
digitalWrite(txce, HIGH);
digitalWrite(rxce, HIGH);
Serial.println("ready");
}
void loop() {
if(Serial.read() != -1){
Serial.println("transmitting");
transmit();
}
//if(rxdr == HIGH){
recieve();
printrecieved();
Serial.println();
Serial.print("done");
Serial.println();
//}
}
void printrecieved(){
Serial.println("recieved data:");
Serial.println();
for(int i =0; i<10; i++){
Serial.print(recievedata[i]);
}
Serial.println();
}
void recieve(){
pinMode(rxdata, INPUT);
for(int i = 0; i<10; i++){
recievedata[1] = 0;
}
for(int h = 0; h<10; h++){
recievedata[h] = digitalRead(rxdata);
}
}
void transmit(){
address();
senddata();
}
void address(){
pinMode(txdata, OUTPUT);
for(int i = 0; i<5 ; i++){
shiftOut(txdata, txclk, MSBFIRST, tx_address[i]);
delay(10);
}
}
void senddata(){
pinMode(txdata, OUTPUT);
for(int i = 0; i<5 ; i++){
shiftOut(txdata, txclk, MSBFIRST, data[i]);
delay(10);
}
}
void configtx(){
//Config Mode
pinMode(txdata, OUTPUT);
config_setup[0] = B0;
txce = LOW; rxcs = HIGH;
for(int i = 119; i>0 ; i--){
shiftOut(txdata, txclk, MSBFIRST, config_setup[i]);
delay(10);
}
//Configuration is actived on falling edge of CS (page 10)
txce = LOW; txcs = LOW;
}
void configrx(){
//Config Mode
pinMode(rxdata, OUTPUT);
config_setup[0] = B1;
rxce = LOW; rxcs = HIGH;
for(int i = 119; i>0 ; i--){
shiftOut(rxdata, rxclk, MSBFIRST, config_setup[i]);
delay(10);
}
//Configuration is actived on falling edge of CS (page 10)
rxce = LOW; rxcs = LOW;
}
void setconfig(){
config_setup[0] = B10;
config_setup[1] = B0;
config_setup[2] = B1;
config_setup[3] = B1;
config_setup[4] = B0;
config_setup[5] = B0;
config_setup[6] = B0;
config_setup[7] = B0;
config_setup[8] = B1;
config_setup[9] = B0;
config_setup[10] = B1;
config_setup[11] = B1;
config_setup[12] = B0;
config_setup[13] = B0;
config_setup[14] = B1;
config_setup[15] = B0;
//crc
config_setup[16] = B1;
config_setup[17] = B1;
//addr
config_setup[18] = B0;
config_setup[19] = B0;
config_setup[20] = B0;
config_setup[21] = B1;
config_setup[22] = B0;
config_setup[23] = B0;
//data1
config_setup[24] = B1;
config_setup[25] = B0;
config_setup[26] = B0;
config_setup[27] = B0;
config_setup[28] = B1;
config_setup[29] = B0;
config_setup[30] = B0;
config_setup[31] = B0;
config_setup[32] = B0;
config_setup[33] = B0;
config_setup[34] = B0;
config_setup[35] = B0;
config_setup[36] = B0;
config_setup[37] = B0;
config_setup[38] = B0;
config_setup[39] = B0;
config_setup[40] = B0;
config_setup[41] = B0;
config_setup[42] = B0;
config_setup[43] = B0;
config_setup[44] = B0;
config_setup[45] = B0;
config_setup[46] = B0;
config_setup[47] = B0;
config_setup[48] = B0;
config_setup[49] = B0;
config_setup[50] = B0;
config_setup[51] = B0;
config_setup[52] = B0;
config_setup[53] = B0;
config_setup[54] = B0;
config_setup[55] = B0;
config_setup[56] = B0;
config_setup[57] = B0;
config_setup[58] = B0;
config_setup[59] = B0;
config_setup[60] = B0;
config_setup[61] = B0;
config_setup[62] = B0;
config_setup[63] = B0;
//addr2
config_setup[64] = B0;
config_setup[65] = B0;
config_setup[66] = B0;
config_setup[67] = B1;
config_setup[68] = B0;
config_setup[69] = B0;
config_setup[70] = B1;
config_setup[71] = B1;
config_setup[72] = B0;
config_setup[73] = B0;
config_setup[74] = B0;
config_setup[75] = B0;
config_setup[76] = B0;
config_setup[77] = B0;
config_setup[78] = B0;
config_setup[79] = B0;
config_setup[80] = B0;
config_setup[81] = B0;
config_setup[82] = B0;
config_setup[83] = B0;
config_setup[84] = B0;
config_setup[85] = B0;
config_setup[86] = B0;
config_setup[87] = B0;
config_setup[88] = B0;
config_setup[89] = B0;
config_setup[90] = B0;
config_setup[91] = B0;
config_setup[92] = B0;
config_setup[93] = B0;
config_setup[94] = B0;
config_setup[95] = B0;
config_setup[96] = B0;
config_setup[97] = B0;
config_setup[98] = B0;
config_setup[99] = B0;
config_setup[100] = B0;
config_setup[101] = B0;
config_setup[102] = B0;
config_setup[103] = B0;
//data1
config_setup[104] = B1;
config_setup[105] = B0;
config_setup[106] = B1;
config_setup[107] = B0;
config_setup[108] = B0;
config_setup[109] = B0;
config_setup[110] = B0;
config_setup[111] = B0;
//data2
config_setup[112] = B0;
config_setup[113] = B0;
config_setup[114] = B0;
config_setup[115] = B0;
config_setup[116] = B0;
config_setup[117] = B0;
config_setup[118] = B0;
config_setup[119] = B0;
}
thanks for your reply please if anyone can help i truely appreciate it
thanks
callum