loading

This is my first time presenting an instructable on here, and for now it's just a simple random relay that utilizes an Arduino Uno and a few LEDs and jumper cables.

Step 1: Materials

There's not much that will be needed to create this array, and what is needed can usually be found with minimal effort and be quite inexpensive.

What you'll need:

-An Ardunio Uno Board

-LED lights (my set up had 42 and worked fine)

-Plenty of jumper cables or jumpers

-A power adapter

-A large breadboard

Step 2: Set-Up

Using the picture presented, and black over the circles represents the positive legs of each LED going across the channel using 42 LEDs. The orange lines represent the jumpers between each channel. At the end of the jumpers on the right you'll need to run jumpers to the Arduino board itself. The jumpers that match up with the positive legs will be placed into digital inputs 0, 8, 9, 10, 11, 12, and 13. The jumpers that match up with the negative legs will be placed into inputs 1, 2, 3, 4, 5, 6, and 7.

Step 3: Code

Here's the code I used for the set-up:

void setup () {

pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);
pinMode(4, OUTPUT);
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
pinMode(1, OUTPUT);
pinMode(0, OUTPUT);
}
void loop() {

long randnumber;
long randnumber2;
long randnumber5;
long randnumber6;

randomSeed(analogRead(0));

randnumber = random(0, 13);
randnumber2 = random(0,13);
randnumber5 = random(50,400);
randnumber6 = random(50,400);

digitalWrite(randnumber, HIGH);
digitalWrite(randnumber2, LOW);
delay(randnumber5);
digitalWrite(randnumber, LOW);
digitalWrite(randnumber2, HIGH);
delay(randnumber6);
}

Step 4: Test the Array

After the code is uploaded to the Arduino, plug it into a wall socket and the array should start randomly displaying through the waves that the Analog 0 input will receive. You can add an antenna if you'd like for more variation and being able to affect the array with the current in your body.

Thanks for reading, hope this works. Any feedback is appreciated to help make this instructable better.

<p>First instructable? This looks pretty good!</p>

About This Instructable

778views

12favorites

License:

More by zambonicassoni:Simple Random Relay 
Add instructable to: