From a089452e0fc31808a65bca854e518e4046ab20bd Mon Sep 17 00:00:00 2001 From: jgromes Date: Tue, 14 Apr 2020 15:01:19 +0200 Subject: [PATCH] [CC1101] Fixed example --- .../CC1101_Receive_Interrupt.ino | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/examples/CC1101/CC1101_Receive_Interrupt/CC1101_Receive_Interrupt.ino b/examples/CC1101/CC1101_Receive_Interrupt/CC1101_Receive_Interrupt.ino index b57c4102..e036d71e 100644 --- a/examples/CC1101/CC1101_Receive_Interrupt/CC1101_Receive_Interrupt.ino +++ b/examples/CC1101/CC1101_Receive_Interrupt/CC1101_Receive_Interrupt.ino @@ -24,7 +24,7 @@ // GDO0 pin: 2 // RST pin: unused // GDO2 pin: 3 (optional) -CC1101 cc = new Module(5, 2, RADIOLIB_NC, 3); +CC1101 cc = new Module(10, 2, RADIOLIB_NC, 3); // or using RadioShield // https://github.com/jgromes/RadioShield @@ -105,25 +105,22 @@ void loop() { receivedFlag = false; // you can read received data as an Arduino String - //String str; - //int state = cc.readData(str); + String str; + int state = cc.readData(str); // you can also read received data as byte array - + /* byte byteArr[8]; int state = cc.readData(byteArr, 8); - + */ if (state == ERR_NONE) { // packet was successfully received Serial.println(F("[CC1101] Received packet!")); // print data of the packet - Serial.println(F("[CC1101] Data:\t\t")); - //Serial.println(str); - for(uint8_t i = 0; i < 8; i++) { - Serial.println(byteArr[i], HEX); - } + Serial.print(F("[CC1101] Data:\t\t")); + Serial.println(str); // print RSSI (Received Signal Strength Indicator) // of the last received packet