Show Posts
Pages: [1] 2
1  Using Arduino / Programming Questions / can you create a creating patterns of blinks? on: September 12, 2014, 11:19:11 am
Im trying to devise the ultimate game of simon ever.
a program that actually learns from your response times.

I can create the pattern of LEDS on aND OFF - NO PROBLEM
but is there anyway to create and store the inputted pattern OF SAY 1-2-3-4
that can be called upon again, as in LIKE PATTERN A=1,2,3,4 (TO TURN ON OR off) with a single command once its defined?

Basically Im building off the existing pattern but its getting long and tedious to enter all these patterns individually.
Trying to make it faster..the program is already like 300 lines long and I have still so much more I want to do with it.

Thanks everyone

2  Using Arduino / Programming Questions / Re: Selective Random Pins..not 1-10, but only 1,4,7,9 anyone know how to limit that on: September 12, 2014, 10:00:14 am
Sorry Abel and Pyro - I hit the wall yesterday and just fell asleep at my desk.
I was up for almost 35 hours and bam...fatigue just set in all at once,.

Im using the Mega Abel.

U guys are awesome for helping me out like you guys have been.
Im actually learning alot through all this.  showing me a different way to do things and I read up on all the commands you guys have thrown at me.
3  Using Arduino / Programming Questions / Re: Selective Random Pins..not 1-10, but only 1,4,7,9 anyone know how to limit that on: September 12, 2014, 02:30:54 am
AND the funny thing is the LEDS that are staying on are not even part of the ones that are included in the Pins.
they are completely separate pins and do not come on when I use the 4 random option I had did.
go figure
4  Using Arduino / Programming Questions / Re: Selective Random Pins..not 1-10, but only 1,4,7,9 anyone know how to limit that on: September 12, 2014, 02:25:02 am
Thanks guys again.
Right now, the program seems to be working.  Random LEDS are blinking.
But, despite having the ...randomSeed(analogRead(0));...included...
those same 3 leds stay on.

I uploaded the first 4 pin version and the LEDS stayed off.
It really doesnt make any sense.
Heres the code the way its been uploaded.
Can anyone help point out why those leds are staying on?


int ledPin[8] = {1, 2, 3, 4, 16, 17, 18, 19 };// array of size 8 with you led pins as values

void setup()
{
  Serial.begin(115200);
  for (int i = 0; i < 8; i++)
  {
    pinMode(ledPin, OUTPUT);
  }
  randomSeed(analogRead(0));
  delay(1000);
}
//
void loop()
{
  int myRandomNumber = random(0,8);  //generate a random number from 0-7
  Serial.println(myRandomNumber);// print that number to serial
 
  digitalWrite(ledPin[myRandomNumber], HIGH);//lite that pin, recalling its number from your array
  delay(1000);
  digitalWrite(ledPin[myRandomNumber], LOW);// turn it off and back to the top
  delay(1000);
}
5  Using Arduino / Programming Questions / Re: Selective Random Pins..not 1-10, but only 1,4,7,9 anyone know how to limit that on: September 12, 2014, 02:13:30 am
Hey Pyro - thanks I thought I was discussing with 2 people found out theres 3.

I uploaded the program and all I get is 3 LEDS that stay on, and one of those LEDS pulses.
Its the #1 pin.

Nothing blinks, no random . just 3 stay on and one pulses
6  Using Arduino / Programming Questions / Re: Selective Random Pins..not 1-10, but only 1,4,7,9 anyone know how to limit that on: September 12, 2014, 01:57:51 am
i do have the ........randomSeed(analogRead(0));
but the 3 LEDS still stay on from start to finish.

I will say I did try Bulldog Lowell's code, (thank you for your input BTW) but all I get with that is the same 3 leds that stay on, but one pulses.  No blinks no random nothing but a pulse.

I think that would be a step back from the progress Abels help make thus far.

But I do thank you both.
.
7  Using Arduino / Programming Questions / Re: Selective Random Pins..not 1-10, but only 1,4,7,9 anyone know how to limit that on: September 12, 2014, 01:32:56 am
HEY ABEL -- thank you so much for the help thusfar -
We are really getting into the ball park here.

One problem I had but fixed was was the LEDs were staying on so I had to  inject
        digitalWrite(ledPin[myRandomNumber], LOW);
        delay(500);
(to turn off the LED after it blinked)
 Then I had to turn on with
 digitalWrite(myRandomNumber, HIGH);
  delay(500);

BUT It is choosing LEDS.
But one problem is  (3) other LEDS are actually always on thats arent being choosen.
and I dont understand why.
they just light up and stay on the whole time.
Any ideas?

Thanks a bunch.
I was tired a bit ago, but Im wide awake now.
Funny how alittle progress wakes you right up.

Again, thanks man.
I couldnt have figured this far without your kindness.


