Go Down

Topic: Can this be disconnected from the computer once programmed (Read 99 times) previous topic - next topic

drsr

Very sorry about this post.I am 55 and have left college 35 years ago.Kindly excuse
i am interested in getting a knight rider with arduino

http://startingelectronics.org/beginners/circuits/MEGA-24-LED-knight-rider/

Can the circuit be detached from the computer if my friend does the program?
https://www.youtube.com/watch?v=QzAmYOCD1HY&feature=youtu.be

drsr

Arduino MEGA 24 LED Knight Rider Display
Created on: 30 March 2015

In this project, an LED Knight Rider display is built on a breadboard using 24 LEDs.

An Arduino MEGA 2560 is used to directly drive the LEDs from 24 of the Arduino's pins. An Arduino Uno can not be used to drive the LEDs directly because it has too few pins, although it would be possible to expand the number of outputs on an Arduino Uno using four PCF8574 I/O expander ICs.

The circuit is pretty simple as it is just an LED and series resistor connected to each pin and repeated 24 times. Pins 30 to 51 are used on the Arduino MEGA.

The video below shows the circuit operating.


Can't see the video? View on YouTube →
The Circuit Diagram
The 24 LED knight rider circuit diagram is shown below. Only the first two and last two LEDs are shown in the circuit as the other LEDs are just a repetition of the LED and series resistor connected to the pins in sequential order.

24 LED Knight Rider Display Circuit
24 LED Knight Rider Display Circuit using the Arduino MEGA

Arduino Knight Rider Sketch
The code for the Arduino Knight Rider display is shown here.

const int delay_ms = 50;

void setup() {
 int i;
 
 for (i = 30; i <= 53; i++) {
   pinMode(i, OUTPUT);    // set pins as outputs
   digitalWrite(i, LOW);  // switch the output pins off
 }
}

boolean forward = true;    // LED direction flag
int pin_num;

void loop() {
 
 if (forward) {  // LEDs left to right
   for (pin_num = 30; pin_num <= 53; pin_num++) {
     digitalWrite(pin_num, HIGH);
     delay(delay_ms);
     digitalWrite(pin_num, LOW);
   }
   forward = false;
 }
 else {          // LEDs right to left
   for (pin_num = 53; pin_num >= 30; pin_num--) {
     digitalWrite(pin_num, HIGH);
     delay(delay_ms);
     digitalWrite(pin_num, LOW);
   }
   forward = true;
 }
}

The speed of the display can be set by changing the value of delay_ms at the top of the sketch.









Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy