Hello! As the title says I need help with my segment display.
Im making uhf radio panel for my f-16c simpit. I bought that nice display https://pl.aliexpress.com/item/4001293690559.html?gatewayAdapt=glo2pol&spm=a2g0o.order_list.0.0.21ef1c24AJGZ6f
After many hours trying to make it work with DCS BIOS, it's actually worked... But there are some issues.
When I turn on radio, digits turns on too and I can change them correctly, but when Im turning off radio, all digits are changing to 0 and staying in that position til I turn radio on again. I want to have blank display!
My code:
/* Mega and Uno pinout is the same
* GRND = GRND
* VCC = 5V
* D10 = Digital input pin - this code uses pin 3
* CLK = Digital input pin - this code uses pin 2
*/
#define DCSBIOS_DEFAULT_SERIAL
#include <Arduino.h>
#include <TM1637TinyDisplay6.h>
#define CLK 2 //pins definitions for TM1637 and can be changed to other ports
#define DIO 3
TM1637TinyDisplay6 display(CLK, DIO);
#include "DcsBios.h"
uint8_t data[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; // Test Pattern - All
uint8_t blank[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; // Test Pattern - Blank
uint8_t dots = 0b01010000; // Add dots or colons (depends on display module)
// DCS-Bios Code
void onUhfFreqDispChange(char* newValue) {
//newValue[3] - dot
display.setBrightness(1);
data[0] = display.encodeDigit(newValue[0]); // digit 1
data[1] = display.encodeDigit(newValue[1]); // digit 2
data[2] = display.encodeDigit(newValue[2]); // digit 3
data[3] = display.encodeDigit(newValue[4]); // digit 4
data[4] = display.encodeDigit(newValue[5]); // digit 5
data[5] = display.encodeDigit(newValue[6]); // digit 6
display.setSegments(data);
}
DcsBios::StringBuffer<7> uhfFreqDispBuffer(0x4590, onUhfFreqDispChange);
// End DCS-Bios Code
void setup()
{
DcsBios::setup();
display.clear();
display.setSegments(blank);
}
void loop()
{
DcsBios::loop();
}
Library that I'm using: https://github.com/jasonacox/TM1637TinyDisplay I was trying many others but that one seems to work the best for me.
I'm using arduino mega
Thank you in advance for help and sorry for my English!