sending the value of a variable to a Seven Segment Display

*/this is the segment mapping I found online for controlling a 2 digit 7 segment
display without using shift registers or multiplexers. Everything here works with
the count up timer, but just want to know how to make it display a single digit
number in one of the digits. Common cathode display. */

#define CA1 5 // digit 1 common
#define CA2 A5 // digit 2 common
#define A 4
#define B 2
#define C 6
#define D 7
#define E 8
#define FF 9
#define G 10

// segment map

const int segs[7] = { A, B, C, D, E, FF, G };

// number map for segments common cathode

const byte numbers[10] = { 0b1000000,
0b1111001,
0b0100100,
0b0110000,
0b0011001,
0b0010010,
0b0000010,
0b1111000,
0b0000000,
0b0010000 };

void setup() {

pinMode(CA1, OUTPUT); // outputs to display set
pinMode(CA2, OUTPUT); // CA1 & 2 are the commons
pinMode(A, OUTPUT); // for each digit.
pinMode(B, OUTPUT); // A-G are the segments
pinMode(C, OUTPUT);
pinMode(D, OUTPUT);
pinMode(E, OUTPUT);
pinMode(FF, OUTPUT);
pinMode(G, OUTPUT);

}

void loop(){

// how to print the number “6”, or any single digit variable to the display
// if someone can tell be how to do that, then I will
// be able to take my themostat/humidistat from 630 lines of code
// to less than 100. My current code is filled with delays and GOTO
// statements, and repetative if statements for each number in the tens and
// ones place. Every bit of code listed is correct, except I have NO
// IDEA what to do inside the void loop(){}

}

Figure out which pins on the 7-segment display are needed to make your "6" appear. Then map those to the pins you've connected to on the Arduino.

Then it is just a matter of using digitalWrite() to turn the pins on or off, appropriately.

Looks like the number[] array is attempting to create a "digit" map for you.

That program cropped up recently. I hate the way the segments are defined! Not helpful at all. So I rewrote it.

// Arduino digital pins used to light up
// corresponding segments on the LED display
// Pushbuttons connected to pin 10
#define button1 10

// Pins driving common anodes
#define commonAnode1 13
#define commonAnode2 12

// Pins for A B C D E F G, in sequence
const byte segs[7] = { 2, 3, 4, 5, 6, 7, 8 };

// Segments that make each number
const byte numbers[10] = {
  0b1000000, 0b1111001, 0b0100100, 0b0110000, 0b0011001, 0b0010010, 0b0000010,
  0b1111000, 0b0000000, 0b0010000}; //logic 0 to turn on segment

void setup()
{
  // segment pins
  for (int i=0; i<7; i++)
  {
    pinMode(segs[i], OUTPUT);
  }
  // cathode pins
  pinMode(commonAnode1, OUTPUT);
  pinMode(commonAnode2, OUTPUT);

  pinMode(button1, INPUT);

}

int units;
int tens;

void loop()
{
  showUnitsDigit(units);
  delay(5);
  showTenthsDigit(tens);
  delay(5);
// check button
  if (digitalRead(button1) == HIGH)
  {
    units = (units + 1) % 10;
    if (units == 0)
        tens = (tens + 1) % 10;
    delay(5);  //debounce delay for button
    while (digitalRead(button1) == HIGH);  //wait for button release
  }
}


void showUnitsDigit(byte number)
{
  digitalWrite(commonAnode1, LOW); //set the LED off
  digitalWrite(commonAnode2, HIGH); //set the LED on
  lightSegments(number);
}


void showTenthsDigit(byte number)
{
  digitalWrite(commonAnode2, LOW); //set the LED off
  digitalWrite(commonAnode1, HIGH); //set the LED on
  lightSegments(number);
}


void lightSegments(byte number)
{
  for (int i = 0; i < 7; i++)
  {
    int bit = bitRead(number, i);
    digitalWrite(segs[i], bit);
  }
}

I’d be glad to help you “chop it down” if you get stuck, but basically you can remove the scan code since you have only one digit. The function lightSegments() will be useful to you.