The title gives you the gist of the problem. Let me be more specific here. I'll start with the hardware. I'm using the parts in Mega 2560 R3 Starter Kit | SainSmart – SainSmart.com kit, plus a few little modifications I've made, such as soldering in a few pins onto the existing pins to add an extra connection. Next, here's the code. I apologize if it's a bit long. The idea is just that the Nixie tube counts up, then restarts. No big deal, right?
int a=7; //Top Horizontal
int b=6; //Top-Right
int c=5; //Bottom-Right
int d=11; //Bottom Horizontal
int e=10; //Bottom-Left
int f=8; //Top-Left
int g=9; //Middle Horizontal
int dp=4; //Decimal Point
//display number0
void digital_0(void)
{
unsigned char z;
for(z=4;z<=8;z++)
digitalWrite(z,HIGH);
digitalWrite(d,HIGH);
digitalWrite(e,HIGH);
digitalWrite(g,LOW);
}
//display number1
void digital_1(void)
{
unsigned char z;
digitalWrite(c,HIGH);// pin5 high, light up c
digitalWrite(b,HIGH);//light up b
for(z=7;z<=11;z++)//go out else
digitalWrite(z,LOW);
digitalWrite(dp,HIGH);//light up decimal point dp
}
//display number2
void digital_2(void)
{
unsigned char z;
digitalWrite(b,HIGH);
digitalWrite(a,HIGH);
for(z=9;z<=11;z++)
digitalWrite(z,HIGH);
digitalWrite(dp,HIGH);
digitalWrite(c,LOW);
digitalWrite(f,LOW);
}
// display number3
void digital_3(void)
{
unsigned char z;
digitalWrite(g,HIGH);
digitalWrite(d,HIGH);
for(z=5;z<=7;z++)
digitalWrite(z,HIGH);
digitalWrite(dp,HIGH);
digitalWrite(f,LOW);
digitalWrite(e,LOW);
}
// display number4
void digital_4(void)
{
digitalWrite(c,HIGH);
digitalWrite(b,HIGH);
digitalWrite(f,HIGH);
digitalWrite(g,HIGH);
digitalWrite(dp,HIGH);
digitalWrite(a,LOW);
digitalWrite(e,LOW);
digitalWrite(d,LOW);
}
// display number5
void digital_5(void)
{
unsigned char z;
for(z=7;z<=9;z++)
digitalWrite(z,HIGH);
digitalWrite(c,HIGH);
digitalWrite(d,HIGH);
digitalWrite(dp,HIGH);
digitalWrite(b,LOW);
digitalWrite(e,LOW);
}
// display number6
void digital_6(void)
{
unsigned char z;
for(z=7;z<=11;z++)
digitalWrite(z,HIGH);
digitalWrite(c,HIGH);
digitalWrite(dp,HIGH);
digitalWrite(b,LOW);
}
// display number7
void digital_7(void)
{
unsigned char z;
for(z=5;z<=7;z++)
digitalWrite(z,HIGH);
digitalWrite(dp,HIGH);
for(z=8;z<=11;z++)
digitalWrite(z,LOW);
}
// display number8
void digital_8(void)
{
unsigned char z;
for(z=5;z<=11;z++)
digitalWrite(z,HIGH);
digitalWrite(dp,HIGH);
}
//digital number9
void digital_9(void)
{
unsigned char z;
digitalWrite(g,HIGH);
digitalWrite(d,HIGH);
for(z=5;z<=7;z++)
digitalWrite(z,HIGH);
digitalWrite(dp,HIGH);
digitalWrite(f,HIGH);
digitalWrite(e,LOW);
}
void setup()
{
int i;//define i
for(i=4;i<=11;i++)
pinMode(i,OUTPUT);//set pin4~pin11 output
}
void loop()
{
while(1)
{
digital_0();//display 0
delay(1000);//delay 1s
digital_1();
delay(1000);
digital_2();
delay(1000);
digital_3();
delay(1000);
digital_4();
delay(1000);
digital_5();
delay(1000);
digital_6();
delay(1000);
digital_7();
delay(1000);
digital_8();
delay(1000);
digital_9();
delay(1000);
}
}
This all works just fine, when it's just the Nixie tube hooked up. Now, when I hook up the LCD touch shield shown in the kit, I immediately lose power to pins 4, 5, and 6. The rest of the code keeps going and all of the rest of the lines on the display light up, and I even get power to the LCD (it lights up), but I'm losing power through those 3 pins. Any idea what's going on?
EDIT: Nevermind. I figured it out. I followed the wiring diagram in one of the SainSmart tutorials and it didn't wire up the second common cathode on the nixie tube, resulting in a greatly dimmed display (which I didn't notice because I didn't know the thing was supposed to be so freaking bright) and not enough power to power the LCD and the tube from the single cathode. Figured I would delete the post, but maybe someone will learn from my mistake!
EDIT2: Now that I have power to both, I am noticing that I cannot use the touch screen when the nixie tube is drawing power. Is there any way that I can compensate for this? Nixie tube is attached to pins 4-11, then to the ground and the 3.3V port. As soon as I unplug the ground, the touchscreen works fine, but until then it will not respond at all. Help?