Go Down

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

#### jaspal23

##### Oct 18, 2018, 04:44 pmLast 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 pinsconst int column[6] = {11,10,9,6,5,3};   // Arduino column pinsint pattern = B0000001;int mask = 1;void setup() {DDRD  |= B11111100; //set pins 2-7 to OUTPUTPORTD |= B10010100; //set pins 2, 4, 7 HIGH   DDRB  |= B00001110; //set pins 9-11 to OUTPUTfor(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() {   }`

#### Paul__B

#1
##### Oct 19, 2018, 01:35 pm

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

#2
##### Oct 19, 2018, 02:35 pm
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