My basic Arduino kit included a HS420361K-32 device and I hooked it up and it works just fine, but no ground?
// assigning arduino digital pins for the various led display pins
int pinA = 3;
int pinB = 7;
int pinC = 12;
int pinD = 10;
int pinE = 9;
int pinF = 4;
int pinG = 13;
int pinDP = 11; // the decimal point pin
int D1 = 2;
int D2 = 5;
int D3 = 6;
int D4 = 8;
int t = 250; // time delay
void setup()
{
// initialise the digital pins as outputs.
pinMode(pinA, OUTPUT);
pinMode(pinB, OUTPUT);
pinMode(pinC, OUTPUT);
pinMode(pinD, OUTPUT);
pinMode(pinE, OUTPUT);
pinMode(pinF, OUTPUT);
pinMode(pinG, OUTPUT);
pinMode(pinDP, OUTPUT);
pinMode(D1, OUTPUT);
pinMode(D2, OUTPUT);
pinMode(D3, OUTPUT);
pinMode(D4, OUTPUT);
}
void loop()
{
write_D1(); //function call to turn on D1 to write characters for the first digit
print_3(); // function call to display 3
print_decimal(); // function call to display the decimal point
delay(1);
write_D2(); //function call to turn on D2 to write characters for the second digit
print_1(); // function call to display 1
delay(1);
write_D3(); //function call to turn on D3 to write characters for the third digit
print_4(); // function call to display 4
delay(1);
write_D4(); //function call to turn on D4 to write characters for the fourth digit
print_2(); // function call to display 2
delay(1);
}
/* THE FUNCTIONS */
// the functions for selecting the common pin to turn on
void write_D1()
{
digitalWrite(D1, LOW);
digitalWrite(D2, HIGH);
digitalWrite(D3, HIGH);
digitalWrite(D4, HIGH);
}
void write_D2()
{
digitalWrite(D1, HIGH);
digitalWrite(D2, LOW);
digitalWrite(D3, HIGH);
digitalWrite(D4, HIGH);
}
void write_D3()
{
digitalWrite(D1, HIGH);
digitalWrite(D2, HIGH);
digitalWrite(D3, LOW);
digitalWrite(D4, HIGH);
}
void write_D4()
{
digitalWrite(D1, HIGH);
digitalWrite(D2, HIGH);
digitalWrite(D3, HIGH);
digitalWrite(D4, LOW);
}
// the functions for writing characters to the display
void print_0() // writing 0
{
digitalWrite(pinA, HIGH);
digitalWrite(pinB, HIGH);
digitalWrite(pinC, HIGH);
digitalWrite(pinD, HIGH);
digitalWrite(pinE, HIGH);
digitalWrite(pinF, HIGH);
digitalWrite(pinG, LOW);
digitalWrite(pinDP, LOW); // the decimal point is always off by default
}
void print_1() // writing 1
{
digitalWrite(pinA, LOW);
digitalWrite(pinB, HIGH);
digitalWrite(pinC, HIGH);
digitalWrite(pinD, LOW);
digitalWrite(pinE, LOW);
digitalWrite(pinF, LOW);
digitalWrite(pinG, LOW);
digitalWrite(pinDP, LOW);
}
the display has LEDs powered by two pins, however there is no ground used here. Somehow a pin is called D4 and it becomes the cathode when set low. I thought you had to have a ground somewhere to get current to flow. I am lost.


