For a project I'd like a Arduino (preferably nano) to be able to do the following things: 1. Read DMX value from specific DMX-address (using RS485).2. Convert read DMX value and output it as PWM (which later on will be converted to 0-10V to drive a VFD)3. Create a simple menu on a 128x64 OLED I2C display, controlled by a rotary encoder with switch, to be abled to change the DMX address (and for the below)4. (optionally), create a 'standalone' mode where the 'device' can work without receiving DMX. In this mode, the PWM output can be controlled manually by a percentage or slider on the menu (using the rotary encoder). Ok, first things first. I think it's advice-able to approach this project in smaller pieces, so to make each point work in it's own before blending it all together. (1.) Therefore, I'd like to try the link below (ArDMX) as soon as my ordered RS485's come in to make part 1 working. https://playground.arduino.cc/DMX/Ardmx/(2.) This shouldn't be to hard and is mostly already captured in the link from #1. As soon as my PWM-->0-10V converter comes in I'll give the electronics a try on this part. (3.) This is where it gets harder for me. I've been searching for good code examples/tutorials on how to easily program simple menus but haven't found anything usable yet. Also, reading of the rot. enc. isn't going so smoothly currently, a really lot of bouncing and ghosting is going on. Do any of you guys have good examples or thoughts about how to achieve a simple menu, I've put a small example/mockup of how I'd like the menu to be in the attachments of this post. Furthermore, the DMX address to have a look at is being defined before the setup void in the ArDMX example. Would it even be possible to change the address by using the menu? Would this always require a reboot before it becomes active? (4.) This one is optional and might only be interesting later on. On the other hand is this a nice way to test #2.
What the menu should contain is: Main page (showing current speed and direction (optionally also current dmx address)) --> click brings up two options: "Set DMX Address" & "Mode"When "Set DMX Address" is clicked, the current DMX address (1-512) should be displayed, and the user can change it by rotating the encoder. Confirm with a click (which brings you back to the main page). When "Mode" is clicked, the user can select either "Manual" or "DMX". When "Manual" is selected, the user should be able to set some parameter to a value and optionally also the direction. I've tried to use the example provided here: https://www.youtube.com/watch?v=k8Vvc4KfPOU&t=1s This looks like a really nice menu. This obviously doesn't work with my I2C display, so i've changed the display setup from: Code: [Select]//U8G2_SH1106_128X64_VCOMH0_1_4W_HW_SPI u8g2(U8G2_R0, 10, 8); //Original codeTo: Code: [Select]U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE); // All Boards without Reset of the DisplayUnfortunately this one gave some undefined pixels in the bottom of the screen and only showed the main screen (did see some small movement on the 'slider bar' however when rotating the rotary encoder, but it didn't go to a completely other screen/page). Therefore I've also tried it with this setup line: Code: [Select]//U8G2_SSD1306_128X64_ALT0_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); // same as the NONAME variant, but may solve the "every 2nd line skipped" problemBut this gave even worse results (no display at all). Another problem is that this code already used a lot of memory, which is not ideal as the DMX part is not in yet.
//U8G2_SH1106_128X64_VCOMH0_1_4W_HW_SPI u8g2(U8G2_R0, 10, 8); //Original code
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE); // All Boards without Reset of the Display
//U8G2_SSD1306_128X64_ALT0_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); // same as the NONAME variant, but may solve the "every 2nd line skipped" problem