Show Posts
Pages: 1 [2] 3 4
16  Using Arduino / Programming Questions / Re: trouble with void function. on: March 06, 2013, 03:31:24 pm
Thank you very much! Got it working now smiley. Now I also understand what they are doing in the link you posted! Thanks again!
17  Using Arduino / Programming Questions / Re: trouble with void function. on: March 05, 2013, 04:59:45 pm
Though I still can't get it working... I don't know exactly what i'm doing. Maybe can you give me a push in the right direction and make a start in my code I posted? Right now I'm doing it wrong...
18  Using Arduino / Programming Questions / Re: trouble with void function. on: March 05, 2013, 04:46:44 pm
Yes yes smiley-grin, I'm still trying to figure it out with the link you gave me. I just answered the question to make sure you understand what I'm trying to do  smiley-razz
19  Using Arduino / Programming Questions / Re: trouble with void function. on: March 05, 2013, 04:08:16 pm
In the function 'shift_out' I want 'animation' to be changed in like Array1[a][b ] or Array2[a][b ]. So the code will look something like this:

Code:
void shift_out(){
for(int a=0; a<5; a++){
      digitalWrite(latchPin, LOW);
      for(int b=0; b<6; b++){
        shiftOut(dataPin, clockPin, MSBFIRST, Array1[a][b]); <---------------------------
      }
      digitalWrite(latchPin, HIGH);
      delay(1);
    }
}
20  Using Arduino / Programming Questions / trouble with void function. on: March 05, 2013, 03:22:17 pm
I'm busy with programming my cube. Now I'm pretty much done with my code, however I want to simplify my code. This is where I have some problems:
Code:
int Array1[5][6] = {{ , , , , ,}, {, , , , ,}, etc}; // this is an animation for my led cube
int Array2[5][6] = {{ , , , , ,}, {, , , , ,}, etc}; // this is another animation for my led cube
void shift_out(char animation);

void loop(){
shift_out(Array1[a][b]); //'[a][b]' is used in the for loop from shift_out
delay(1000);
shift_out(Array2[a][b]);
}

void shift_out(char animation){
for(int a=0; a<5; a++){
      digitalWrite(latchPin, LOW);
      for(int b=0; b<6; b++){
        shiftOut(dataPin, clockPin, MSBFIRST, animation); // animation need to become Array1[a][b] or Array2[a][b]
      }
      digitalWrite(latchPin, HIGH);
      delay(1);
    }
}

So if I want Array1 to show on my led cube, I need to take Array1[a][b ] to shift_out, when I go to shift_out 'animation' need to be Array1[a][b ]. When I want to show Array2 on my led cube, I need to take Array2[a][b ] to shift_out, when I go to shift_out 'animation' need to be Array2 [a][b ] I know its not working with char( a and b need to be declared aswell), I only wrote char in the piece of code to make it more clear what I want to do.

I can get it working if I give a and b a specific number. Like if I say Array[1][1], Array[1][1] can be written to an integer. Then I have no problems to get it to my shift_out function.

I hope I made it clear enough to understand, its kinda hard to explain  smiley-roll-sweat.
21  Using Arduino / General Electronics / Re: Help needed with shift registers on: February 26, 2013, 04:37:22 am
Thanks! Thats exactly what I was looking for. This is faster and easier then writing 0's to the shift registers.
22  Using Arduino / General Electronics / Re: Help needed with shift registers on: February 25, 2013, 02:36:06 pm
Ok...Another question. For now I have my Master Reset/Reclear tied to 5v. However I want to control the MR.
Now is it right when I pull the MR to LOW that all the shift registers will be cleared, and the bytes that were in the shift registers are gone(even when I set it to HIGH again)?
23  Using Arduino / General Electronics / Re: Help needed with shift registers on: February 22, 2013, 12:13:57 pm
Got it fixed, I was so stupid to shift out B00001 instead of B00000 at the void setup(I shift out B00000 to clear out all the shift registers). So I got it fixed smiley!
24  Using Arduino / General Electronics / Re: Help needed with shift registers on: February 21, 2013, 06:19:12 am
So I tried 1k, still some very faint flashes on powering up smiley-sad
25  Using Arduino / General Electronics / Re: Help needed with shift registers on: February 20, 2013, 11:06:44 am
So I tryed it on a single shift register but no luck, its still flashing when getting powered up. However when I put a 10k resistor on the latch to ground on a single shift register on my breadboard it won't flash at all, but on my cube with 6 registers it will flash when using a 10k pull down resistor.
26  Using Arduino / General Electronics / Re: Help needed with shift registers on: February 20, 2013, 10:23:28 am
Im going to try a 10k from OE to 5V and see if that works, ill report back!

Btw, i wrote a piece of code in the void setup to put all latches to low and shift out B00000 (each zero is a LED in off state) to all shift registers
27  Using Arduino / General Electronics / Re: Help needed with shift registers on: February 20, 2013, 07:01:26 am
The problem is not with latching data out, but the leds are flashing when i connect my arduino to my laptop via usb (so when the arduino gets powered up). So im already using a pull down resistor on the latch I get significant less flashing on powering up. However its not completely gone(like 1ms flash or so).
28  Using Arduino / General Electronics / Re: Help needed with shift registers on: February 19, 2013, 11:23:28 am
So i got my cube working and all smiley. Only thing is that i still get a really faint flash on all leds (pretty hard to see because its maybe on for a millisecond or so). I tried lowering my pull down resistor to 3k but i still see the flashes. Maybe someone know why I still get flashes??
29  Using Arduino / LEDs and Multiplexing / Re: 3x3x3 LED cube, newbie questions (5x5x5 comming soon) on: February 18, 2013, 05:55:10 pm
I absolutely agree with the statement you made. However I think a good meter will be a good investment though (for my study and other projects in the future) even if it isnt really meaningful for now yet.

30  Using Arduino / LEDs and Multiplexing / Re: 3x3x3 LED cube, newbie questions (5x5x5 comming soon) on: February 18, 2013, 05:37:44 pm
I did a measurement with a cheap digital volt meter and it came around 2.5V. I think I should invest in a better multimeter in the first place (a buddy of mine has an industrial fluke that works really well he said, maybe I should look for something like that) to get some accurate readings  smiley-red
Pages: 1 [2] 3 4