Jump to content

dcs bios - 14 segment display


Regnad517

Recommended Posts

Just curious if anyone has got a 14 seg working with dcs bios?

 

Best I have so far is random (Im sure they are not random but they are not proper) characters. I'm trying to use a 14 segment for my Tacan so the X looks better but am having trouble incorporating it in dcs bios.

Link to comment
Share on other sites

Try the following code. I don't have a LED backpack to test with, but the Adafruit library had good examples and I verified that it compiles, so it probably works.

If the digits are displayed in the wrong order, you'll need to reverse the indices in onTacanChannelChange().

 

// include Adafruit LED Backpack library
#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"

// include DCS-BIOS Arduino library
#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"

// display instance
Adafruit_AlphaNum4 alpha4 = Adafruit_AlphaNum4();


void onTacanChannelChange(char* newValue) {
 // when we get new data for the TACAN channel, write it to the display
 // you might need to reverse the display (go from newValue[3] to
 // newValue[0]) if it is the wrong way around.
 alpha4.writeDigitAscii(0, newValue[0]);
 alpha4.writeDigitAscii(1, newValue[1]);
 alpha4.writeDigitAscii(2, newValue[2]);
 alpha4.writeDigitAscii(3, newValue[3]);
 alpha4.writeDisplay();
}
DcsBios::StringBuffer<4> tacanChannelBuffer(0x1162, onTacanChannelChange);



void setup() {
  // initialize display
 alpha4.begin(0x70);

 // write something to the display
 // so you see something before data is received
 alpha4.writeDigitAscii(0, 'A');
 alpha4.writeDigitAscii(1, 'B');
 alpha4.writeDigitAscii(2, 'C');
 alpha4.writeDigitAscii(3, 'D');
 alpha4.writeDisplay();
 
 DcsBios::setup();
}

void loop() {
 DcsBios::loop();
}

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...