But for other people who might want to learn from what I asked....heres whats being randomly blinking.
The lights were staying on, and not turning off, so this is the final code that has the lights blinking about.
If I get those 3 LEDS that stay on to not come on then Ill show the final code.
Great forum - lots of kind people.

void loop()
{
  int myRandomNumber = random(0,7);  //generate a random number from 1-7. EDIT: from 0 to 7.
  Serial.println(myRandomNumber);// print that number to serial
  
  digitalWrite(ledPin[myRandomNumber], HIGH);//lite that pin, recalling its number from your array
  delay(500);
  digitalWrite(ledPin[myRandomNumber], LOW);
  delay(500);
  digitalWrite(myRandomNumber, HIGH);
  delay(500);
  digitalWrite(myRandomNumber, LOW);// turn it off and back to the top
  delay(500);
}
8  Using Arduino / Programming Questions / Re: Selective Random Pins..not 1-10, but only 1,4,7,9 anyone know how to limit that on: September 12, 2014, 12:58:53 am
Thanks Abel,
but thats waaaaaay more advanced than what I can comprehend.

I did try to copy and paste, but all that did was have 3 of my pins simply stay on and nothing blinked.

I think I see what youre doing..but when you say take a random between 0 and 7 and index that output,
thats where I get confused.

it should only choose 1 number at a time.
Im pretty sure I can control it after its choosen one of the 8 pins, but right now nothing is being chosen, and I wouldnt know how to alter what you said.
Can you elaborate, if you have time.

thank you for taking the time to respond thus far
9  Using Arduino / LEDs and Multiplexing / Re: Leds to blink in a short series burst - as in ..blink blink = 1 on: September 12, 2014, 12:26:35 am
Appreciate that help.
What it actually did was make me think of creating a new loop within the loop.
And once I inserted the line and the delay I am now able to make it blink like a strobe.

so thank you so much for taking the time out.
10  Using Arduino / LEDs and Multiplexing / U can randomiz program selection 4 consecutive pins but can u 4 nonconsecutive? on: September 12, 2014, 12:22:35 am
Im using a random command that allows me to randomly sequence pins 1-4.
I added new pins (15-19)
these are on the outside of my encasement.

Is there a way to include the new 15-19 pins within my random choices without having to rewire anything?
Thank you
11  Using Arduino / Programming Questions / Selective Random Pins..not 1-10, but only 1,4,7,9 anyone know how to limit that on: September 11, 2014, 11:49:39 pm
So I have completed a project that Im using 15 output pins with.
I added 4 new LEDS after I encased it, so I dont want to break open and rewire everything..
Its basically like a Simon-like handheld game where you repeat the random sequence of events..

I can random a consecutive series of pins (1,5)
but can I randomly have program choose between specific pins that are not in sequence?
My new LEDS are at the end and I want them involved so Im actually using Pins 1,2,3,4 and 16,17,18,19 outputs.

Is it possible to include these extra pins in the random selection?
Thanks in advance
12  Using Arduino / LEDs and Multiplexing / Leds to blink in a short series burst - as in ..blink blink = 1 on: September 11, 2014, 12:47:49 am
Im trying to make one LED blink in a 3 blink burst 10 times.
So basically its 30 blinks but only (10) sets of 3 quick blinks

Im confused as do I try to disrupt the frequency of the LED or do I assign a series number to it.
Im totally lost on how to do this actually.
Ive been searching for about 2 hours any and everywhere online to see how to do this to no avail

Can anyone point me in the right direction on how to make a triple blink happen, 10 times
Thanks in advance
13  Using Arduino / General Electronics / Re: What is the part of a Universal Power Interrupter that actually detects no power on: April 03, 2013, 10:31:54 am
Okay, I think you guys are missing the point of the question.

Im asking if anyone can help out with the namr of the exact device, instrument or aparatus that does the switcing.
Is it some type of relay switching unit, or what -- I do not know.  I already understand the principles of battery backup with the different types of backup units there.

what exactly does the switching over is what Im trying to determine.
Thanks to the guys that help out
14  Using Arduino / General Electronics / Re: What is the part of a Universal Power Interrupter that actually detects no power on: April 03, 2013, 09:15:11 am
James - that link didnt help any.
It doesnt specify what the mechanism for the switchover is.

I'm hoping to find what the exact aparatus is that detects no power and then switches to battery power.
As well as the means of which it flips back to its regular constant source when it detects current has been restored.

Anyone else?
15  Using Arduino / General Electronics / What is the part of a Universal Power Interrupter that actually detects no power on: April 02, 2013, 11:40:37 pm
Does anyone know what the part(s) are called that a UPS uses to determine when theres no power and it should kick itself on to supply power from its own power supply?

Also, anyone know how the UPS detects a return to regular power, and switches itself off to allow the electric company
power to resume offering power?

Thanks
Pages: [1] 2