patogn20 Posted March 26, 2019 Posted March 26, 2019 (edited) Hi! I've been able to export lights and do all kind of weird things with switches and encoders. Now I've decided to move forward and started experimenting with LCDs. My first attempt was with the Huey UHF radio. I was partially successful since I was able to export channel preset, and the first part of the frequency This is what I have, if anyone can help me figure out what i'm putting wrong!!! THANKS A LOT!! /* 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). */ #define DCSBIOS_IRQ_SERIAL #include <LiquidCrystal.h> #include "DcsBios.h" LiquidCrystal lcd(12, 11, 5, 4, 3, 2); /* paste code snippets from the reference documentation here */ void onUhfFreqChange(char* newValue) { lcd.setCursor(0, 1); lcd.print(newValue); } DcsBios::StringBuffer<6> uhfFreqBuffer(0x14e0, onUhfFreqChange); void setup() { DcsBios::setup(); lcd.begin(0,1); lcd.clear(); } void loop() { DcsBios::loop(); } I would also like to know how can I have more space between Preset channel and freq because when i reach 10 the don't have any room and you get a 5 digit number, which is rather difficult to read and understand. Thanks for your help! Edited March 26, 2019 by patogn20
Yngwie84 Posted March 26, 2019 Posted March 26, 2019 (edited) Hi! I've been able to export lights and do all kind of weird things with switches and encoders. Now I've decided to move forward and started experimenting with LCDs. My first attempt was with the Huey UHF radio. I was partially successful since I was able to export channel preset, and the first part of the frequency This is what I have, if anyone can help me figure out what i'm putting wrong!!! THANKS A LOT!! /* 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). */ #define DCSBIOS_IRQ_SERIAL #include <LiquidCrystal.h> #include "DcsBios.h" LiquidCrystal lcd(12, 11, 5, 4, 3, 2); /* paste code snippets from the reference documentation here */ void onUhfFreqChange(char* newValue) { lcd.setCursor(0, 1); lcd.print(newValue); } DcsBios::StringBuffer<6> uhfFreqBuffer(0x14e0, onUhfFreqChange); void setup() { DcsBios::setup(); lcd.begin(0,1); lcd.clear(); } void loop() { DcsBios::loop(); } I would also like to know how can I have more space between Preset channel and freq because when i reach 10 the don't have any room and you get a 5 digit number, which is rather difficult to read and understand. Thanks for your help! Hi. You are not defining how big you screen is. lcd.begin(16, 2); in setup. I have two lcs, one 16,2 same as yours. but also one 20,4. I made a program for you, with a 16,2 display. It will always display "Pre:" on the first row and "UHF" on the second line, what you type in setup will be set once when the display starts. Play around with the numbers in lcd.setCursor(5, 1); and see what happens if you increase it. Hope this helps you. // ------------------------------------------------------------------ // HUEY // ------------------------------------------------------------------ // Yngwie84 27 MARCH 2019 // ------------------------------------------------------------------ // DCS BIOS DCS BIOS DCS BIOS DCS BIOS // ------------------------------------------------------------------ #define DCSBIOS_IRQ_SERIAL #include "DcsBios.h" #include <LiquidCrystal.h> const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); // ------------------------------------------------------------------ // LCD DISPLAY LCD DISPLAY LCD DISPLAY // ------------------------------------------------------------------ void onUhfPresetChange(char* Preset) { lcd.setCursor(5, 0); lcd.print(Preset); } DcsBios::StringBuffer<2> uhfPresetStrBuffer(0x14de, onUhfPresetChange); void onUhfFreqChange(char* UHFValue) { lcd.setCursor(5, 1); lcd.print(UHFValue); } DcsBios::StringBuffer<6> uhfFreqBuffer(0x14e0, onUhfFreqChange); // ------------------------------------------------------------------ // SETUP SETUP SETUP SETUP SETUP // ------------------------------------------------------------------ void setup() { DcsBios::setup(); // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. lcd.print("Pre:"); lcd.setCursor(0, 1); lcd.print("UHF:"); } void loop() { DcsBios::loop(); } Edited March 26, 2019 by Yngwie84 typo Yngwie84: ingame & on Twitch X55-Hotas - Logitech rudder pedals - DCS Bios box.
Recommended Posts