Skip to content
Snippets Groups Projects
Commit a7b1e1bb authored by Benjamin Koch's avatar Benjamin Koch
Browse files

test RS485

parent e6bde50b
No related branches found
No related tags found
No related merge requests found
......@@ -75,12 +75,16 @@ void setup() {
pinMode(MATRIX_IN1, INPUT_PULLUP);
pinMode(MATRIX_IN3, INPUT_PULLUP);
pinMode(TX_EN, OUTPUT);
digitalWrite(TX_EN, LOW);
Serial1.setTX(TX); // UART0
Serial1.setRX(RX);
Wire.setSDA(I2C_OLED_SDA); // I2C0
Wire.setSCL(I2C_OLED_SCL);
Serial.begin(9600); // USB serial, baudrate is ignored
Serial1.begin(115200);
Wire.begin();
Wire.setClock(100000);
......@@ -490,5 +494,26 @@ void loop() {
pixelsDisplay.show();
}
static int rs485_timer = 0;
static int rs485_state = 0;
if ((rs485_timer < 10 || !pixelsDisplay.canShow()) && 0) {
rs485_timer++;
} else {
rs485_timer = 0;
rs485_state += 1;
if (0) {
digitalWrite(TX_EN, HIGH);
Serial1.print("Test ");
Serial1.println(rs485_state);
} else {
digitalWrite(TX_EN, LOW);
}
}
if (Serial1.available()) {
Serial.print("RX: ");
Serial.println(Serial1.read());
}
delay(1);
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment