GithubHelp home page GithubHelp logo

mathertel / dmxserial Goto Github PK

View Code? Open in Web Editor NEW
323.0 323.0 78.0 73 KB

An Arduino library for sending and receiving DMX packets.

License: BSD 3-Clause "New" or "Revised" License

C++ 58.22% C 41.78%
arduino arduino-library dmx dmx512

dmxserial's Introduction

dmxserial's People

Contributors

2bbb avatar mathertel avatar matthijskooijman avatar xpmodder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dmxserial's Issues

Possible to use USB Serial communication?

Hi, I'm currently gathering the parts needed for the DMX shield you've put together on your website and I was wondering if it is still possible to use the Serial-Interface along with this library. I need to send commands from the PC to the Arduino.

Thanks in advance!

DMX512 format

DMX512 frame format should be SERIAL_8N2 ( with 2 stop bits ).

Receiving problem

I'm trying to light up red, green and blue leds using two arduinos

I can send the proper DMX signal but i cant receive.

Here is the sender arduino's code;

#include <DMXSerial.h>

void setup() {
 
  DMXSerial.init(DMXController,2);
  DMXSerial.maxChannel(3);
  
}

void loop() {
  DMXSerial.write(1, 255);
  DMXSerial.write(2, 0);
  DMXSerial.write(3, 255);  

}

and the receiver arduino;

#include <DMXSerial.h>

const int RedPin =    9;  // PWM output pin for Red Light.
const int GreenPin =  6;  // PWM output pin for Green Light.
const int BluePin =   5;  // PWM output pin for Blue Light.

void setup() {

  DMXSerial.init(DMXReceiver,2);
  DMXSerial.maxChannel(3);
  
  pinMode(RedPin,   OUTPUT); // sets the digital pin as output
  pinMode(GreenPin, OUTPUT);
  pinMode(BluePin,  OUTPUT); 
}

void loop() {
  unsigned long lastPacket = DMXSerial.noDataSince();  

 if (lastPacket < 1000) {   
      analogWrite(RedPin, DMXSerial.read(1));
      analogWrite(GreenPin, DMXSerial.read(2));
      analogWrite(BluePin, DMXSerial.read(3));   
    }
      
else{
  analogWrite(RedPin,255);
    }

}

 

Here is my proteus design;

1

Is there a problem with my code or is this a simulation problem ?

More help

There should be more help within the readme about core files that need to be edited and where to connect your dmx output from a transceiver

multiple definition of `__vector_19'

Very often, when I try to compile the library, I got this kind of error.

**HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':

(.text+0x0): multiple definition of __vector_18' libraries/DMXSerial-master/DMXSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here HardwareSerial0.cpp.o (symbol from plugin): In function Serial':
(.text+0x0): multiple definition of `__vector_19'
libraries/DMXSerial-master/DMXSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status**

not working with a nano

I tried the library on an arduino nano 5v with the dmx receiver example code.
When there is DMX data the RX led blinks up but the arduino doesn't process the packets.
The pwm outputs stay at the predefined level of 80,0,0 .
When I use a scope on the RX pin of the arduino I see the DMX data stream coming in and changing when I move a fader on the controller.

Is there a compatibility issue with the arduino nano?

Kinds regards,
Ego

RC oscillator 8Mhz support

Just asking, as per title, (with good manual freq. calibration) would it be possible to support no crystall operation in reduced frequency?
Maybe there's still enough time to receive some dmx channels considering irq based apporach used in your lib.
BTW kudos

DMXSerial conflicts with i2c WIRE library?

Hey, I'm trying to get your DMX Serial library working alongside an i2c LCD library, but as soon as I #include DMXSerial.h, the LCD screen stops working. Any ideas? should the library interact with the wire library or analog in pins 4,5? thanks

DMX Tester which can send and recive DMX values

Hi,

I want to build a little DMX tester box. And I have some questions.

  1. I want to have a little LED turn on as soon as any DMX value is received. It should check all 512 addresses and as soon as it receives one value above 0 turns the LED on. Is this possible or do you have to specify the address it "listens" to?

  2. I also want to make use of the Send function to send a test signal. How would I fade every address to 255 and back? And can I simultaneously us the Rx bin for receiving and the Tx pin for sending at the same time?

  3. Are teensy 3.2 boards supported? and if not, an Arduino Leonardo should be fine, right?

Serial error with UNO

Dear,
I try to use your library with an arduino UNO but when i want to compile the example code i have some errors.

HardwareSerial0.cpp.o (symbol from plugin): In function Serial':
(.text+0x0): multiple definition of __vector_18' /var/folders/j2/rq93bv2x6lbg14z3qkwqfv580000gn/T/arduino_build_836542/libraries/DMXSerial-master/DMXSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here HardwareSerial0.cpp.o (symbol from plugin): In function Serial':
(.text+0x0): multiple definition of __vector_19' /var/folders/j2/rq93bv2x6lbg14z3qkwqfv580000gn/T/arduino_build_836542/libraries/DMXSerial-master/DMXSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here collect2: error: ld returned 1 exit status

Please, could you help me?

Version 1.5.0 in GitHub differs from version from Arduino IDE library manager 1.5.0.

Hello,

The version 1.5.0 in GitHub differs from the version from Arduino IDE library manager 1.5.0.
This is probably because there are some updates in GitHub without an updated version in the library.properties file.

I assume that GitHub is correct (latest) (the difference is in the initialisation of the stop bits in the files DMXSerial_avr.h and DMXSerial_megaavr.h).

Question: Why are bytes with one stop bit now accepted (DXM standard is two stop bits)?

Great library by the way!

Kind regards,
Johan.

DMXSerial.h with Arduino MEGA2560

You kindly directed me to your blog page. Unfortunately I do not know how to uncomment the line
#define DMX_USE_PORT1
I assume this is a line in DMXSerial.h
The Arduino IDE will not open .h files, only .ino and .pde files
Please tell me how to do this.

Get wrong channel on DMX receive mode

Hello Matthias,
thanks for that great library working very good for me but i have one small thing.
I have written an small code to create an multifunctional DMX Box.
I opened an task in mikrocontroller.net because sometime the channel 13 instead of channel 12 which is defined get been readed. https://www.mikrocontroller.net/topic/476080#5877510
There it seems that nobody can help me with this issue.
The constant flickering is removed by changing the LED libary to WS2801.
Hope you can help me.
Thanks a lot

Reducing memory usage of _dmxData

Hello,

Thank you very much for writing this library. I have been using DMXSerial very successfully for a couple of years with my home lighting controller:
https://github.com/njh/ihlc

We turn our home lighting on and off daily using your library!

I have been looking at extending it to be controlled via IPv6, using a library I wrote called EtherSia. Together the two libraries use up quite a lot of the Uno's RAM - and I get warnings in the IDE.

I am currently only using around 20 channels.

Have you thought of any way of changing the memory usage for the DMX data?

#define DMXSERIAL_MAX 512 // max. number of supported DMX data channels

uint8_t  _dmxData[DMXSERIAL_MAX+1];

Adding malloc() increases the programme memory size - and not sure dynamic memory management desirable. But I am not sure of a neat way of the sketch indicating how much static memory they would like to be allocated?

Thanks!

nick.

32 bit code

Would you consider merging a large patch to support non-AVR chips?

I regularly hear requests to port your library to Teensy 3.1. Already DMX transmit and receive code exists for Teensy 3.1, but not wrapped up in a nice library like yours.

So I'd like to ask, would you prefer to keep this very AVR specific (and non-AVR chips have their own libraries), or would you be open to merging fairly large contributions that duplicate quite a lot of the AVR specific stuff for non-AVR chips?

DMXSerial has conflict with SD library

I am trying to use the SD library (to read a file from an SD card) and DMXSerial together.
Unfortunately both seem to define the same interrupt - the compiler throws an error - even if I compile a totally empty project with just the two include statements.

My minimized test sketch:

#include <SD.h>
#include <DMXSerial.h>

void setup() {
// put your setup code here, to run once:

}

void loop() {
// put your main code here, to run repeatedly:

}

The error messages of the compiler:
Arduino: 1.8.5 (Windows 10), Board: "Arduino Ethernet"

HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':

(.text+0x0): multiple definition of `__vector_18'

libraries\DMXSerial-master\DMXSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here

HardwareSerial0.cpp.o (symbol from plugin): In function `Serial':

(.text+0x0): multiple definition of `__vector_19'

libraries\DMXSerial-master\DMXSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino Ethernet.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

noDataSince() overflow

typecasting the returned unsigned long shows that it returns an overflown unsigned long
it seems that the calculation in the function is interrupted and this is resulting to cause the substraction giving out a negative number, although im not really experienced.
Code is run on Arduino Micro

unsigned long dmx_last_packet;
void loop() {
	dmx_last_packet = DMXSerial.noDataSince();
	if(dmx_last_packet>2000) {
		count++;
		printf("\nADIOS:%i",count);
		printf("=%ld OR %lu",(long signed) dmx_last_packet,dmx_last_packet);

		if(count>100) {
			led_debug.setOnSingle();
			for(;;) {}
		}
	}
}

console output:


ADIOS:1=-217 OR 4294967079
ADIOS:2=-218 OR 4294967078

Send & Receive mode

Hello
I'm using DMXSerial in my project couple of years and thank you for your effort!
My controller receiving DMX signal and sending simultaneously
Unfortunately, that is not possible to use DMXSerial bi-directionally
That was a reason, why I'm using DMXSerial for receiving and DMXSimple for sending, that ti not efficient so much.
Is it possible to add possibility to operate DMX in 2-way mode (with different buffers, of course)? If will be possible to share one UART for this - it might be brilliant

multiple definition of __vector_25/26 issue when verifying for Mega 2560

Hi there,
I am currently working on a project that involves using DMX to control relays. For basic testing purposes i am using your DmxSniff example file, but when I go to verify it is returns the following error:

HardwareSerial0.cpp.o (symbol from plugin): In function 'Serial':

(.text+0x0): multiple definition of __vector_25

C:\Users\Lachl\AppData\Local\Temp\arduino_build_97838\libraries\DMXSerial\DMXSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here

c:/program files/windowsapps/arduinollc.arduinoide_1.8.33.0_x86__mdqgnx93n4wtt/hardware/tools/avr/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions

HardwareSerial0.cpp.o (symbol from plugin): In function Serial':

(.text+0x0): multiple definition of '__vector_26'

C:\Users\Lachl\AppData\Local\Temp\arduino_build_97838\libraries\DMXSerial\DMXSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

Using library DMXSerial at version 1.5.0 in folder: E:\Docs\Arduino\libraries\DMXSerial exit status 1
Error compiling for board Arduino Mega or Mega 2560.

P.S, I don't have a large amount of programming knowledge in Arduino, I'm a Production Technician for the professional sound and lighting industry and I'm just trying something new.

Cheers!

DMXSerial not working with no 512 DMX devices

Hello
The library does not work with some lighting desks who doesn't send 512 channels
for example : the starway "commander 24" (24 dmx channels) or starway chaman (196 dmx channels)

DMXReceive works only after flashing on Arduino Pro Micro

Using an Arduino Pro Micro (an unofficial clone based on ATMega32U4), the DMXReceive mode is only working once after flashing (and eratically after USB serial initalisation).

-if the Pro Micro starts up after flashing, the DMXReceive mode is working perfectly.
-if the Pro Micro starts by power up (with and without USB data connection), it does not work.
-if the Pro Micro is started by power up, but the USB serial device is initialized later (eg. by opening the Arduino IDE serial console for the first time after plugging), the DMX receiver sometimes(but rarely) start working.
-This bug does not depend on wether Serial (over USB) is initialized or not
-This bug does not depend on wether DMX signal is already incoming while boot up or switched on later.

For me it looks like some UART initalization is missing for this platform, which seems to be done by the USB programming protocol.

Any ideas?

Reading error @ 40FPS

I tried to read DMX512 frame @ 40 FPS (frame per second) by mega2560 board. I couldn't get a stable reading. The target data value appears but just drift around.(not in the correct position). Anyone succeeded to read DMX @ 40FPS ever?

Working with Mini Pro or Nano

Hi,

Thanks for all the work, it's great with Arduino Uno or Mega 2560.

I try to test your library with a Arduino Pro mini, but it's not working. Normal ?

And with a Arduino Nano ?

Thanks,

Hugo

ESP32 resp. Odroid-GO for DMX-receiver

Hey
I try to build a small monitoring for a DMX-line, before creating a controller. Therefore a ODROID-GO would be a nice device with an DMX-USB cable at its input. I try to use the library
#include <DMXSerial.h>
but the compiler does not accept ... :
exit status 1
Error compiling for board ODROID ESP32.
Is there a work around for it ?

Is there a bug in the shield design?

hey,

I had a look at http://www.mathertel.de/Arduino/DMXShield/DMXShieldSchema.png

What makes me wonder is how OK1 and OK2 are connected. It looks to me like the arduino-side (left in the schema) is just turning a led on and off (even if the LED is inside the optocouplers). However, vanilla-led wiring (as in the simple example: https://www.arduino.cc/en/Tutorial/Blink) says:

D2 -> Resistor -> LED -> GND
your design does
D2 -> Resistor -> LED -> 5V

Given that D2 provides 5V, connecting it to another 5V looks fishy. Is this a bug in your design?

Minimum supported inter-slot/-frame time when receiving?

Are there any experiences on what the minimum required time between two frames is to be correctly received? I know this is based on the processor speed so maybe you have some empirical values with certain processors / clock speeds.

For sending it is not to important as other devices should support up to a second of spacing though when I want to monitor other controllers it is rather important to correctly receive every frame...

Arduino mega not connecting with WS2812 LEDS

Hi,
I've already had working program for the UNO, which the LEDs were connected to pin 12, which worked fine.
I've changed to MEGA 2560 16U2 recently, (file to big for uno...) and I've changed pin 12 to 4 as described,
i can confirm that the mega receives dmx, (ch1 controls simple LEDs, which respond perfectly,)
but the WS2812 are not responding on pin 4. (tried diff pwm pins with no success.)
with uno WS2812 work perfectly, but same setup with mega wont work apparently,(except pin 12 to 4 change)
the mega is brand new, iv'e tested pin 4 with fastled, it worked, (although not responsive as ws2812.h with dmxsimple)
please let me know what is the issue, thanks!

Does the library send and receive?

I see the example code called DMXSerialFLow, and the init calls (DMXController), but I see this in the code:

typedef enum {
DMXNone, // unspecified
DMXController, // always sending
DMXReceiver // always listening
} DMXMode;

I'm trying to make a DMX tester that I could switch between sending DMX or receiving DMX. I'm also not sure that doing init(DMXController, 4) is working to switch pin 4 low when I set try to receive data. Does it only go low when the interrupt fires for receiving data?

Thanks for a great lib.

Receiver responds to multiple DMX addresses unintentionally

I've used the library for a simple DMX receiver based on the DMXShield with no isolation.
I'm wanting the device to be set to receive a single dmx channel and implement a function when the value of that channel goes above 128.
However my project responds to multiple addresses and not just the address of 001 as stated in code.

Setup as dmx receiver with the following snippets:
DMXVALUE = DMXSerial.read(1);

if (DMXVALUE >= 128){
//do thing

Anything obvious in the code i'm missing or is this a hardware issue (apologies if so)

Error compilation

Hi !
I have a little compilation problem. I don't know where my problem may come from.

Program :

image

Do you have an idea ?

32bit DMXSerial for Teensy 3.2

I am interested in using the dmx out, in and rdm capabilities of your libraries, as these currently seem to be the most complete. I am currently developing on arduino, but looking to port to teensy to utilise the increased resources.

Do you have any intention of porting to this platform? Or could you offer some guidelines as to how the task could be achieved. I noticed what looks like some of the DMXSerial code in DMXSimple which currently supports Teensy, but only for output.

Arduino DUE migration

It might be very useful to move from AVR only lib toward ARM compatibility (at least to Atmel SAM3X8E ARM Cortex-M3 installed in Arduino DUE)

Start-DMX-Channel without using memory

Is there a possibility to set an Start-DMX-Channel perhaps at 500 by using 4 Channels without wasting Memory for 499 channels?
Maybe a counter-Variable and before the start-Channel the data will not be stored?
only Data of used channels will be stored?

Support for shield CTC-DRA-10-R2

I tried this on the CTC-DRA-10-R2 DMX Shield but it doesnt work correctly. Any idea on how to get this working on this shield? I'm also using the Arduino uno wifi.

Simultaneous sending and receiving DMX?

Will this library support 'simultaneous' sending and receiving?
I want to receive DMX, remap/reprocess some values, then send DMX - in realtime. Assuming the processing is very lightweight, will this library support this?

Thanks for your amazing work.

addresses above 16

Hello!

Addressing channels 1-16 works like a charm for me! Addresses above don't (always on, always off, other strange behaviors).

I can reproduce this with all rgb led controllers i have from various manufacturers.

I'm using a Controllino Mega with a built in RS485 interface on Serial3.

I have patched the DMXSerial_avr.h with a definition for using Serial3:

#define UCSRnA UCSR3A
#define RXCn RXC3
#define TXCn TXC3
#define UCSRnB UCSR3B
#define RXCIEn RXCIE3
#define TXCIEn TXCIE3
#define UDRIEn UDRIE3
#define RXENn RXEN3
#define TXENn TXEN3
#define UCSRnC UCSR3C
#define USBSn USBS3
#define UCSZn0 UCSZ30
#define UPMn0 UPM30
#define UBRRnH UBRR3H
#define UBRRnL UBRR3L
#define UDRn UDR3
#define UDREn UDRE3
#define FEn FE3
#define USARTn_RX_vect USART3_RX_vect
#define USARTn_TX_vect USART3_TX_vect
#define USARTn_UDRE_vect USART3_UDRE_vect

Max channels is set to 64.
DMXSerial.maxChannel(64);

Any ideas, where i could have a look???

DMXSerial on ATTiny 1604

Would it be possible to port this over to work on an attiny 1604 chip, and if so how would I go about implementing that?

noDataSince issue returne value over 4000000000

314// Calculate how long no data packet was received
315 unsigned long DMXSerialClass::noDataSince()
316 {
317 unsigned long now = millis();
318 return(now - _dmxLastPacket);
319 } // noDataSince()

you can fix it to add a if

// Calculate how long no data packet was received
unsigned long DMXSerialClass::noDataSince()
{
unsigned long now = millis();
unsigned long DataSinceTime =now - _dmxLastPacket;
if(DataSinceTime <4000000000){
DataSinceTime = 1;
}
return(DataSinceTime);
} // noDataSince()

megaavr PlatformsIO compability

compiling this simple working example for the Arduino Nano Every

#include <Arduino.h>

#include <DMXSerial.h>


void setup() {
  // put your setup code here, to run once:
  // Serial.begin(9600);
  DMXSerial.init(DMXController, 4);
}

void loop() {
  // put your main code here, to run repeatedly:
  // if(Serial.available()){}
}

works flawless with the Android IDE but fails at PlatformIO at linking:

Processing nano_every (platform: atmelmegaavr; board: nano_every; framework: arduino)
---------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelmegaavr/nano_every.html
PLATFORM: Atmel megaAVR 1.0.0 > Arduino Nano Every
HARDWARE: ATMEGA4809 16MHz, 6KB RAM, 47.50KB Flash
PACKAGES: 
 - framework-arduino-megaavr 1.8.6 
 - toolchain-atmelavr 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 9 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <DMXSerial> 1.5.0
Building in release mode
...
Compiling .pio/build/nano_every/src/main.cpp.o
Compiling .pio/build/nano_every/lib001/DMXSerial_ID912/DMXSerial.cpp.o
Archiving .pio/build/nano_every/lib001/libDMXSerial_ID912.a
Indexing .pio/build/nano_every/lib001/libDMXSerial_ID912.a
Linking .pio/build/nano_every/firmware.elf
DMXSerial.cpp.o (symbol from plugin): In function `_DMX_init()':
(.text+0x0): multiple definition of `__vector_26'
.pio/build/nano_every/FrameworkArduino/UART1.cpp.o (symbol from plugin):(.text+0x0): first defined here
DMXSerial.cpp.o (symbol from plugin): In function `_DMX_init()':
(.text+0x0): multiple definition of `__vector_27'
.pio/build/nano_every/FrameworkArduino/UART1.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
*** [.pio/build/nano_every/firmware.elf] Error 1

First the framework version was 1.8.5 (not 1.8.6) which caused some namespace errors which was fixed with an update of the platformio library, that I have requested. Now they should be identical and I'm getting above error.

I have read the Issues #42, #33 and #14, but I think I got another problem since I'm using no other library (planning to use Serial, which uses UART0, not UART1) and I'm pretty sure I got the right board selected.

I don't know C/C++ and avr-gcc well enough to solve this one alone, though I know the problem lies somewhere in the UART access.

I will/can also try to solve this myself if you point me in the right direction. Maybe the differences in the compiler option are of help (see below).

comparison of compiler options of arduino and platformio verbose output

sorted alphabeticaly, with empty cells for "missing" parameters

Arduino IDE PlatformsIO
-c -c
-CC
-DARDUINO_ARCH_MEGAAVR -DARDUINO_ARCH_MEGAAVR
-DARDUINO_AVR_NANO_EVERY -DARDUINO_AVR_NANO_EVERY
-DARDUINO=10812 -DARDUINO=10808
-DAVR_NANO_4809_328MODE -DAVR_NANO_4809_328MODE
-DF_CPU=16000000L -DF_CPU=16000000L
-DMILLIS_USE_TIMERB3 -DMILLIS_USE_TIMERB3
-DNO_EXTERNAL_I2C_PULLUP -DNO_EXTERNAL_I2C_PULLUP
-DPLATFORMIO=40304
-DUSB_MANUFACTURER="Arduino"
-DUSB_PID=0x0058 "-DUSB_PRODUCT="Arduino Nano Every""
-DUSB_VID=0x2341
-E
-fdata-sections -fdata-sections
-ffunction-sections -ffunction-sections
-flto -flto
-fno-exceptions -fno-exceptions
-fno-threadsafe-statics -fno-threadsafe-statics
-fpermissive -fpermissive
-g
-I/home/johannes/Arduino/libraries/DMXSerial/src -I/home/johannes/.platformio/lib/DMXSerial_ID912/src
-I/home/johannes/.arduino15/packages/arduino/hardware/megaavr/1.8.6/cores/arduino -I/home/johannes/.platformio/packages/framework-arduino-megaavr/cores/arduino
-I/home/johannes/.arduino15/packages/arduino/hardware/megaavr/1.8.6/cores/arduino/api/deprecated -I/home/johannes/.platformio/packages/framework-arduino-megaavr/cores/arduino/api/deprecated
-I/home/johannes/.arduino15/packages/arduino/hardware/megaavr/1.8.6/variants/nona4809 -I/home/johannes/.platformio/packages/framework-arduino-megaavr/variants/nona4809
-mmcu=atmega4809 -mmcu=atmega4809
-o /dev/null -o .pio/build/nano_every/lib001/DMXSerial_ID912/DMXSerial.cpp.o
-Os -Os
-std=gnu++11 -std=gnu++11
-w -w -w
-Wno-error=narrowing -Wno-error=narrowing
-x c++
/home/johannes/Arduino/libraries/DMXSerial/src/DMXSerial.cpp /home/johannes/.platformio/lib/DMXSerial_ID912/src/DMXSerial.cpp
/home/johannes/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-g++ avr-g++

Conflict with Serial on 2560

For testing purposes I changed the code to use serial port 3 on the arduino mega. Does the warning about not using the arduino Serial library for debugging apply on the mega given it is addressing a different serial port to DMXSerial?

DMX sending stops after call DMXSerial.init(DMXController,Direction); twice

hi,

i've made a LED TUBE sketch, and found that if i call
DMXSerial.init(DMXController,Direction);
twice
wenn mode is already in this mode
DMXController

the Output stops!
after calling DMXSerial.init(DMXController,Direction); again the third time, output starts again.
everytime i call DMXSerial.init(DMXController,Direction); it alternates.

this is done in

void CASEmode() {
  switch (MODE) {
    case 0:
      strcpy_P( Mode, PSTR( "72ch"));
      strcpy_P( Function, PSTR( "Adress"));
      Channels = 216;
      pixels.setBrightness(255);
      DMXSerial.init(DMXProbe, Direction);
      break;
    case 1:
      strcpy_P( Mode, PSTR( "3ch"));
      strcpy_P( Function, PSTR( "Adress"));
      Channels = 3;
      pixels.setBrightness(255);
      DMXSerial.init(DMXProbe, Direction);
      break;
    case 2:
      strcpy_P( Mode, PSTR( "4ch"));
      strcpy_P( Function, PSTR( "Adress"));
      Channels = 4;
      DMXSerial.init(DMXProbe, Direction);
      pixels.setBrightness(0);
      break;
    case 3:
      strcpy_P( Mode, PSTR( "Rain"));
      strcpy_P( Function, PSTR( "Speed"));
      Channels = 0;
      pixels.setBrightness(255);
      DMXSerial.init(DMXController, Direction);
      break;
    case 4:
      strcpy_P( Mode, PSTR( "Cycl"));
      strcpy_P( Function, PSTR( "Speed"));
      Channels = 0;
      pixels.setBrightness(255);
      DMXSerial.init(DMXController, Direction);
      break;
    case 5:
      strcpy_P( Mode, PSTR( "chase"));
      strcpy_P( Function, PSTR( "Speed"));
      Channels = 0;
      pixels.setBrightness(255);
      DMXSerial.init(DMXController, Direction);
      break;
    case 6:
      strcpy_P( Mode, PSTR( "static"));
      strcpy_P( Function, PSTR( "Color"));
      Channels = 256; //256
      pixels.setBrightness(255);
      DMXSerial.init(DMXController, Direction);
      break;
    case 7:
      strcpy_P( Mode, PSTR( "white"));
      strcpy_P( Function, PSTR( "Value"));
      Channels = 256; //257
      DMXSerial.init(DMXController, Direction);
      break;
    case 8:
      strcpy_P( Mode, PSTR( "black"));
      strcpy_P( Function, PSTR( "Value"));
      Channels = 256; //257
      DMXSerial.init(DMXController, Direction);
      break;
  }
}

after each button press to change the values in each mode off the LEDTUBE

this only hapends if i call the mode DMXController
calling DMXProbe nothing runs bad.

here is my whole code

#include <DMXSerial.h>
#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h>
#include <EEPROM.h>

#include <avr/pgmspace.h>

#include <Adafruit_NeoPixel.h>



#define PIN            2
#define UP             6
#define DOWN           8
#define MENU           7
#define Direction      9

#define NUMPIXELS      72
#define DMXLENGTH (NUMPIXELS*3)
int DMXSTART = 1;
int DMXMAX = 512;

int MODE = 0;
int SPEED = 0;
int BRIGHT = 0;
int COLOR = 0;
int adresse1 = 0;
int adresse2 = 2;
int adresse3 = 4;
int adresse4 = 6;
int adresse5 = 8;

#define sda 18
#define scl 19
char Mode[40];
char Function[40];
char Name[40] = "LED Tube 4";
int Channels;
int Contrast = 255;

unsigned long lastTime = 0;  // the last time a button was pressed
unsigned long Delay = 5000;    // the delay time after dimm Display
unsigned long lastDebounceTimeUP = 0;  // the last time the UP button was not pressed
unsigned long lastDebounceTimeDOWN = 0;  // the last time the DOWN button was not pressed
unsigned long debounceDelay = 2000;    // the delay increment/decrement speedup time


Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

U8G2_SH1106_128X64_NONAME_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE, /* clock=*/ scl, /* data=*/ sda);



void setup () {
  pinMode(UP, INPUT_PULLUP);
  pinMode(DOWN, INPUT_PULLUP);
  pinMode(MENU, INPUT_PULLUP);
  //  pinMode(Direction, OUTPUT);
  strcpy_P( Mode, PSTR( "StartUP"));

  DMXSTART = (eepromReadInt(adresse1));
  if (DMXSTART < 0 ) {
    DMXSTART = 0;
  }
  MODE = (eepromReadInt(adresse2));
  if (MODE < 0 ) {
    MODE = 0;
  }
  SPEED = (eepromReadInt(adresse3));
  if (SPEED < 0 ) {
    SPEED = 0;
  }
  BRIGHT = (eepromReadInt(adresse4));
  if (BRIGHT < 0 ) {
    BRIGHT = 0;
  }
  COLOR = (eepromReadInt(adresse5));
  if (COLOR < 0 ) {
    COLOR = 0;
  }
  u8g2.begin();
  CASEmode();
  draw();




  pixels.begin(); // This initializes the NeoPixel library.
  pixels.show(); // Initialize all pixels to 'off'

}

void CASEmode() {
  switch (MODE) {
    case 0:
      strcpy_P( Mode, PSTR( "72ch"));
      strcpy_P( Function, PSTR( "Adress"));
      Channels = 216;
      pixels.setBrightness(255);
      DMXSerial.init(DMXProbe, Direction);
      break;
    case 1:
      strcpy_P( Mode, PSTR( "3ch"));
      strcpy_P( Function, PSTR( "Adress"));
      Channels = 3;
      pixels.setBrightness(255);
      DMXSerial.init(DMXProbe, Direction);
      break;
    case 2:
      strcpy_P( Mode, PSTR( "4ch"));
      strcpy_P( Function, PSTR( "Adress"));
      Channels = 4;
      DMXSerial.init(DMXProbe, Direction);
      pixels.setBrightness(0);
      break;
    case 3:
      strcpy_P( Mode, PSTR( "Rain"));
      strcpy_P( Function, PSTR( "Speed"));
      Channels = 0;
      pixels.setBrightness(255);
      DMXSerial.init(DMXController, Direction);
      break;
    case 4:
      strcpy_P( Mode, PSTR( "Cycl"));
      strcpy_P( Function, PSTR( "Speed"));
      Channels = 0;
      pixels.setBrightness(255);
      DMXSerial.init(DMXController, Direction);
      break;
    case 5:
      strcpy_P( Mode, PSTR( "chase"));
      strcpy_P( Function, PSTR( "Speed"));
      Channels = 0;
      pixels.setBrightness(255);
      DMXSerial.init(DMXController, Direction);
      break;
    case 6:
      strcpy_P( Mode, PSTR( "static"));
      strcpy_P( Function, PSTR( "Color"));
      Channels = 256; //256
      pixels.setBrightness(255);
      DMXSerial.init(DMXController, Direction);
      break;
    case 7:
      strcpy_P( Mode, PSTR( "white"));
      strcpy_P( Function, PSTR( "Value"));
      Channels = 256; //257
      DMXSerial.init(DMXController, Direction);
      break;
    case 8:
      strcpy_P( Mode, PSTR( "black"));
      strcpy_P( Function, PSTR( "Value"));
      Channels = 256; //257
      DMXSerial.init(DMXController, Direction);
      break;
  }
}

void draw() {
  u8g2.firstPage();
  do {
    u8g2.setFont(u8g2_font_ncenB14_tr);
    u8g2.drawStr(0, 20, Name);
    u8g2.drawStr(0, 40, Function);
    u8g2.setCursor(75, 40);
    switch (MODE) {
      case 0: u8g2.print(DMXSTART); break;
      case 1: u8g2.print(DMXSTART); break;
      case 2: u8g2.print(DMXSTART); break;
      case 3: u8g2.print(SPEED); break;
      case 4: u8g2.print(SPEED); break;
      case 5: u8g2.print(SPEED); break;
      case 6: u8g2.print(COLOR); break;
      case 7: u8g2.print(BRIGHT); break;
      case 8: u8g2.print(BRIGHT); break;
    }
    u8g2.drawStr(0, 60, "Mode:");
    u8g2.drawStr(65, 60, Mode);
  } while ( u8g2.nextPage() );
  //delay(1000);
}


void eepromWriteInt(int adr, uint16_t wert) {

  byte low, high;

  low = wert & 0xFF;
  high = (wert >> 8) & 0xFF;
  EEPROM.write(adr, low);
  EEPROM.write(adr + 1, high);
  return;
}


int eepromReadInt(int adr) {

  byte low, high;

  low = EEPROM.read(adr);
  high = EEPROM.read(adr + 1);
  return low + ((high << 8) & 0xFF00);
}

void setChannelRGB(int channel, int WheelPos) {
  WheelPos = 255 - WheelPos;
  if (WheelPos < 85) {
    /// red to green
    DMXSerial.write(channel * 3 + 1, 255 - WheelPos * 3);
    DMXSerial.write(channel * 3 + 2, 0);
    DMXSerial.write(channel * 3 + 3, WheelPos * 3);
  } else if
  (WheelPos < 170) {
    WheelPos -= 85;
    /// green to blue
    DMXSerial.write(channel * 3 + 1, 0);
    DMXSerial.write(channel * 3 + 2, WheelPos * 3);
    DMXSerial.write(channel * 3 + 3, 255 - WheelPos * 3);


  } else {
    WheelPos -= 170;
    /// red to green
    DMXSerial.write(channel * 3 + 1, WheelPos * 3);       //red
    DMXSerial.write(channel * 3 + 2, 255 - WheelPos * 3); //green
    DMXSerial.write(channel * 3 + 3, 0);                  //blue
  }

} // setChannelRGB()

void rainbow() {
  uint16_t i;
  int j;
  for (j = 0; j < 256; j++) {
    button();
    for (i = 0; i < NUMPIXELS; i++) {
      pixels.setPixelColor(i, Wheel((i + j) & 255));
      setChannelRGB (i, (i + j & 255));
    }
    pixels.show();
    if (MODE != 3) break;
    delay(SPEED);
  }
}

void chase() {
  uint16_t i;
  int j;
  for (j = 0; j < 256; j++) {
    button();
    for (i = 0; i < NUMPIXELS; i++) {
      pixels.setPixelColor(i, Wheel(j));
      setChannelRGB (i, j);

    }
    pixels.show();
    if (MODE != 5) break;
    delay(SPEED);
  }
}


void rainbowCycle() {
  uint16_t i;
  int j;
  for (j = 0; j < 256 * 5; j++) { // 5 cycles of all colors on wheel
    button();
    for (i = 0; i < NUMPIXELS; i++) {
      pixels.setPixelColor(i, Wheel(((i * 256 / NUMPIXELS) + j) & 255));
      setChannelRGB (i, ((i * 256 / NUMPIXELS) + j) & 255);
    }
    pixels.show();
    if (MODE != 4) break;
    delay(SPEED);
  }
}

void staticColor() {
  uint16_t i;
  for (i = 0; i < NUMPIXELS; i++) {
    pixels.setPixelColor(i, Wheel(COLOR));
    setChannelRGB (i, COLOR);
    if (MODE != 6) break;
  }
  pixels.show();
}

uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if (WheelPos < 85) {
    return pixels.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  }
  if (WheelPos < 170) {
    WheelPos -= 85;
    return pixels.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  WheelPos -= 170;
  return pixels.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}

void button() {
  int ButtonUP = digitalRead(UP);
  int ButtonDOWN = digitalRead(DOWN);
  int ButtonMENU = digitalRead(MENU);
  //-----------------------------------------------------------------------Button UP--------------------------------------------------------------------------------------




  if (ButtonUP == LOW) {
    lastTime = millis();
    Contrast = 255;
    u8g2.setContrast(Contrast);
    switch (MODE) {
      case 0:
        if ((millis() - lastDebounceTimeUP) > debounceDelay) {

          DMXSTART = DMXSTART + 10;
          DMXMAX = 512 - Channels;
          if (DMXSTART > DMXMAX) {
            DMXSTART = 1;
          }
          draw();

        } else {
          DMXSTART++;
          DMXMAX = 512 - Channels;
          if (DMXSTART > DMXMAX) {
            DMXSTART = 1;
          }
          draw();
        }
        DMXSerial.maxChannel(DMXSTART + Channels);
        eepromWriteInt(adresse1, DMXSTART);
        delay(100);
        break;
      case 1:
        if ((millis() - lastDebounceTimeUP) > debounceDelay) {

          DMXSTART = DMXSTART + 10;
          DMXMAX = 512 - Channels;
          if (DMXSTART > DMXMAX) {
            DMXSTART = 1;
          }
          draw();

        } else {
          DMXSTART++;
          DMXMAX = 512 - Channels;
          if (DMXSTART > DMXMAX) {
            DMXSTART = 1;
          }
          draw();
        }
        DMXSerial.maxChannel(DMXSTART + Channels);
        eepromWriteInt(adresse1, DMXSTART);
        delay(100);
        break;
      case 2:
        if ((millis() - lastDebounceTimeUP) > debounceDelay) {

          DMXSTART = DMXSTART + 10;
          DMXMAX = 512 - Channels;
          if (DMXSTART > DMXMAX) {
            DMXSTART = 1;
          }
          draw();

        } else {
          DMXSTART++;
          DMXMAX = 512 - Channels;
          if (DMXSTART > DMXMAX) {
            DMXSTART = 1;
          }
          draw();
        }
        DMXSerial.maxChannel(DMXSTART + Channels);
        eepromWriteInt(adresse1, DMXSTART);
        delay(100);
        break;
      case 3:
        if ((millis() - lastDebounceTimeUP) > debounceDelay) {

          SPEED = SPEED + 10;
          if (SPEED > 256) {
            SPEED = 1;
          }
          draw();

        } else {
          SPEED++;

          if (SPEED > 256) {
            SPEED = 1;
          }
          draw();
        }

        eepromWriteInt(adresse3, SPEED);
        delay(100);
        break;
      case 4:
        if ((millis() - lastDebounceTimeUP) > debounceDelay) {

          SPEED = SPEED + 10;
          if (SPEED > 256) {
            SPEED = 1;
          }
          draw();

        } else {
          SPEED++;

          if (SPEED > 256) {
            SPEED = 1;
          }
          draw();
        }

        eepromWriteInt(adresse3, SPEED);
        delay(100);
        break;
      case 5:
        if ((millis() - lastDebounceTimeUP) > debounceDelay) {

          SPEED = SPEED + 10;
          if (SPEED > 256) {
            SPEED = 1;
          }
          draw();

        } else {
          SPEED++;

          if (SPEED > 256) {
            SPEED = 1;
          }
          draw();
        }

        eepromWriteInt(adresse3, SPEED);
        delay(100);
        break;
      case 6:
        if ((millis() - lastDebounceTimeUP) > debounceDelay) {

          COLOR = COLOR + 10;
          if (COLOR > 255) {
            COLOR = 1;
          }
          draw();

        } else {
          COLOR++;

          if (COLOR > 255) {
            COLOR = 1;
          }
          draw();
        }

        eepromWriteInt(adresse5, COLOR);
        delay(100);
        break;
      case 7:
        if ((millis() - lastDebounceTimeUP) > debounceDelay) {

          BRIGHT = BRIGHT + 10;
          if (BRIGHT > 255) {
            BRIGHT = 0;
          }
          draw();

        } else {
          BRIGHT++;

          if (BRIGHT > 255) {
            BRIGHT = 0;
          }
          draw();
        }

        eepromWriteInt(adresse4, BRIGHT);
        delay(100);
        break;
      case 8:
        if ((millis() - lastDebounceTimeUP) > debounceDelay) {

          BRIGHT = BRIGHT + 10;
          if (BRIGHT > 255) {
            BRIGHT = 0;
          }
          draw();

        } else {
          BRIGHT++;

          if (BRIGHT > 255) {
            BRIGHT = 0;
          }
          draw();
        }

        eepromWriteInt(adresse4, BRIGHT);
        delay(100);
        break;
    }
  } else {
    lastDebounceTimeUP = millis();
  }
  //-----------------------------------------------------------------------Button DOWN--------------------------------------------------------------------------------------

  if (ButtonDOWN == LOW) {
    lastTime = millis();

    Contrast = 255;
    u8g2.setContrast(Contrast);
    switch (MODE) {
      case 0:
        if ((millis() - lastDebounceTimeDOWN) > debounceDelay) {
          DMXSTART = DMXSTART - 10;
          if (DMXSTART < 1) {
            DMXSTART = DMXMAX;
          }
          draw();
        } else {
          DMXSTART--;
          if (DMXSTART < 1) {
            DMXSTART = DMXMAX;
          }

          draw();
        }


        DMXSerial.maxChannel(DMXSTART + Channels);
        eepromWriteInt(adresse1, DMXSTART);

        delay(100);
        break;
      case 1:
        if ((millis() - lastDebounceTimeDOWN) > debounceDelay) {
          DMXSTART = DMXSTART - 10;
          if (DMXSTART < 1) {
            DMXSTART = DMXMAX;
          }
          draw();
        } else {
          DMXSTART--;
          if (DMXSTART < 1) {
            DMXSTART = DMXMAX;
          }

          draw();
        }


        DMXSerial.maxChannel(DMXSTART + Channels);
        eepromWriteInt(adresse1, DMXSTART);

        delay(100);
        break;
      case 2:
        if ((millis() - lastDebounceTimeDOWN) > debounceDelay) {
          DMXSTART = DMXSTART - 10;
          if (DMXSTART < 1) {
            DMXSTART = DMXMAX;
          }
          draw();
        } else {
          DMXSTART--;
          if (DMXSTART < 1) {
            DMXSTART = DMXMAX;
          }

          draw();
        }


        DMXSerial.maxChannel(DMXSTART + Channels);
        eepromWriteInt(adresse1, DMXSTART);

        delay(100);
        break;
      case 3:
        if ((millis() - lastDebounceTimeDOWN) > debounceDelay) {
          SPEED = SPEED - 10;
          if (SPEED < 1) {
            SPEED = 256;
          }
          draw();
        } else {
          SPEED--;
          if (SPEED < 1) {
            SPEED = 256;
          }

          draw();
        }



        eepromWriteInt(adresse3, SPEED);

        delay(100);
        break;
      case 4:
        if ((millis() - lastDebounceTimeDOWN) > debounceDelay) {
          SPEED = SPEED - 10;
          if (SPEED < 1) {
            SPEED = 256;
          }
          draw();
        } else {
          SPEED--;
          if (SPEED < 1) {
            SPEED = 256;
          }

          draw();
        }



        eepromWriteInt(adresse3, SPEED);

        delay(100);
        break;
      case 5:
        if ((millis() - lastDebounceTimeDOWN) > debounceDelay) {
          SPEED = SPEED - 10;
          if (SPEED < 1) {
            SPEED = 256;
          }
          draw();
        } else {
          SPEED--;
          if (SPEED < 1) {
            SPEED = 256;
          }

          draw();
        }



        eepromWriteInt(adresse3, SPEED);

        delay(100);
        break;
      case 6:
        if ((millis() - lastDebounceTimeDOWN) > debounceDelay) {
          COLOR = COLOR - 10;
          if (COLOR < 1) {
            COLOR = 255;
          }
          draw();
        } else {
          COLOR--;
          if (COLOR < 1) {
            COLOR = 255;
          }

          draw();
        }


        eepromWriteInt(adresse5, COLOR);

        delay(100);
        break;
      case 7:
        if ((millis() - lastDebounceTimeDOWN) > debounceDelay) {
          BRIGHT = BRIGHT - 10;
          if (BRIGHT < 0) {
            BRIGHT = 255;
          }
          draw();
        } else {
          BRIGHT--;
          if (BRIGHT < 0) {
            BRIGHT = 255;
          }

          draw();
        }


        eepromWriteInt(adresse4, BRIGHT);

        delay(100);
        break;
      case 8:
        if ((millis() - lastDebounceTimeDOWN) > debounceDelay) {
          BRIGHT = BRIGHT - 10;
          if (BRIGHT < 0) {
            BRIGHT = 255;
          }
          draw();
        } else {
          BRIGHT--;
          if (BRIGHT < 0) {
            BRIGHT = 255;
          }

          draw();
        }


        eepromWriteInt(adresse4, BRIGHT);

        delay(100);
        break;
    }
  } else {
    lastDebounceTimeDOWN = millis();
  }
  //-----------------------------------------------------------------------Button MODE--------------------------------------------------------------------------------------

  if (ButtonMENU == LOW) {
    lastTime = millis();
    Contrast = 255;
    u8g2.setContrast(Contrast);
    MODE++;
    if (MODE > 8) {
      MODE = 0;
    }

    eepromWriteInt(adresse2, MODE);
    CASEmode();


    draw();

    delay(100);
  } else {}

}



void DMX72CH() {

  if (DMXSerial.receive()) {
    for (int i = 0; i < NUMPIXELS; i++) {
      pixels.setPixelColor(i, pixels.Color(DMXSerial.read((i * 3) + DMXSTART), DMXSerial.read((i * 3) + DMXSTART + 1), DMXSerial.read((i * 3) + DMXSTART + 2)));
    }

    pixels.show();
  }

}

void DMX3CH() {
  if (DMXSerial.receive()) {
    for (int i = 0; i < NUMPIXELS; i++) {

      pixels.setPixelColor(i, pixels.Color(DMXSerial.read(DMXSTART), DMXSerial.read(DMXSTART + 1), DMXSerial.read(DMXSTART + 2)));
    }
    pixels.show();
  }
}

void DMX4CH() {
  if (DMXSerial.receive()) {
    for (int i = 0; i < NUMPIXELS; i++) {

      pixels.setPixelColor(i, pixels.Color(DMXSerial.read(DMXSTART), DMXSerial.read(DMXSTART + 1), DMXSerial.read(DMXSTART + 2)));
    }

    pixels.setBrightness(DMXSerial.read(DMXSTART + 3));
    pixels.show();
  }
}

void loop() {

  button();

  if      (MODE == 0) {
    DMX72CH();
  } else {
    if (MODE == 1) {
      DMX3CH();
    } else {
      if (MODE == 2) {

        DMX4CH();
      } else {
        if (MODE == 3) {

          rainbow();
        } else {
          if (MODE == 4) {
            rainbowCycle();
          } else {
            if (MODE == 5) {
              chase();
            } else {
              if (MODE == 6) {
                staticColor();
              } else {
                if (MODE == 7) {
                  pixels.setBrightness(BRIGHT);
                  for (int i = 0; i < NUMPIXELS; i++) {
                    pixels.setPixelColor(i, pixels.Color(255, 255, 255));
                    DMXSerial.write(i * 3 + 1, BRIGHT);
                    DMXSerial.write(i * 3 + 2, BRIGHT);
                    DMXSerial.write(i * 3 + 3, BRIGHT);
                  }
                  pixels.show();
                } else {
                  if (MODE == 8) {
                    pixels.setBrightness(BRIGHT);
                    for (int i = 0; i < NUMPIXELS; i++) {
                      pixels.setPixelColor(i, pixels.Color(0, 0, 0));
                      DMXSerial.write(i * 3 + 1, 0);
                      DMXSerial.write(i * 3 + 2, 0);
                      DMXSerial.write(i * 3 + 3, 0);
                    }
                    pixels.show();
                  } else {

                  }
                }
              }
            }
          }
        }
      }
    }
  }
  if ((millis() - lastTime ) > Delay && Contrast != 1) {
    Contrast = 1;
    u8g2.setContrast(Contrast);
    draw();
  }
}

regards maik

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.