A very dumb and simple, but really good looking example of the Arduino UNO and LEDS. The effect of the Knight Rider Car.
The idea with this example is to learn how to work with arrays on the code. (see the code below)
Here is the project working on video:
Part List:
- 1 x Arduino UNO
- 7 x Red Leds
- 7 x 220ohm resist.
The connections are very simple:
Attach each led with it´s resistor to a digital output (from 3 to 9). The rest is in the code.
The Source Code:
/* Knight Rider 3 * -------------- * * This example concentrates on making the visuals fluid. * * * (cleft) 2005 K3, Malmo University * @author: David Cuartielles * @hardware: David Cuartielles, Aaron Hallborg */ int pinArray[] = { 3, 4, 5, 6, 7, 8, 9}; int count = 0; int timer = 10; void setup(){ for (count=0;count<8;count++) { pinMode(pinArray[count], OUTPUT); } } void loop() { for (count=0;count<6;count++) { digitalWrite(pinArray[count], HIGH); delay(timer); digitalWrite(pinArray[count + 1], HIGH); delay(timer); digitalWrite(pinArray[count], LOW); delay(timer*2); } for (count=6;count>0;count--) { digitalWrite(pinArray[count], HIGH); delay(timer); digitalWrite(pinArray[count - 1], HIGH); delay(timer); digitalWrite(pinArray[count], LOW); delay(timer*2); } }
Related Posts
This is a very simple proyect too. We are measuring the ambient temperature with a Thermistor (4,7k) and showing the results by an RGB Led. We are assuming the cool temperature is Blue and the hot is Red. You can see it working in this video: http://www.youtube.com/watch?v=uouKAKhgowQ The part list…
Controlling Leds by the Apple Remote (video updated using the Iphone Photostudio for Arduino Stand) http://www.youtube.com/watch?v=vjnOvdJrHMo The idea originated because i´m learning a lot on Led driven home applications for lighting, and the first project i´m doing is led lighting for the kitchen (indirect). The commercial systems are very expensive,…
Para comentar debe estar registrado.