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
Hi
I have been working on a dishwasher controller that needs two RS485 connected board to communicate. The slave board reads data from the buttons and displays data sent from the master. The master elaborates button inputs and sends data to display
My issue is that the display board does not send any data with the sendDatum() operation, and I can't seem to figure out why. I have tried basic communication between the two boards with just the sendDatum() and rxObj() but other than that it doesn't work. Can hopefully someone help me out? Below you'll find the master and slave codes, thanks
Master's code:
#include"SerialTransfer.h"
#include<SoftwareSerial.h>// for software serial capabilityconst byte rxPin = 10;
const byte txPin = 11;
const byte enableTransmissionPin = 3;
SoftwareSerial swSerial = SoftwareSerial(rxPin, txPin);
SerialTransfer RS485;
const byte BUTTONS = 8;
struct__attribute__((packed)) structSentData {
byte hledstates; // prog, extradry, shine, hygiene, delay
byte vledstates; // cycle running, end of cycle, salt missing, rinse aid missingchar displayText[4]; // 4 due to null termination character
} dataToSend;
struct__attribute__((packed)) structReceivedData {
bool btnstates[BUTTONS]; // prog, extradry, shine, hygiene, autoclean, delay, start, cancel
} dataReceived;
voidsetup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
pinMode(enableTransmissionPin, OUTPUT);
swSerial.begin(9600);
RS485.begin(swSerial);
digitalWrite(enableTransmissionPin, LOW);
}
int counter = 0;
voidloop() {
// put your main code here, to run repeatedly:digitalWrite(enableTransmissionPin, LOW);
if (RS485.available()) {
Serial.print("a");
RS485.rxObj(dataReceived);
}
digitalWrite(enableTransmissionPin, HIGH); // metti questo subito dopo la ricezione per evitare STALE_ERROR
dataToSend.vledstates = B10100000;
RS485.txObj(dataToSend, sizeof(dataToSend));
RS485.sendData(sizeof(dataToSend));
delay(50);
}
You might have better luck having a delay in the main loop of the slave code. Beyond that, I would say strip down your code as much as possible and test with ever slightly more complexity until things break. Then debug from there.
Hi
I have been working on a dishwasher controller that needs two RS485 connected board to communicate. The slave board reads data from the buttons and displays data sent from the master. The master elaborates button inputs and sends data to display
My issue is that the display board does not send any data with the sendDatum() operation, and I can't seem to figure out why. I have tried basic communication between the two boards with just the sendDatum() and rxObj() but other than that it doesn't work. Can hopefully someone help me out? Below you'll find the master and slave codes, thanks
Master's code:
Slave's code:
The text was updated successfully, but these errors were encountered: