Pages: [1]   Go Down
Author Topic: digitalwrite low??  (Read 1007 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 17
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

okay I have a problem and i need help, I created a 5x8 matrix, i wired the cathodes horizontally

---------->
---------->
---------->

and i wired the anodes vertically,
 !  !  !  
 !  !  !
 !  !  !  
v  v v

and no they are not touching. the anodes are raised above the cathodes.

My problem begins when I try to light up the leds, i should light it up as
 R_1 (row 1) (digitalWrite, r_1, HIGH);
and
c_1 (column 1) set as digitalWrite(c_1, LOW); ?

i tried this but it wont work? yet if i just hook up c_1 directly to ground the led lights up but its very dim, i have tried reversing them but that way it doesnt light up.

if i wire up 5v to row 1 and ground to column 1 then yes the led lights up, they all light up individually i tested them but i cant get it to work using digitalWrite LOW, or am I doing it wrong? below is my code. any help would be appreciated. Oh theres 8 anodes and 5 cathodes. so a total of 13 pins.

Code:
int r_1 = 52;
int r_2 = 50;
int r_3 = 48;
int r_4 = 46;
int r_5 = 44;


int c_1 = 22;
int c_2 = 24;
int c_3 = 26;
int c_4 = 28;
int c_5 = 30;
int c_6 = 32;
int c_7 = 34;
int c_8 = 36;

void setup(){
  
 //anodes
  (c_1, OUTPUT);
  (c_2, OUTPUT);
  (c_3, OUTPUT);
  (c_4, OUTPUT);
  (c_5, OUTPUT);
  (c_6, OUTPUT);
  (c_7, OUTPUT);
  (c_8, OUTPUT);
//cathodes
  (r_1, OUTPUT);
  (r_2, OUTPUT);
  (r_3, OUTPUT);
  (r_4, OUTPUT);
  (r_5, OUTPUT);

}

void loop(){
  digitalWrite(r_1, LOW);
  digitalWrite(c_1,HIGH);
}
Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2855
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you mean to leave off the pinMode name?

Code:
void setup(){
  
 //anodes
  pinMode(c_1, OUTPUT);
  pinMode(c_2, OUTPUT);
  pinMode(c_3, OUTPUT);

//etc.

--
The Quick Shield: breakout all 28 pins to quick-connect terminals
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 17
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ahh no I didnt =[
i already fixed it but still nothing, what i also did now was instead of connecting it the cathode to pin 52 i went directly to ground and the led lit up, brighter than before so thats a good sign right?
Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2855
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, that's a good sign. Are you using series resistors? I wouldn't hook up an LED directly to port pins for both current source/sink without a current-limiting resistor.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, light sensor, potentiometers, pushbuttons
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 17
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yea, well i have a resistor connected between the matrix's anodes and the arduino pins, should i do it for all the pins? or just anodes?
Logged

0
Offline Offline
Edison Member
*
Karma: 0
Posts: 1103
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you think a little bit about what those resistors are meant for you should be able to answer this question by yourself.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 17
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have tried =\, for some reason now a whole column lights up with the new code and the resistors attached to the 8 anodes and not the other 5 cathodes. Is my wiring correct? resistors arent they used to limit current?
Logged

Pages: [1]   Go Up
Jump to: