Here are my scripts:
Master;
/*
Tell DCS-BIOS this is a RS-485 Master.
You will need to flash this to a Mega 2560.
*/
#define DCSBIOS_RS485_MASTER
/*
Define where the TX_ENABLE signals are connected.
You can connect up to three half-duplex RS-485 transceivers.
Arduino Pin RS-485 Transceiver Pin
TXn ------------------- DI (driver input)
RXn ------------------- RO (Receiver Output)
UARTn_TXENABLE_PIN ---- /RE, DE (active low receiver enable, driver enable)
If you have less than three transceivers connected, comment out the corresponding
#define UARTn_TEXENABLE_PIN lines for receivers that are not present.
*/
#define UART1_TXENABLE_PIN 2
#include "DcsBios.h"
void setup() {
DcsBios::setup();
}
void loop() {
DcsBios::loop();
}
Slave;
/*
The following #define tells DCS-BIOS that this is a RS-485 slave device.
It also sets the address of this slave device. The slave address should be
between 1 and 126 and must be unique among all devices on the same bus.
*/
#define DCSBIOS_RS485_SLAVE 1
/*
The Arduino pin that is connected to the
/RE and DE pins on the RS-485 transceiver.
*/
#define TXENABLE_PIN 2
#include "DcsBios.h"
/* paste code snippets from the reference documentation here */
DcsBios::Switch2Pos pltHudDeclutter("PLT_HUD_DECLUTTER", 4);
DcsBios::LED pltWarnLadder(0x12dc, 0x8000, 13);
void setup() {
DcsBios::setup();
}
void loop() {
DcsBios::loop();
}