[CC1101] Fixed typos in examples

This commit is contained in:
jgromes 2019-05-24 13:58:49 +02:00
parent 6a4634fbb2
commit 5378106866
5 changed files with 43 additions and 44 deletions

View file

@ -1,7 +1,7 @@
/* /*
RadioLib CC1101 Receive Example RadioLib CC1101 Receive Example
This example receives packets using CC1101 FSK radio This example receives packets using CC1101 FSK radio
module. module.
*/ */
@ -52,15 +52,15 @@ void loop() {
Serial.print(F("[CC1101] Data:\t\t")); Serial.print(F("[CC1101] Data:\t\t"));
Serial.println(str); Serial.println(str);
// print RSSI (Received Signal Strength Indicator) // print RSSI (Received Signal Strength Indicator)
// of the last received packet // of the last received packet
Serial.print("[CC1101] RSSI:\t\t"); Serial.print(F("[CC1101] RSSI:\t\t"));
Serial.print(cc.getRSSI()); Serial.print(cc.getRSSI());
Serial.println(" dBm"); Serial.println(F(" dBm"));
// print LQI (Link Quality Indicator) // print LQI (Link Quality Indicator)
// of the last received packet, lower is better // of the last received packet, lower is better
Serial.print("[CC1101] LQI:\t\t"); Serial.print(F("[CC1101] LQI:\t\t"));
Serial.println(cc.getLQI()); Serial.println(cc.getLQI());
} else if (state == ERR_CRC_MISMATCH) { } else if (state == ERR_CRC_MISMATCH) {

View file

@ -1,8 +1,8 @@
/* /*
RadioLib CC1101 Receive with Address Example RadioLib CC1101 Receive with Address Example
This example receives packets using CC1101 FSK radio This example receives packets using CC1101 FSK radio
module. Packets can have 1-byte address of the module. Packets can have 1-byte address of the
destination node. After setting node address, this node destination node. After setting node address, this node
will automatically filter out any packets that do not will automatically filter out any packets that do not
contain either node address or broadcast addresses. contain either node address or broadcast addresses.
@ -16,7 +16,7 @@ CC1101 cc = RadioShield.ModuleA;
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// initialize CC1101 with default settings // initialize CC1101 with default settings
Serial.print(F("[CC1101] Initializing ... ")); Serial.print(F("[CC1101] Initializing ... "));
// carrier frequency: 868.0 MHz // carrier frequency: 868.0 MHz
@ -34,10 +34,10 @@ void setup() {
} }
// set node address // set node address
// NOTE: Calling this method will autmatically enable // NOTE: Calling this method will automatically enable
// address filtering. CC1101 also allows to set // address filtering. CC1101 also allows to set
// number of broadcast address (0/1/2). // number of broadcast address (0/1/2).
// The following sets one brodcast address 0x00. // The following sets one broadcast address 0x00.
// When setting two broadcast addresses, 0x00 and // When setting two broadcast addresses, 0x00 and
// 0xFF will be used. // 0xFF will be used.
Serial.print(F("[CC1101] Setting node address ... ")); Serial.print(F("[CC1101] Setting node address ... "));
@ -51,7 +51,7 @@ void setup() {
} }
// address filtering can also be disabled // address filtering can also be disabled
// NOTE: Calling this method will also erase previously // NOTE: Calling this method will also erase previously
// set node address // set node address
/* /*
Serial.print(F("[CC1101] Disabling address filtering ... ")); Serial.print(F("[CC1101] Disabling address filtering ... "));
@ -87,15 +87,15 @@ void loop() {
Serial.print(F("[CC1101] Data:\t\t")); Serial.print(F("[CC1101] Data:\t\t"));
Serial.println(str); Serial.println(str);
// print RSSI (Received Signal Strength Indicator) // print RSSI (Received Signal Strength Indicator)
// of the last received packet // of the last received packet
Serial.print("[CC1101] RSSI:\t\t"); Serial.print(F("[CC1101] RSSI:\t\t"));
Serial.print(cc.getRSSI()); Serial.print(cc.getRSSI());
Serial.println(" dBm"); Serial.println(F(" dBm"));
// print LQI (Link Quality Indicator) // print LQI (Link Quality Indicator)
// of the last received packet, lower is better // of the last received packet, lower is better
Serial.print("[CC1101] LQI:\t\t"); Serial.print(F("[CC1101] LQI:\t\t"));
Serial.println(cc.getLQI()); Serial.println(cc.getLQI());
} else if (state == ERR_CRC_MISMATCH) { } else if (state == ERR_CRC_MISMATCH) {

View file

@ -14,7 +14,7 @@ CC1101 cc = RadioShield.ModuleA;
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// initialize CC1101 with default settings // initialize CC1101 with default settings
Serial.print(F("[CC1101] Initializing ... ")); Serial.print(F("[CC1101] Initializing ... "));
// carrier frequency: 868.0 MHz // carrier frequency: 868.0 MHz
@ -30,11 +30,11 @@ void setup() {
Serial.println(state); Serial.println(state);
while (true); while (true);
} }
// set the function that will be called // set the function that will be called
// when new packet is received // when new packet is received
cc.setGdo0Action(setFlag); cc.setGdo0Action(setFlag);
// start listening for packets // start listening for packets
Serial.print(F("[CC1101] Starting to listen ... ")); Serial.print(F("[CC1101] Starting to listen ... "));
state = cc.startReceive(); state = cc.startReceive();
@ -53,7 +53,6 @@ void setup() {
// cc.sleep() // cc.sleep()
// cc.transmit(); // cc.transmit();
// cc.receive(); // cc.receive();
// cc.scanChannel();
} }
// flag to indicate that a packet was received // flag to indicate that a packet was received
@ -85,34 +84,34 @@ void loop() {
// reset flag // reset flag
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.receive(byteArr, 8); int state = cc.receive(byteArr, 8);
*/ */
if (state == ERR_NONE) { if (state == ERR_NONE) {
// packet was successfully received // packet was successfully received
Serial.println("[CC1101] Received packet!"); Serial.println(F("[CC1101] Received packet!"));
// print data of the packet // print data of the packet
Serial.print("[CC1101] Data:\t\t"); Serial.print(F("[CC1101] Data:\t\t"));
Serial.println(str); Serial.println(str);
// print RSSI (Received Signal Strength Indicator) // print RSSI (Received Signal Strength Indicator)
// of the last received packet // of the last received packet
Serial.print("[CC1101] RSSI:\t\t"); Serial.print(F("[CC1101] RSSI:\t\t"));
Serial.print(cc.getRSSI()); Serial.print(cc.getRSSI());
Serial.println(" dBm"); Serial.println(F(" dBm"));
// print LQI (Link Quality Indicator) // print LQI (Link Quality Indicator)
// of the last received packet, lower is better // of the last received packet, lower is better
Serial.print("[CC1101] LQI:\t\t"); Serial.print(F("[CC1101] LQI:\t\t"));
Serial.println(cc.getLQI()); Serial.println(cc.getLQI());
} }

View file

@ -44,11 +44,11 @@ void loop() {
if (state == ERR_NONE) { if (state == ERR_NONE) {
// the packet was successfully transmitted // the packet was successfully transmitted
Serial.println(" success!"); Serial.println(F(" success!"));
} else if (state == ERR_PACKET_TOO_LONG) { } else if (state == ERR_PACKET_TOO_LONG) {
// the supplied packet was longer than 255 bytes // the supplied packet was longer than 255 bytes
Serial.println(" too long!"); Serial.println(F(" too long!"));
} }

View file

@ -1,8 +1,8 @@
/* /*
RadioLib CC1101 Transmit to Address Example RadioLib CC1101 Transmit to Address Example
This example transmits packets using CC1101 FSK radio This example transmits packets using CC1101 FSK radio
module. Packets can have 1-byte address of the module. Packets can have 1-byte address of the
destination node. After setting node address, this node destination node. After setting node address, this node
will automatically filter out any packets that do not will automatically filter out any packets that do not
contain either node address or broadcast addresses. contain either node address or broadcast addresses.
@ -16,7 +16,7 @@ CC1101 cc = RadioShield.ModuleA;
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// initialize CC1101 with default settings // initialize CC1101 with default settings
Serial.print(F("[CC1101] Initializing ... ")); Serial.print(F("[CC1101] Initializing ... "));
// carrier frequency: 868.0 MHz // carrier frequency: 868.0 MHz
@ -34,10 +34,10 @@ void setup() {
} }
// set node address // set node address
// NOTE: Calling this method will autmatically enable // NOTE: Calling this method will automatically enable
// address filtering. CC1101 also allows to set // address filtering. CC1101 also allows to set
// number of broadcast address (0/1/2). // number of broadcast address (0/1/2).
// The following sets one brodcast address 0x00. // The following sets one broadcast address 0x00.
// When setting two broadcast addresses, 0x00 and // When setting two broadcast addresses, 0x00 and
// 0xFF will be used. // 0xFF will be used.
Serial.print(F("[CC1101] Setting node address ... ")); Serial.print(F("[CC1101] Setting node address ... "));
@ -51,7 +51,7 @@ void setup() {
} }
// address filtering can also be disabled // address filtering can also be disabled
// NOTE: Calling this method will also erase previously // NOTE: Calling this method will also erase previously
// set node address // set node address
/* /*
Serial.print(F("[CC1101] Disabling address filtering ... ")); Serial.print(F("[CC1101] Disabling address filtering ... "));
@ -80,11 +80,11 @@ void loop() {
if (state == ERR_NONE) { if (state == ERR_NONE) {
// the packet was successfully transmitted // the packet was successfully transmitted
Serial.println(" success!"); Serial.println(F(" success!"));
} else if (state == ERR_PACKET_TOO_LONG) { } else if (state == ERR_PACKET_TOO_LONG) {
// the supplied packet was longer than 255 bytes // the supplied packet was longer than 255 bytes
Serial.println(" too long!"); Serial.println(F(" too long!"));
} }