Tag Archives: summary

Seg 6: Experiment and code


Figure 6-8 Experimental circuits

byte seven_seg_digits[10][8] = { // set the code array by the number and pins

{ 1,1,1,1,1,1,1,0 }, // = 0

{ 0,0,1,1,1,0,0,0 }, // = 1

{ 1,1,0,1,1,1,0,1 }, // = 2

{ 0,1,1,1,1,1,0,1 }, // = 3

{ 0,0,1,1,1,0,1,1 }, // = 4

{ 0,1,1,1,0,1,1,1 }, // = 5

{ 1,1,1,1,0,1,1,1 }, // = 6

{ 0,0,1,1,1,1,0,0 }, // = 7

{ 1,1,1,1,1,1,1,1 }, // = 8

{ 0,1,1,1,1,1,1,1 } // = 9

};

void setup() { //set 4-11 as OUTPUT

pinMode(4, OUTPUT);

pinMode(5, OUTPUT);

pinMode(6, OUTPUT);

pinMode(7, OUTPUT);

pinMode(8, OUTPUT);

pinMode(9, OUTPUT);

pinMode(10, OUTPUT);

pinMode(11, OUTPUT);

}

void sevenSegWrite(byte digit) { //set the digital array by the order of the ports 4-11 on arduino

byte pin = 4;

for (byte segCount = 0; segCount < 8; ++segCount) {

digitalWrite(pin, seven_seg_digits[digit][segCount]);

++pin;

}

}

void loop() { //display the digital number by reverse order

for (byte count = 10; count > 0; –count) {

delay(1000);

sevenSegWrite(count – 1);

}

delay(2000);

}

6-5 Key points and summaries

  1. Nixie tube can be divided into the common anode and cathode. The judgments may have Arduino used directly and multimeter.
  2. We should know the order of the pins by digital number and letter. This can help us to get the code array for each digital number.
  3. When encoding, we should connect the pins of nixie tube and the ports on the Arduino. It will be difficult to connect each other with error.