Loading...
Loading...
// DCC signal detection (simplified)
#include <NmraDcc.h>
NmraDcc Dcc;
const int OUTPUT1 = 3;
const int OUTPUT2 = 4;
uint16_t myAddress = 1;
void notifyDccAccTurnoutOutput(uint16_t Addr,
uint8_t Direction, uint8_t OutputPower) {
if (Addr == myAddress) {
digitalWrite(OUTPUT1, Direction ? HIGH : LOW);
digitalWrite(OUTPUT2, Direction ? LOW : HIGH);
}
}
void setup() {
Dcc.init(MAN_ID_DIY, 10, 0, 0);
pinMode(OUTPUT1, OUTPUT);
pinMode(OUTPUT2, OUTPUT);
}
void loop() {
Dcc.process();
}This is starter code - modify and expand for your specific needs.
Before building this project, make sure you have the Arduino IDE installed and are comfortable uploading basic sketches to your board.
Most projects use standard Arduino libraries. Some may require additional libraries like AccelStepper, Servo, or NmraDcc - install these through the Arduino Library Manager.