[CC1101] Fixed example
This commit is contained in:
parent
976cd8734c
commit
a089452e0f
1 changed files with 7 additions and 10 deletions
|
@ -24,7 +24,7 @@
|
||||||
// GDO0 pin: 2
|
// GDO0 pin: 2
|
||||||
// RST pin: unused
|
// RST pin: unused
|
||||||
// GDO2 pin: 3 (optional)
|
// 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
|
// or using RadioShield
|
||||||
// https://github.com/jgromes/RadioShield
|
// https://github.com/jgromes/RadioShield
|
||||||
|
@ -105,25 +105,22 @@ void loop() {
|
||||||
receivedFlag = false;
|
receivedFlag = false;
|
||||||
|
|
||||||
// you can read received data as an Arduino String
|
// you can read received data as an Arduino String
|
||||||
//String str;
|
String str;
|
||||||
//int state = cc.readData(str);
|
int state = cc.readData(str);
|
||||||
|
|
||||||
// you can also read received data as byte array
|
// you can also read received data as byte array
|
||||||
|
/*
|
||||||
byte byteArr[8];
|
byte byteArr[8];
|
||||||
int state = cc.readData(byteArr, 8);
|
int state = cc.readData(byteArr, 8);
|
||||||
|
*/
|
||||||
|
|
||||||
if (state == ERR_NONE) {
|
if (state == ERR_NONE) {
|
||||||
// packet was successfully received
|
// packet was successfully received
|
||||||
Serial.println(F("[CC1101] Received packet!"));
|
Serial.println(F("[CC1101] Received packet!"));
|
||||||
|
|
||||||
// print data of the packet
|
// print data of the packet
|
||||||
Serial.println(F("[CC1101] Data:\t\t"));
|
Serial.print(F("[CC1101] Data:\t\t"));
|
||||||
//Serial.println(str);
|
Serial.println(str);
|
||||||
for(uint8_t i = 0; i < 8; i++) {
|
|
||||||
Serial.println(byteArr[i], HEX);
|
|
||||||
}
|
|
||||||
|
|
||||||
// print RSSI (Received Signal Strength Indicator)
|
// print RSSI (Received Signal Strength Indicator)
|
||||||
// of the last received packet
|
// of the last received packet
|
||||||
|
|
Loading…
Add table
Reference in a new issue