Jump to content

DonaldStrehl

Members
  • Posts

    10
  • Joined

  • Last visited

Recent Profile Visitors

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

  1. Hey, it works very good, thank you for sharing your code.
  2. Thank you for the fast answer. This ist the link I will try it, when i am at home.
  3. Hello, i found this Code /* F-16 Total Fuel Gauge Thanks to: Middlefart (Original code), Fusion and Fusion's Wife (software engineer) Code is for the 128x32 oled i2c display. All you have to do is add your motor pins and guage backlight pins if desired. Hope this helps others! DCS-BIOS has made things far easier for DCS than software made to drive simulator components in FalconBMS. Glad to be apart of the DCS world. Matt "Fusion" G. */ //#define DCSBIOS_DEFAULT_SERIAL #define DCSBIOS_DEFAULT_SERIAL #include "DcsBios.h" #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #include "characters.h" #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 32 // OLED display height, in pixels // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); int AB; float Value1; float Value2; float Value3; float Total; unsigned long time = 0; unsigned int i = 0; //Comment for barometric pressure #define ALTIMETER int updateInterval = 100; //the number of milliseconds between updates struct scrollDigit { int digit; //The digit that is displayed int y; // The vertical position of the digit }; struct disp { Adafruit_SSD1306 display; int width; int numberOfDigits; scrollDigit digits[5]; }; //disp oled = {Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET), 24, 5, {{0,0},{0,0},{0,0},{0,0},{0,0}}}; disp oled = {Adafruit_SSD1306(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET), 16, 5, {{0,0},{0,0},{0,0},{0,0},{0,0}}}; void setup() { if(!oled.display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32 for(;;); // Don't proceed, loop forever } DcsBios::setup(); } void UpdateDisplay() { oled.display.clearDisplay(); for (int i = 0; i < oled.numberOfDigits; i++) { printScrollingDigit(oled.digits[i].digit, oled.width, oled.digits[i].y, i + 1, &oled); } //Clear the area below the the numbers if we are using the small font if (oled.width == 16) { oled.display.fillRect(0, 30, 127, 7, BLACK); } oled.display.display(); } int YPos() { return ((oled.width + 9) * -1); } void printScrollingDigit(int digit, int width, int y, int pos, disp *oled) { int x = (width * pos) - width + pos + 30; y +=5; switch (digit) { case -1: oled->display.drawBitmap(x, y, c16_0, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_1, 16, 24, 1); break; case 1: oled->display.drawBitmap(x, y, c16_1, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_2, 16, 24, 1); break; case 2: oled->display.drawBitmap(x, y, c16_2, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_3, 16, 24, 1); break; case 3: oled->display.drawBitmap(x, y, c16_3, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_4, 16, 24, 1); break; case 4: oled->display.drawBitmap(x, y, c16_4, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_5, 16, 24, 1); break; case 5: oled->display.drawBitmap(x, y, c16_5, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_6, 16, 24, 1); break; case 6: oled->display.drawBitmap(x, y, c16_6, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_7, 16, 24, 1); break; case 7: oled->display.drawBitmap(x, y, c16_7, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_8, 16, 24, 1); break; case 8: oled->display.drawBitmap(x, y, c16_8, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_9, 16, 24, 1); break; case 9: oled->display.drawBitmap(x, y, c16_9, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_0, 16, 24, 1); break; default: if (pos < 3) { oled->display.drawBitmap(x, y, c16_0, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_1, 16, 24, 1); } else { oled->display.drawBitmap(x, y, c16_0, 16, 24, 1); oled->display.drawBitmap(x, y+25, c16_0, 16, 24, 1); } break; } } void onFueltotalizer10kChange(unsigned int newValue) { unsigned int mappedValue = newValue / 6553; unsigned int y = map(newValue, mappedValue * 6553, mappedValue * 6553 + 6553, 0, YPos()); if (mappedValue == 0) { mappedValue = -1; } #ifdef TEST Serial.println(mappedValue); #endif oled.digits[0].digit = mappedValue; oled.digits[0].y = y; } void onFueltotalizer1kChange(unsigned int newValue) { unsigned int mappedValue = newValue / 6553; unsigned int y = map(newValue, mappedValue * 6553, mappedValue * 6553 + 6553, 0, YPos()); oled.digits[1].digit = mappedValue; oled.digits[1].y = y; } void onFueltotalizer100Change(unsigned int newValue) { unsigned int mappedValue = newValue / 6553; unsigned int y = map(newValue, mappedValue * 6553, mappedValue * 6553 + 6553, 0, YPos()); oled.digits[2].digit = mappedValue; oled.digits[2].y = y; oled.digits[3].digit = 0; oled.digits[3].y = y; oled.digits[4].digit = 0; oled.digits[4].y = y; } DcsBios::IntegerBuffer fueltotalizer10kBuffer(0x44e4, 0xffff, 0, onFueltotalizer10kChange); DcsBios::IntegerBuffer fueltotalizer1kBuffer(0x44e6, 0xffff, 0, onFueltotalizer1kChange); DcsBios::IntegerBuffer fueltotalizer100Buffer(0x44e8, 0xffff, 0, onFueltotalizer100Change); void loop() { DcsBios::loop(); time = millis(); if (time % updateInterval == 0) { UpdateDisplay(); } } in the internet to Output the total fuel counter. But in the line with #include "characters.h" the compiler shows me an error. The file cannot found. How could i fix it?
  4. After the takeoff in a mission, the flares counter goes to zero.
  5. Schade, ich habe jetzt alles hinbekommen, nur die analogen Anzeigen nicht. Ich hab gemerkt irgendwann gehen einem die USB Buchsen aus. Da möchte ich mir ein paar sparen und es mit diesem PCA Board zu realisieren.
  6. Ich habe jetzt erstmal versucht nur einen Servo an den Nano anzuschließen. Allerdings macht er nicht das was er soll. Als Beispiel die ENGINE RPM wenn der Schubhebel auf 100 % steht bewegt sich der Servo allerdings dreht er sich solange bis er irgendwann zu heiß wird und ich abschalten muss. Hat das schonmal jemand gehabt? //#define DCSBIOS_DEFAULT_SERIAL #define DCSBIOS_IRQ_SERIAL #include <Arduino.h> #include <Servo.h> #include "DcsBios.h" //DcsBios::ServoOutput engineOilPressure(0x44cc, 3, 8000, 544); //DcsBios::ServoOutput engineNozzlePosition(0x44ce,PIN, 544, 2400); DcsBios::ServoOutput engineTachometer(0x44d0,3, 50, 200, [](unsigned int newValue) -> unsigned int { // diese Funktion muss den Wert, den DCS-BIOS sendet (zwischen 0 und 65535) // in die Pulsbreite fuer den Servo umrechnen return map(newValue, 0, 65535, 50, 200); }); //DcsBios::ServoOutput engineFtit(0x44d2,PIN, 544, 2400); //DcsBios::ServoOutput sysaPressure(0x44c8,PIN, 544, 2400); //DcsBios::ServoOutput sysbPressure(0x44ca,PIN, 544, 2400); //DcsBios::ServoOutput cockpitAlititude(0x44e6,PIN, 544, 2400); //DcsBios::ServoOutput oxygenPressure(0x44e8,PIN, 544, 2400); //DcsBios::ServoOutput fuelFr(0x44de,PIN, 544, 2400); //DcsBios::ServoOutput fuelAl(0x44dc,PIN, 544, 2400); void setup() { DcsBios::setup(); } void loop() { DcsBios::loop(); }
  7. Hallo, ich habe folgendes vor und benötige ein bisschen Unterstützung. Meine Absicht ist es, mittels eines Arduino Nano oder UNO die analogen Anzeigen der Viper zum Leben zu erwecken. Dazu stelle ich mir vor den Nano/UNO per I2C an ein PCA 9586 anzuschließen. Dieser soll dann 11 Servos steuern. Das PCA9586 Board wird mit einer externen Spannungsversorgung von 5 Volt gespeist um die Servos mit Strom zu versorgen. Bei den ServoOutput Commands von DCS Bios muss ich den PIN angeben, da kann ich ja nicht den vom PCA9586 nehmen. Woher soll der Nano/Uno wissen das an dem PCA9586 Board an Pin 2 der Servo für Oil Pressure ist. Ich denke es muss die Verbindung in Form einer Variablen vom UNO an das PCA 9586 in den ServoOutput Commands gesetzt werden. Meine Idee war die Funktion pwm.setPWM einer Variablen zuzuweisen und diese Variable anstelle des Pins einzutragen. Allerdings funktioniert es nicht. Hat jemand Ideen oder Vorschläge wie das gelöst werden kann? //#define DCSBIOS_DEFAULT_SERIAL #define DCSBIOS_IRQ_SERIAL #include "DcsBios.h" #include <Arduino.h> #include <Servo.h> #include <Adafruit_PWMServoDriver.h> #include <Wire.h> Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(); int pwm.setPWM(2) = oil DcsBios::ServoOutput engineOilPressure(0x44cc, oil, 544, 2400); //DcsBios::ServoOutput engineNozzlePosition(0x44ce,PIN, 544, 2400); //DcsBios::ServoOutput engineTachometer(0x44d0,PIN, 544, 2400); //DcsBios::ServoOutput engineFtit(0x44d2,PIN, 544, 2400); //DcsBios::ServoOutput sysaPressure(0x44c8,PIN, 544, 2400); //DcsBios::ServoOutput sysbPressure(0x44ca,PIN, 544, 2400); //DcsBios::ServoOutput cockpitAlititude(0x44e6,PIN, 544, 2400); //DcsBios::ServoOutput oxygenPressure(0x44e8,PIN, 544, 2400); //DcsBios::ServoOutput fuelFr(0x44de,PIN, 544, 2400); //DcsBios::ServoOutput fuelAl(0x44dc,PIN, 544, 2400); void setup() { pwm.begin(); pwm.setPWMFreq(50); DcsBios::setup(); } void loop() { DcsBios::loop(); }
  8. Hello, is your Problem fixed? What fonts do you try?
  9. Hallo, ich habe vor das DED der Viper auf einem OLED 2.42 Zoll Display auszugeben. Ich nutze die U8G2 lib. Die Test Sketche laufen alle mittlerweile problemlos. Wenn ich aus dem DED nur eine Line anzeigen lasse, funktioniert das auch sehr gut und schnell. Sobald ich alle Lines ausgeben möchte, gibt das Display nur noch Teile aus. Es sieht so aus als wollte er in die bereits geschriebene Zeile den Text neu hinzufügen und dann kommt Quatsch heraus. Vielleicht kann mir jemand einen Rat geben. Ich danke schonmal in voraus. #define DCSBIOS_DEFAULT_SERIAL #include "DcsBios.h" #include <Arduino.h> #include <Wire.h> #include <U8g2lib.h> #include <U8x8lib.h> U8G2_SSD1309_128X64_NONAME0_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ 13); void onDedLine1Change(char* newValue) { /* your code here */ u8g2.setFont(u8g2_font_5x7_tf); u8g2.drawStr(0,10,newValue); u8g2.sendBuffer(); } DcsBios::StringBuffer<25> dedLine1Buffer(0x44fc, onDedLine1Change); void onDedLine2Change(char* newValue) { /* your code here */ u8g2.setFont(u8g2_font_5x7_tf); u8g2.drawStr(0,20,newValue); u8g2.sendBuffer(); } DcsBios::StringBuffer<25> dedLine2Buffer(0x4516, onDedLine2Change); void onDedLine3Change(char* newValue) { /* your code here */ u8g2.setFont(u8g2_font_5x7_tf); u8g2.drawStr(0,30,newValue); u8g2.sendBuffer(); } DcsBios::StringBuffer<25> dedLine3Buffer(0x4530, onDedLine3Change); void onDedLine4Change(char* newValue) { /* your code here */ u8g2.setFont(u8g2_font_5x7_tf); u8g2.drawStr(0,40,newValue); u8g2.sendBuffer(); } DcsBios::StringBuffer<25> dedLine4Buffer(0x454a, onDedLine4Change); void onDedLine5Change(char* newValue) { /* your code here */ u8g2.setFont(u8g2_font_5x7_tf); u8g2.drawStr(0,50,newValue); u8g2.sendBuffer(); } DcsBios::StringBuffer<25> dedLine5Buffer(0x4564, onDedLine5Change); void setup(void) { u8g2.begin(); // Start OLED DcsBios::setup(); } void loop(void) { DcsBios::loop(); }
×
×
  • Create New...