Hello,
I've been working on a simpit for the F18C and understand the basic principles of how to connect everything with Arduino but recently I have some problems getting the 7 segment displays to work for my UFC. As a test I'd like to show the first row of 4 characters on my 4 7 segment displays. When I try this however the characters do not display correctly, this is clearly a fault in my coding (a simple counter works without DCS-bios) but I can't figure out where it went wrong.
I am using an Arduino NANO with DCS-BIOS.
Code:
#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"
#include "SevSeg.h"
SevSeg sevseg; //Instantiate a seven segment controller object
void onUfcComm1DisplayChange(char* newValue)
{
sevseg.setChars(newValue);
}
DcsBios::StringBuffer<2> ufcComm1DisplayBuffer(0x7424, onUfcComm1DisplayChange);
void setup()
{
byte numDigits = 4;
byte digitPins[] = {2, 3, 4, 5};
byte segmentPins[] = {6, 7, 8, 9, 10, 11, 12, 13};
bool resistorsOnSegments = false; // 'false' means resistors are on digit pins
byte hardwareConfig = COMMON_ANODE; // See README.md for options
bool updateWithDelays = false; // Default 'false' is Recommended
bool leadingZeros = true; // Use 'true' if you'd like to keep the leading zeros
bool disableDecPoint = false; // Use 'true' if your decimal point doesn't exist or isn't connected
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments,
updateWithDelays, leadingZeros, disableDecPoint);
DcsBios::setup();
}
void loop()
{
sevseg.refreshDisplay(); // Must run repeatedly
DcsBios::loop();
}