Go Down

Topic: Setting parameters for APC220 in software (Read 118 times) previous topic - next topic

Zedon

I have been using 2 APC220 modules each wired to an arduino nano.
I have set the frequency, baud rate etc using the app RF_Magic. It can be made to work, but must use COM 1 and that can be a problem. So I have been trying to set the parameters from the arduino nano.

Below are the functions that set parameters and read parameters.
The getSettings function works fine and returns the parameters set by RF-Magic correctly, but the setSettings function does not work.
Has anyone had any success setting parameters using the arduino software?

#include <SoftwareSerial.h>
 
const int pinRX = 12;
const int pinTX = 11;
const int pinSET = 10;
const int LEDpin = 13;
int count = 0;
 
SoftwareSerial apc220(pinRX, pinTX); // Crt softserial port set tx/rx to appropriate PINS
 
void setupSoftAPC(void){
pinMode(pinSET, OUTPUT);
pinMode(LEDpin, OUTPUT);
apc220.begin(9600);
}
 

void setSettings(void){
digitalWrite(pinSET, LOW); // pulling SET to low will put apc220 in config mode
delay(10); // allow to stabilise
apc220.println("WR 44400 3 9 3 0"); // send data to set APC frequency etc
// this sets frequency to 444MHz, RF data rate to 9600 baud, output power to maximum,
//UART rate to 9600 baud, and parity to no parity ckeck.
delay(10);

while (apc220.available()) {
Serial.write(apc220.read());
}
digitalWrite(pinSET, HIGH); // put apc220 back in operation
delay(200);
}

void getSettings(void) {
digitalWrite(pinSET, LOW); // pulling SET to low will put apc220 in config mode
delay(10); // stabilize please
apc220.println("RD"); // ask for data
delay(100);
 
while (apc220.available()) {
Serial.write(apc220.read());
}
digitalWrite(pinSET, HIGH); // put apc220 back in operation
delay(200);
}
 
void setup(){
digitalWrite(pinSET, HIGH);
Serial.begin(9600);
setupSoftAPC();
setSettings();
getSettings();
}

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy