I have use the sample code from ELECHOUSE and modify myself to make two cc1101 RF module with the help of Arduino uno can communication each other. this is the code part
Transmit part:
#include <ELECHOUSE_CC1101.h>
#define size 4
byte TX_buffer[4]={'C','H','E','N'};
byte i;
void setup()
{
Serial.begin(9600);
ELECHOUSE_cc1101.Init();
}
void loop()
{
ELECHOUSE_cc1101.SendData(TX_buffer,4);
delay(2000);
}
Receive part:
#include <ELECHOUSE_CC1101.h>
void setup()
{
Serial.begin(9600);
ELECHOUSE_cc1101.Init();
ELECHOUSE_cc1101.SetReceive();
}
byte RX_buffer[4]={0};
byte size,i,flag;
void loop()
{
if(ELECHOUSE_cc1101.CheckReceiveFlag())
{
size=ELECHOUSE_cc1101.ReceiveData(RX_buffer);
for(i=0;i<size;i++)
{
Serial.print(RX_buffer[i]);
}
Serial.println("");
ELECHOUSE_cc1101.SetReceive();
}
}
But I think it is because of the problem of the library problem, when I send out CHEN, the receive direct convert to ASCII form, how can I convert the byte to the string and make me can receive the words not the number? thanks a lot
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.