You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using this library with my two Arduinos, the controller (arduino nano) and an airplane. (arduino mega)
I'm using NeoSWSerial on the controller, and the Serial1 on the airplane. Now I'm using the HC-12 to communicate between these two devices (with echo, so airplane => controller => airplane => controller) while always sending new messages if nothing has been received for the last 5 seconds.
The HC-12 has an baud rate of 9600 configured on default, but to increase range, I have to lower it, after configuring everything correctly, I just cant get it to work with a baud rate of 4800 and lower (so everything below 9600), while 9600 works like a charm.
I tried it with a basic example without PacketSerial, and it works, so there has to be a bug or something like that.
Expected Behavior
Current Behavior
Possible Solution
Steps to Reproduce (for bugs)
CONTROLLER
void onPacketReceived(const uint8_t* buffer, size_t size) {
if (size == sizeof(sensors)) {
/** Update controls **/
memcpy(&sensors, buffer, size);
last_sensor_update = millis();
/** Send current telemetry back **/
HC12.send((uint8_t *)&controls, sizeof(controls));
last_control_broadcast = millis();
print_all_data();
}
}
void setup() {
Serial.begin(9600); // Serial port to computer
HC12neo.begin(4800); // Serial port to HC12
HC12.setStream(&HC12neo);
HC12.setPacketHandler(&onPacketReceived);
}
void loop() {
update_control_data();
HC12.update();
if (millis() - last_control_broadcast > 5000) {
HC12.send((uint8_t *)&controls, sizeof(controls));
last_control_broadcast = millis();
Serial.println("send");
}
}
I'm using this library with my two Arduinos, the controller (arduino nano) and an airplane. (arduino mega)
I'm using NeoSWSerial on the controller, and the Serial1 on the airplane. Now I'm using the HC-12 to communicate between these two devices (with echo, so airplane => controller => airplane => controller) while always sending new messages if nothing has been received for the last 5 seconds.
The HC-12 has an baud rate of 9600 configured on default, but to increase range, I have to lower it, after configuring everything correctly, I just cant get it to work with a baud rate of 4800 and lower (so everything below 9600), while 9600 works like a charm.
I tried it with a basic example without PacketSerial, and it works, so there has to be a bug or something like that.
Expected Behavior
Current Behavior
Possible Solution
Steps to Reproduce (for bugs)
CONTROLLER
AIRPLANE
The text was updated successfully, but these errors were encountered: