Hi, first of all sorry for my English! I will try my best to explain my problem. I am very new in this world and I have no much idea.
I was using an Arduino NANO and the CC1101 v1 (10 connections) to control a servo at almost 100m of distance with the actuation of a RF remote control (433MHz).
With CC1101 v1 chip I have no problem. I attached the connections and also the program (I found it in Internet). It works Ok.
#include <ELECHOUSE_CC1101_SRC_DRV.h>
#include <RCSwitch.h>
int pin; // int for Receive pin.
RCSwitch mySwitch = RCSwitch();
#include <Servo.h>
Servo miservo;
int PINSERVO = 5; // Pin D5 del arduino nano, que controlará el servo
//int PULSOMIN = 1000; // Un ancho de pulso de 1ms (1000microsegundos) equivale a 0 grados
//int PULSOMAX = 2000; // Un ancho de pulso de 2ms equivale a 180 grados
// // Un ancho de pulso de 1.5ms equivale a 90 grados
void setup() {
miservo.attach (PINSERVO);//, PULSOMIN, PULSOMAX);
miservo.write (0);
Serial.begin(9600);
#ifdef ESP32
pin = 4; // for esp32! Receiver on GPIO pin 4.
#elif ESP8266
pin = 4; // for esp8266! Receiver on pin 4 = D2.
#else
pin = 0; // for Arduino! Receiver on interrupt 0 => that is pin #2
#endif
if (ELECHOUSE_cc1101.getCC1101()){ // Check the CC1101 Spi connection.
Serial.println("Connection OK");
}else{
Serial.println("Connection Error");
}
//CC1101 Settings: (Settings with "//" are optional!)
ELECHOUSE_cc1101.Init(); // must be set to initialize the cc1101!
//ELECHOUSE_cc1101.setRxBW(812.50); // Set the Receive Bandwidth in kHz. Value from 58.03 to 812.50. Default is 812.50 kHz.
//ELECHOUSE_cc1101.setPA(10); // set TxPower. The following settings are possible depending on the frequency band. (-30 -20 -15 -10 -6 0 5 7 10 11 12) Default is max!
ELECHOUSE_cc1101.setMHZ(433.92); // Here you can set your basic frequency. The lib calculates the frequency automatically (default = 433.92).The cc1101 can: 300-348 MHZ, 387-464MHZ and 779-928MHZ. Read More info from datasheet.
mySwitch.enableReceive(pin); // Receiver on
ELECHOUSE_cc1101.SetRx(); // set Receive on
}
void loop() {
miservo.write (0);
delay (1000);
if (mySwitch.available()){
long int value = mySwitch.getReceivedValue();
if (value ==0) {
Serial.print("error de codigo");
} else {
Serial.print("Codigo Recibido ");
Serial.print(value);
Serial.print( mySwitch.getReceivedValue() );
/////compara dato recibido (esto se repetirá por cada uno de los datos que manda cada uno de los botones del mando
if (value == 16736113) { //debemos poner el codigo de nuestro mando
miservo.write (180);
Serial.println ("servo on");
delay (1000);
miservo.write (0);
delay (1000);
//////////
Serial.print(" / ");
Serial.print( mySwitch.getReceivedBitlength() );
Serial.print("bit ");
Serial.print("Protocol: ");
Serial.println( mySwitch.getReceivedProtocol() );
}
mySwitch.resetAvailable();
}
}
}
The problem is the CC1101 v1 is not more available in the Market. Now I have the CC1101 v2 (E07-M1101D) with only 8 connectors.
I have reconnected all with the new board and use the same program but it is seemed that something is not working. It is like the are no communication. I do not know if I must configure the new board CC1101 v2
The failure message is:
I have tried to find something in Internet in order to solve it but I am not able to find nothing,.
I will be pleased if someone could help me.
Thanks in advance and regards from Spain