neises
October 15, 2015, 10:51pm
1
I recently purchased a serial 7-seg display from SparkFun.
The code I’m working with is below:
int cycles = 0;
void setup() {
pinMode(TX, OUTPUT);
Serial1.begin(9600);
Serial1.write('v');
}
void loop() {
cycles++;
char tempString[10];
sprintf(tempString, "%4d", cycles);
Serial1.write(tempString);
delay(2000);
}
It’s probably extremely obvious what I’m doing wrong, but I for the life of me can’t figure this out.
I have my VIN connected to the 7-Seg’s VCC, my GND connected to the 7-Seg’s GND, and my TX connected to the 7-Seg’s RX.
bko
October 15, 2015, 11:28pm
2
In the Arduino world, there is a big difference between Serial1.write() which sends a single character and Serial1.print() which sends the whole string. I think you want Serial1.print(tempString); instead of write().
Can you try changing that?
neises
October 15, 2015, 11:29pm
3
I did, and it still doesn’t make a difference. The 7-seg display is still showing all zeroes.
bko
October 15, 2015, 11:34pm
4
OK have you tried something like the Sparkfun example, skipping all the other stuff for now?
Serial1.print("-HI-");
neises
October 15, 2015, 11:36pm
5
It still doesn’t do anything. Just all zeroes on the display.
neises
October 15, 2015, 11:54pm
6
Got it working, my pins weren’t making a secure connection.
1 Like