Chickenbone72 Posted August 2, 2020 Posted August 2, 2020 :helpsmilie: I have purchased a 14 segment display https://core-electronics.com.au/qwii...splay-red.html and am having trouble get it to work in dcs for the A-10C TACAN. I am able to use the basic arduino / Sparkfun code and get display to function in arduino. but cant work out how to get it to work in DCS-BIOS. I'll paste what I am working with so far but nothing displaying on display. other arduinos are working fine, so DCS and Bios are installed correctly, any help or code would be greatly appreciated i have Arduino mega's , uno's and nano's /* Tell DCS-BIOS to use a serial connection and use interrupt-driven communication. The main program will be interrupted to prioritize processing incoming data. This should work on any Arduino that has an ATMega328 controller (Uno, Pro Mini, many others). */ #include <Wire.h> #include <SparkFun_Alphanumeric_Display.h> #define DCSBIOS_IRQ_SERIAL #include "DcsBios.h" HT16K33 display; /* paste code snippets from the reference documentation here */ void onTacanChannelChange(char* newValue) { /* your code here */ display.write(0, newValue[3]); display.write(1, newValue[2]); display.write(2, newValue[1]); display.write(3, newValue[0]); } DcsBios::StringBuffer<4> tacanChannelBuffer(0x1162, onTacanChannelChange); void setup() { display.begin(); DcsBios::setup(); } void loop() { DcsBios::loop(); }
BoboBear Posted August 2, 2020 Posted August 2, 2020 I think you're missing a call to update the display in your loop() I don't have the Sparkfun display library, but it's probably something like:- display.writeDisplay(); Take a look at the example sketch with the library
Chickenbone72 Posted August 3, 2020 Author Posted August 3, 2020 I think you're missing a call to update the display in your loop() I don't have the Sparkfun display library, but it's probably something like:- display.writeDisplay(); Take a look at the example sketch with the library this code compiles but no display when connected to DCS Bios #include <Wire.h> #include <SparkFun_Alphanumeric_Display.h> //Click here to get the library: http://librarymanager/All#Alphanumeric_Display by SparkFun HT16K33 display; #define DCSBIOS_IRQ_SERIAL #include "DcsBios.h" /* paste code snippets from the reference documentation here */ void onTacanChannelChange(char* newValue) { /* your code here */ display.printChar(newValue[0], 0); display.printChar(newValue[1], 1); display.printChar(newValue[2], 2); display.printChar(newValue[3], 3); display.updateDisplay(); DcsBios::StringBuffer<4> tacanChannelBuffer(0x1162, onTacanChannelChange); } void setup() { Wire.begin(); //Join I2C bus display.begin(); DcsBios::setup(); } void loop() { DcsBios::loop(); }
Chickenbone72 Posted August 3, 2020 Author Posted August 3, 2020 Also tried this one and no info coming up exept the " BIT" i have it printing for 1 sec #include <SparkFun_Alphanumeric_Display.h> //Click here to get the library: http://librarymanager/All#Alphanumeric_Display by SparkFun HT16K33 display; #include <Wire.h> #define DCSBIOS_IRQ_SERIAL #include "DcsBios.h" /* paste code snippets from the reference documentation here */ void onTacanChannelChange(char* newValue) { /* your code here */ display.print(0, newValue[0]); display.print(1, newValue[1]); display.print(2, newValue[2]); display.print(3, newValue[3]); display.updateDisplay(); DcsBios::StringBuffer<4> tacanChannelBuffer(0x1162, onTacanChannelChange); } void setup() { Wire.begin(); //Join I2C bus display.begin(); display.setBrightness(14); DcsBios::setup(); // write something to the display // so you see something before data is received display.print(" BIT"); delay(1000); display.clear(); } void loop() { DcsBios::loop(); }
BoboBear Posted August 3, 2020 Posted August 3, 2020 void onTacanChannelChange(char* newValue) { /* your code here */ display.print(0, newValue[0]); display.print(1, newValue[1]); display.print(2, newValue[2]); display.print(3, newValue[3]); display.updateDisplay(); DcsBios::StringBuffer<4> tacanChannelBuffer(0x1162, onTacanChannelChange); } Is that a typo? DcsBios::StringBuffer<4> tacanChannelBuffer(0x1162, onTacanChannelChange); Should be outside of onTacanChannelChange procedure Also, I would suggest moving the display.updateDisplay() call to just after DcsBios::loop(). That way if multiple things get updated in one DCSBios update you only write once to the i2c
Chickenbone72 Posted August 5, 2020 Author Posted August 5, 2020 (edited) ok i went to a mega and this code. turns out the uno was FUBAR code working fine. thank you BoboBear #include <Wire.h> #include <SparkFun_Alphanumeric_Display.h> //Click here to get the library: http://librarymanager/All#Alphanumeric_Display by SparkFun HT16K33 display; // include DCS-BIOS Arduino library #define DCSBIOS_IRQ_SERIAL #include "DcsBios.h" 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. display.clear(); display.printChar(newValue[0], 0); display.printChar(newValue[1], 1); display.printChar(newValue[2], 2); display.printChar(newValue[3], 3); display.updateDisplay(); } DcsBios::StringBuffer<4> tacanChannelBuffer(0x1162, onTacanChannelChange); void setup() { display.begin(); display.setBrightness(12); display.clear(); Wire.begin(); //Join I2C bus DcsBios::setup(); } void loop() { DcsBios::loop(); } Edited August 6, 2020 by Chickenbone72 Fixed problem with code
Recommended Posts