mathertel / DMXSerial

An Arduino library for sending and receiving DMX packets.
BSD 3-Clause "New" or "Revised" License
336 stars 79 forks source link

Arduino Uno Pin 2 Internal Pullup not working #74

Open Randomaker opened 1 year ago

Randomaker commented 1 year ago

Hello! I have discovered a bug with this library. It seems that on the Arduino Uno, the internal pullup resistor on pin 2 does not work when this library is being used. I will include a very simple sketch showing the problem below.

It sets pin 2 as an input with pullup. It then reads from that input, and directly outputs it to pin 13 (built in LED on Uno). When pin 2 is not connected to anything, the pullup should keep the pin high, meaning the LED should be ON unless pin 2 is tied to ground. However, it remains OFF unless you tie pin 2 to 5V.

If you comment out the initiation of this library, it works as expected.

Here is the sketch-

#include <DMXSerial.h>

bool inputValue;

void setup() {
  pinMode(2, INPUT_PULLUP);
  pinMode(13, OUTPUT);

  DMXSerial.init(DMXReceiver);
}

void loop() {

  digitalWrite(13, digitalRead(2));

}

I am working on a somewhat urgent project using this library, so I would appreciate it if someone could get back to me about this soon, but I understand this is community led, so I understand if it doesn't get fixed right away. Thanks a lot for making this library (and hopefully maintaining it), as it seems to be the only library for receiving DMX, and it works quite well other than this issue.

blockiindahood commented 1 year ago

Seems that pin 2 is used for some kind of data transition, don't really know, sorry :( https://github.com/mathertel/DMXSerial/blob/46745295694eda720361a18b21ac3d5cba6d872f/src/DMXSerial.h#L45