Go Down

Topic: Data feeding problem (Read 249 times) previous topic - next topic

jaspal23

Oct 18, 2018, 04:44 pm Last Edit: Oct 18, 2018, 04:45 pm by jaspal23
Hi,

I am trying to create some patterns using Row Scan multiplexing. i tried a lot to lit single led
but no success. Actually i have less knowledge of shifting bits.

This project consists of 6 RGB leds with common Anode and anode connected with BC327 PNP transistors. Circuit diagram is attached.


In this code simple i want to glow RED led ( one pin low)by using pattern and mask, so i can learn mask and pattern things.

Code: [Select]
const int row[3] = {2,4,7};   // Arduino row pins
const int column[6] = {11,10,9,6,5,3};   // Arduino column pins

int pattern = B0000001;
int mask = 1;
void setup()
{

DDRD  |= B11111100; //set pins 2-7 to OUTPUT
PORTD |= B10010100; //set pins 2, 4, 7 HIGH  
DDRB  |= B00001110; //set pins 9-11 to OUTPUT

for(int i=0 ; i<6; i++){

   if((pattern & 1) == 1) digitalWrite(column[i], LOW); else digitalWrite(column[i], HIGH);
mask = mask << 1;
   }

digitalWrite(row[0], LOW); // turn on the LEDs

}
void loop()
{
 
  }


Thanks in Advance.


Paul__B



Beats me; I have difficulty following your code but for a start, you have three rows defined in your code and four in the schematic.

I presume your battery ground is the same as the Arduino ground.

jaspal23

Beats me; I have difficulty following your code but for a start, you have three rows defined in your code and four in the schematic.

I presume your battery ground is the same as the Arduino ground.

Yes, in schematic 8 leds are used but now i want to use only 6 RGB Leds, Last row i discarded. 

Ground is same.

Go Up