Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ To use, download and move the folder to your `Arduino/libraries` location, and r

= API =

* `init(channels)` Starts the DMX library with Serial1. If no channels are given, defaults to 32.
* `init(channels, outputPin)` Starts the DMX library with Serial1. If no channels are given, defaults to 32. Optional outputPin, defaults Pin 2. If
* `write(channel, value)` Writes a value to DMX buffer.
* `update()` Calls for the DMX buffer to be sent. Currently, it has to be called inside the main loop.
* `end()` Ends ESPDMX controller.
Expand Down
16 changes: 16 additions & 0 deletions src/ESPDMX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,22 @@ void DMXESPSerial::init(int chanQuant) {
dmxStarted = true;
}

// Set up the DMX-Protocol
void DMXESPSerial::init(int chanQuant, int outputPin) {

sendPin = outputPin;

if (chanQuant > dmxMaxChannel || chanQuant <= 0) {
chanQuant = defaultMax;
}

chanSize = chanQuant;

Serial1.begin(DMXSPEED);
pinMode(sendPin, OUTPUT);
dmxStarted = true;
}

// Function to read DMX data
uint8_t DMXESPSerial::read(int Channel) {
if (dmxStarted == false) init();
Expand Down
1 change: 1 addition & 0 deletions src/ESPDMX.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class DMXESPSerial {
public:
void init();
void init(int MaxChan);
void init(int MaxChan, int outputPin);
uint8_t read(int Channel);
void write(int channel, uint8_t value);
void update();
Expand Down