Jump to content

ECV56_Polten

Members
  • Posts

    43
  • Joined

  • Last visited

About ECV56_Polten

  • Birthday 05/30/1972

Personal Information

  • Flight Simulators
    A-10C/II, Black Shark 2, Mig-15Bis, Mi-8MTV2, AJS37 Viggen, Flaming Cliffs 3, NTTR, PG, HB F-14, AH-64D
  • Location
    CABA, Argentina
  • Interests
    SimFlight, SimRacing

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Me uno al tema, primero para felicitar y agradecer a Japo32 por tremendo laburo que se mandó, y segundo, Francia... bueno, en realidad lo segundo es avisar que algunos piernógrafos no aparecen, como los del F-14 por ejemplo ¿Puedes resubirlos por favor?
  2. As stated in the title, I tried buying the upgrade version of BS3 from Steam, but after entering the payment info a message appears saying it is not possible because "I don´t have Black Shark 2" Is there a process to let Steam detect that I have BS2, or I am forced to buy it from ED?
  3. I have been away from the forum these days, hence the delay answering this thread. First of all, you must correct your "if" blocks in the onPltVuhfRemoteDispChange segment, because you are using the wrong operator. When you use "=" you are assigning a value to a variable, so, when you write if (i = 0) showDigit(i, newValue[i] - 48, 0); what you are telling there, is assign the value 0 to variable i, then evaluate if the value of i is true or false (since i = 0, it will be false; any integer value greater than 0 is true) and it will not run the showdigit part of the code. The correct operator is "==", which is the equality operator. Taking the same example, you should write it like: if (i == 0) showDigit(i, newValue[i] - 48, 0); Then you need to change all the "=" in your if blocks to "==". I have reread my responses, and made this same mistake in almost all of them, sorry for that. You can read about C language operator in https://www.programiz.com/c-programming/c-operators. Once again, I advice you to get a good C programming or Arduino programming book, and/or watch some tutorials about it in Youtube.
  4. Try this code; if it works, I will celebrate with a glass of my finest whiskey, if not, I will drown my sorrow in a glass of my finest whiskey ;-) #define DCSBIOS_IRQ_SERIAL #include <DcsBios.h> const int clockpin = 7; //SCK const int latchpin = 5; //RCK const int datapin = 6; //DIO const int num_of_digits = 6; /* Segment bit location(7=MSB, 0=LSB): * * |--0--| * 5| |1 * |--6--| * 4| |2 * |--3--| **7 */ // Array with possible values(0 = segment ON, 1 = segment off) byte value[] ={ B11000000, // 0 B11111001, // 1 B10100100, // 2 B10110000, // 3 B10011001, // 4 B10010010, // 5 B10000010, // 6 B11111000, // 7 B10000000, // 8 B10010000, // 9 B11111111};// display nothing byte digit[] ={ B00010000, // left segment B00100000, B01000000, B00000001, B00000010, B00000100,};// right segment void showDigit(int segmentnum, int number, bool showdecimalpoint) { digitalWrite(latchpin,LOW); byte value_temp = value[number]; value_temp = showdecimalpoint ? (value_temp & B01111111) : value_temp; shiftOut(datapin,clockpin,MSBFIRST,value_temp); shiftOut(datapin,clockpin,MSBFIRST,digit[segmentnum]); digitalWrite(latchpin,HIGH); } void setup() { pinMode(clockpin, OUTPUT); pinMode(latchpin, OUTPUT); pinMode(datapin, OUTPUT); DcsBios::setup(); } void loop() {; DcsBios::loop(); } void onPltVuhfRemoteDispChange(char* newValue) { int lenNewValue = String(newValue).length(); // get the length of newValue if (String(newValue).indexOf('.') >= 0) { lenNewValue--; // if newValue has a decimal point, I substract 1 to lenNewValue } // get the position of the decimal point and substract 1 to pair it with the segment position of the preceding number int pointPos = String(newValue).indexOf('.') - 1; // if the value to display does not contain a decimal point indexOf will return -1 so pointPos would be -2 in that case if (lenNewValue < num_of_digits) { for (int i = 0; i < lenNewValue; i++) { showDigit(i, 10, 0); // this will display nothing in the first segments if the length of newValue has less tnan 6 digits } } for (int i = num_of_digits - 1; i >= (num_of_digits - lenNewValue); i--) { if (i == pointPos + (num_of_digits - lenNewValue)) { showDigit(i, String(newValue[i - (num_of_digits - lenNewValue)]).toInt(), 1); // toInt() will convert the char to an integer value since showDigit expect this type as second parameter (for example, it will convert the char '5' - which has a value of 53 in the ASCII table, to 5 } else { showDigit(i, String(newValue[i - (num_of_digits - lenNewValue)]).toInt(), 0); // otherwise, only turn on the segments of the digit to display only } } } DcsBios::StringBuffer<7> pltVuhfRemoteDispBuffer(0x1484, onPltVuhfRemoteDispChange);
  5. I am at the office right now, so I can not give you a thorough response, but your code is showing so many decimal points because the "if" blocks are all "true" at some point in the execution. Yesterday night I run some tests in an LCD 1602 I2C display; based on the results I think the code will require some minor changes. I will try to get back at this as soon as I can, in the meantime don't give up, and I suggest you get some good book or tutorial about C programming or Arduino programming, you need a better understanding of the programming logic.
  6. If the code above still don't work, then, try this void onPltVuhfRemoteDispChange(char* newValue) { //trying to pull the char* array into each digit with the bool decimal with a delay to show the number(?) if (atoi(newValue) > 0) { for (int i = 0; i < strlen(newValue); i++) { if (i = 2) showDigit(i, String(newValue[i]).toInt(), 1); else showDigit(i, String(newValue[i]).toInt(), 0); } } } DcsBios::StringBuffer<7> pltVuhfRemoteDispBuffer(0x1484, onPltVuhfRemoteDispChange);
  7. Mmm. that's odd, when I compiled the code in my Arduino IDE it showed no errors or warnings. Just as a test, change the definition of onPltVuhfRemoteDispChange to this: void onPltVuhfRemoteDispChange(char* newValue) { //trying to pull the char* array into each digit with the bool decimal with a delay to show the number(?) if (atoi(newValue) > 0) { for (int i = 0; i < strlen(newValue); i++) { if (i = 2) showDigit(i, newValue[i] - 48, 1); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 else showDigit(i, newValue[i] - 48, 0); // atoi function removed and char converted to int as shown in https://forum.arduino.cc/index.php?topic=443605.0 } } } DcsBios::StringBuffer<7> pltVuhfRemoteDispBuffer(0x1484, onPltVuhfRemoteDispChange);
  8. Final code... maybe Ok, I think I have it, try this code and let me know: #define DCSBIOS_IRQ_SERIAL #include <DcsBios.h> const int clockpin = 7; //SCK const int latchpin = 5; //RCK const int datapin = 6; //DIO const int num_of_digits = 6; /* Segment bit location(7=MSB, 0=LSB): * * |--0--| * 5| |1 * |--6--| * 4| |2 * |--3--| **7 */ // Array with possible values(0 = segment ON, 1 = segment off) byte value[] ={ B11000000, // 0 B11111001, // 1 B10100100, // 2 B10110000, // 3 B10011001, // 4 B10010010, // 5 B10000010, // 6 B11111000, // 7 B10000000, // 8 B10010000, // 9 B11111111};// display nothing byte digit[] ={ B00010000, // left segment B00100000, B01000000, B00000001, B00000010, B00000100,};// right segment void showDigit(int segmentnum, int number, bool showdecimalpoint) { digitalWrite(latchpin,LOW); byte value_temp = value[number]; value_temp = showdecimalpoint ? (value_temp & B01111111) : value_temp; shiftOut(datapin,clockpin,MSBFIRST,value_temp); shiftOut(datapin,clockpin,MSBFIRST,digit[segmentnum]); digitalWrite(latchpin,HIGH); } void setup() { pinMode(clockpin, OUTPUT); pinMode(latchpin, OUTPUT); pinMode(datapin, OUTPUT); DcsBios::setup(); } void onPltVuhfRemoteDispChange(char* newValue) { //trying to pull the char* array into each digit with the bool decimal with a delay to show the number(?) if (atoi(newValue) > 0) { for (int i = 0; i < strlen(newValue); i++) { if (i = 2) showDigit(i, atoi(newValue[i]), 1); else showDigit(i, atoi(newValue[i]), 0); } } } DcsBios::StringBuffer<7> pltVuhfRemoteDispBuffer(0x1484, onPltVuhfRemoteDispChange); void loop() { DcsBios::loop(); } For what I have been reading when you TM1637 arrive it will be way much easier to code.
  9. While I examine the rest of the code, correct yours in the onPltVuhfRemoteDispChange section to this: void onPltVuhfRemoteDispChange(char* newValue) { //trying to pull the char* array into each digit with the bool decimal with a delay to show the number(?) for (int i = 0; i < strlen(newValue); i++) { if (i = 2) showDigit(i, newValue[i], 1); else showDigit(i, newValue[i], 0); } } DcsBios::StringBuffer<7> pltVuhfRemoteDispBuffer(0x1484, onPltVuhfRemoteDispChange);
  10. You call that generic? I hate you :)
  11. Ah, crap! forget about what I wrote below in this post; I haven't pay attention to the comment you put in the for loop //trying to push loop to show digit by saying something like if the char # is bigger then 0, display and show digit. Totally losing my self in the logic. I am leaving the text only to show you how to write a for loop, but I think I understand what you are trying to do, but since like I told I don't have a 6 digit module, I would try to make a guess and some assumptions to help you code this. In the meantime, if someone else can shed some light with this, please do so. Previous text I wrote The problem in the loop() is because the for definition is wrong. for(char i = * ; i < 0 ; i) The correct syntax in C for a for loop can be explained like this: for (type variable_name_here (usually "i") = initial_value; condition_to_stop the loop; increment_or_decrement) So, if I want a loop to run some code 5 times, it will look like: for (int i = 1; i <= 5; i++) { // code to run 5 times; } You have: for(char i = * You can use char instead of int, but you will be limited to values from 0 to 255, if your code does not need to be run more then 256 times, you can leave it as char. The "= *" segment is incorrect, you will need a number, so I am guessing it should be "= 0" or "=1" Then you have "i < 0", in this case it would be correct if you need the for loop to count in reverse order, but then, the first part should have a value greater than 0; taking the previous example, it would be like these if I want a code to be run 5 times but counting in reverse: for (int i = 5; i >= 0; i--) { // code to run 5 times; } Finally, you end the for definition with "; i)", so you are not telling if the value of i should be incremented (i++) or decremented (i--)
  12. There seems to be a problem on the onIasEuIntChange and onIasUsIntChange, or maybe a bug in DCS (never happened before, right?) I changed the code to use onIasEuChange and onIasUsChange, and a char array to int conversion, and it works; here's the code I used: #define DCSBIOS_DEFAULT_SERIAL #include <LiquidCrystal_I2C.h> #include "DcsBios.h" LiquidCrystal_I2C lcd(0x27, 16, 2); unsigned int SpeedEu; unsigned int SpeedUs; void setup() { // put your setup code here, to run once: ScreenSetup(); DcsBios::setup(); } void loop() { DisplayScreen(); DcsBios::loop(); } void ScreenSetup() { lcd.init(); lcd.backlight(); lcd.clear(); lcd.setCursor(0,0); lcd.print("kmh"); lcd.setCursor(8, 0); lcd.print("Knots"); } void DisplayScreen() { lcd.setCursor(0, 1); lcd.print(SpeedEu); lcd.setCursor(8, 1); lcd.print(SpeedUs); } void onIasUsChange(char* newValue) { SpeedUs = atoi(newValue); } DcsBios::StringBuffer<4> iasUsBuffer(0x0426, onIasUsChange); void onIasEuChange(char* newValue) { SpeedEu = atoi(newValue); } DcsBios::StringBuffer<4> iasEuBuffer(0x0422, onIasEuChange); Image shown below displaying an F-14 speed in Km/h and Knots. I also tried the same on Ka-50, no issues so far.
  13. I tried your code dracosb but it keeps showing odd values
  14. I changed the address to 0x0424, and now it shows values on the LCD, but the incorrect ones, unless an F-14B can fly at speeds exceding Mach 10 :unsure: It shows values in the range of 12000 to 14000+
  15. I took a second look to your post, and after examining your found code, now I know that your showDigit calls are lacking arguments. Look at the found code example, when it calls showDigit in loop() void loop() {; for(int i = 0; i < num_of_digits; i++) { showDigit(i, i, true); /*[b]<--- It is using three arguments, not one[/b]*/ demoDelay(); } } So, we can assume for sure that that is one of your problems with the code, I don't know if it is the only one, but correct that and let me know if something changed.
×
×
  • Create New...