updated SerialTransceiver
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -8,27 +8,25 @@
|
|||||||
// include the library code:
|
// include the library code:
|
||||||
#include <SoftRS485.h>
|
#include <SoftRS485.h>
|
||||||
|
|
||||||
#define PROGRAM "RS485-Nano Rev 2.0 / Transceiver 1.0"
|
|
||||||
|
|
||||||
#define Max485_RO 3 // read-output of Max485
|
#define Max485_RO 3 // read-output of Max485
|
||||||
#define Max485_RE 5 // not-read-enable of Max485
|
#define Max485_RE 5 // not-read-enable of Max485
|
||||||
#define Max485_DE 9 // data enable of Max485
|
#define Max485_DE 9 // data enable of Max485
|
||||||
#define Max485_DI 8 // data input of Max485
|
#define Max485_DI 8 // data input of Max485
|
||||||
|
|
||||||
String message = "";
|
#define PROGRAM "{hw:RS485-Nano rev 2.0,firmware:Transceiver,version:1.0}"
|
||||||
|
|
||||||
|
String message = "";
|
||||||
|
char c;
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
init485(Max485_RO,Max485_RE,Max485_DE,Max485_DI); // library initialization:
|
init485(Max485_RO,Max485_RE,Max485_DE,Max485_DI); // library initialization:
|
||||||
|
send485(PROGRAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
if (available485()) {
|
if (available485()) Serial.println(get485message());
|
||||||
Serial.println(get485message());
|
|
||||||
}
|
|
||||||
if (Serial.available()) {
|
if (Serial.available()) {
|
||||||
// get the new byte:
|
c = (char)Serial.read();
|
||||||
char c = (char)Serial.read();
|
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
send485(message.c_str());
|
send485(message.c_str());
|
||||||
message = "";
|
message = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user