Regnad517 Posted November 8, 2017 Posted November 8, 2017 Yup, me again. Believe it or not I have done quite a bit on my own without asking for help. Anyway, here is my current issue. Working with TM1637 7 segment display. Using Digital clock from a10c as my test but keep getting an error. Here is an example of quick test code that works as far as general display #include <TM1637Display.h> const int CLK = 2; //Set the CLK pin connection to the display const int DIO = 3; //Set the DIO pin connection to the display int numDisplay = 60; //Variable to interate TM1637Display display(CLK, DIO); //set up the 4-Digit Display. void setup() { display.setBrightness(0x0a); //set the diplay to maximum brightness display.showNumberDec(numDisplay); //Display the Variable value; } void loop() { } Now I tried to modify it a bit for use in DCS-Bios like this #include <TM1637Display.h> #define DCSBIOS_IRQ_SERIAL #include "DcsBios.h" const int CLK = 2; //Set the CLK pin connection to the display const int DIO = 3; //Set the DIO pin connection to the display TM1637Display display(CLK, DIO); //set up the 4-Digit Display. void onClockHhChange(char* newValue) { display.showNumberDec(newValue); } DcsBios::StringBuffer<2> clockHhBuffer(0x10fe, onClockHhChange); void setup() { DcsBios::setup(); display.setBrightness(0x0a); //set the diplay to maximum brightness } void loop() { DcsBios::loop(); } I am getting an invalid argument from int to char when it tries to compile. I will be the first to admit I might be getting in over my head a bit with this one but have read many times, if arduino can control it, so can dcs bios. Any help out there? Thanks
Ganeshka Posted November 8, 2017 Posted November 8, 2017 give me your mail i will send you Librarry . You can use 4-6 displays from robotdyn
Ganeshka Posted November 8, 2017 Posted November 8, 2017 my code is simple . #include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x3f,16,2); #include "SevenSegmentTM1637.h" #define TM1637_MAX_LINES 1 // number of display lines #define TM1637_MAX_COLOM 6 // number of coloms (digits) SevenSegmentTM1637 am(2,3); SevenSegmentTM1637 ama(4,5); SevenSegmentTM1637 uhf(6,7); SevenSegmentTM1637 ils(8,9); SevenSegmentTM1637 tacan(10,11); #define DCSBIOS_DEFAULT_SERIAL #include "DcsBios.h" void onCmsp1Change(char* newValue) { lcd.backlight(); lcd.setCursor(0,0); lcd.print(newValue[0]); lcd.print(newValue[1]); lcd.print(newValue[2]); lcd.print(newValue[3]); lcd.print(newValue[5]); lcd.print(newValue[6]); lcd.print(newValue[7]); lcd.print(newValue[8]); lcd.print(newValue[10]); lcd.print(newValue[11]); lcd.print(newValue[12]); lcd.print(newValue[13]); lcd.print(newValue[15]); lcd.print(newValue[16]); lcd.print(newValue[17]); lcd.print(newValue[18]); } DcsBios::StringBuffer<19> cmsp1Buffer(0x1000, onCmsp1Change); void onCmsp2Change(char* newValue) { lcd.setCursor(0, 1); lcd.print(newValue[0]); lcd.print(newValue[1]); lcd.print(newValue[2]); lcd.print(newValue[4]); lcd.print(newValue[5]); lcd.print(newValue[6]); lcd.print(newValue[7]); lcd.print(newValue[9]); lcd.print(newValue[10]); lcd.print(newValue[11]); lcd.print(newValue[12]); lcd.print(newValue[14]); lcd.print(newValue[15]); lcd.print(newValue[16]); lcd.print(newValue[17]); lcd.print(newValue[18]); } DcsBios::StringBuffer<19> cmsp2Buffer(0x1014, onCmsp2Change); void onVhfamFreq1Change(char* newValue) { am.setCursor(0,0); am.print(newValue); } DcsBios::StringBuffer<2> vhfamFreq1StrBuffer(0x1190, onVhfamFreq1Change); void onVhfamFreq2Change(unsigned int newValue) { am.setCursor(0,3); am.print(newValue); } DcsBios::IntegerBuffer vhfamFreq2Buffer(0x118e, 0x00f0, 4, onVhfamFreq2Change); void onVhfamFreq3Change(unsigned int newValue) { ama.setCursor(0,0); ama.print(newValue); } DcsBios::IntegerBuffer vhfamFreq3Buffer(0x118e, 0x0f00, 8, onVhfamFreq3Change); void onVhfamFreq4Change(char* newValue) { ama.setCursor(0,2); ama.print(newValue); } DcsBios::StringBuffer<2> vhfamFreq4StrBuffer(0x1192, onVhfamFreq4Change); void onUhfFrequencyChange(char* newValue) { uhf.setCursor(0,1); uhf.print(newValue[1]); uhf.setCursor(0,2); uhf.print(newValue[0]); uhf.setCursor(0,0); uhf.print(newValue[2]); uhf.setCursor(0,5); uhf.print(newValue[4]); uhf.setCursor(0,4); uhf.print(newValue[5]); uhf.setCursor(0,3); uhf.print(newValue[6]); } DcsBios::StringBuffer<7> uhfFrequencyBuffer(0x1180, onUhfFrequencyChange); void onIlsMhzChange(char* newValue) { ils.on(); ils.setCursor(0,1); ils.print(newValue[1]); ils.setCursor(0,2); ils.print(newValue[0]); ils.setCursor(0,0); ils.print(newValue[2]); } DcsBios::StringBuffer<3> ilsMhzStrBuffer(0x116e, onIlsMhzChange); void onIlsKhzChange(char* newValue) { ils.setCursor(0,4); ils.print(newValue[0]); ils.setCursor(0,3); ils.print(newValue[1]); ils.printRaw(128,5); } DcsBios::StringBuffer<2> ilsKhzStrBuffer(0x1172, onIlsKhzChange); void onTacanChannelChange(char* newValue) { tacan.print(newValue); } DcsBios::StringBuffer<4> tacanChannelBuffer(0x1162, onTacanChannelChange); void setup() { DcsBios::setup(); lcd.init(); am.init(); am.clear(); ama.init(); ama.clear(); uhf.init(); uhf.clear(); uhf.printRaw(256,5); uhf.printRaw(256,4); ils.init(); ils.clear(); ils.printRaw(256,5); ils.printRaw(256,4); tacan.init(); } void loop() { DcsBios::loop(); }
Ganeshka Posted November 8, 2017 Posted November 8, 2017 https://ru.aliexpress.com/item/4-Digit-LED-0-36-Display-Tube-decimal-7-segments-GREEN-TM1637-disp-size-30x14mm/32795864597.html?spm=a2g0s.9042311.0.0.80ZojL https://ru.aliexpress.com/item/6-Digit-LED-0-36-Display-Tube-decimal-7-segments-WHITE-TM1637-disp-size-46x14mm/32798356812.html?spm=a2g0s.9042311.0.0.80ZojL 8 digits , have different chip on it and its not work with this librarry
Regnad517 Posted November 8, 2017 Author Posted November 8, 2017 (edited) Thank you so much for the sample code Ganeshka, I see what I was doing wrong simply from that! I can't wait to actually start putting this all together and posting some pics! Edited November 8, 2017 by Regnad517
GC-I4_NieA Posted November 8, 2017 Posted November 8, 2017 From this: display.showNumberDec(newValue); newValue is understood as an integer, but your function returns a char type. So if you would need to convert. Usually writting something like : display.showNumberDec(newValue[0]); you would indicate that you want the char value of this integer. My 2 cents
FSFIan Posted November 8, 2017 Posted November 8, 2017 From this: display.showNumberDec(newValue); newValue is understood as an integer, but your function returns a char type. So if you would need to convert. Usually writting something like : display.showNumberDec(newValue[0]); you would indicate that you want the char value of this integer. My 2 cents newValue[0] is the first character of that string. If you pass that to a function that expects a number, it will just display the ASCII value of that character. If you use the "print" function (which expects to deal with characters) instead of "showNumberDec", it should behave correctly, including blanking the display when there is a space (IIRC the display is blank when there is no electrical power available). DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua
GC-I4_NieA Posted November 9, 2017 Posted November 9, 2017 I see, thanks for pointing it out Ian. Cheers,
Recommended Posts