I want to use a 7 segment display(Common Cathode) to display the numbers 0-9 using potentiometer input. Every thing works fine but the top bar of the display always stays on, even when I set it to low. You can see in the attachment that im trying to print a ' 1' using the highlighted code but the top segment is still illuminated. I dont see anything wrong with the wiring so I assume its a code problem
Full wiring and code:
Hi
One obvious thought strikes me is you seem to be using pin 1 on the arduino while at the same time using the serial port. Pin one is the TX line on the serial port which when not transmitting is set to high by the serial software. Try moving to pin 10 which is free.
You could help yourself by defining the following constants at the start of the program:-
const segA = 10;
const segB = 2;
const segC = 3;
const segD = 4;
const segE = 5;
const segF = 6;
const segG = 7;
Then in your void setup() code use something like this:-
pinMode(segA , OUTPUT);
pinMode(segB , OUTPUT);
pinMode(segC , OUTPUT);
pinMode(segD , OUTPUT);
pinMode(segE , OUTPUT);
pinMode(segF , OUTPUT);
pinMode(segG , OUTPUT);
and in void loop() use this:-
case 1:
digitalWrite(segA , LOW);
digitalWrite(segB , HIGH);
digitalWrite(segC , HIGH);
digitalWrite(segD , LOW);
digitalWrite(segE , LOW);
digitalWrite(segF , LOW);
digitalWrite(segG , LOW);
Ian
Can not see a thing at that site without signing up and I will not do that.
You will have to take things apart enough to determine whether the problem is in the display, your Arduino, or someplace in between.
Without code or circuitry, there is little that I can do.
Thanks ill try out your solution
I moved it to pin 10 and it worked. Thanks for your help!