You are on page 1of 3

LIAQUAT UNIVERSITY OF MEDICAL HEALTH & SCIENCES JAMSHORO

INSTITUTE OF BIO MEDICAL TECHNOLOGY BS IN BIO-MEDICAL Engineering (5th Term 3rd Year) _________ Batch LAB. EXPERIMENT # 3
Name: _________________________________________________________ Roll No. _____________ Score: ________________________ Signature of Teacher: __________________ Date: ____________

Objective: To perform the practical of Knight Rider using Arduino Knight Rider Using LEDs
Similar to the previous example, LEDs are used to blink after an interval of delay but just the difference is that here LEDs are in large amount to control. Connect all LEDs to digital out pins of board ,starting from pin number 13; then 12 , 11,10,9 .. respectively. Then run the following code: CODE: 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); } // the loop routine runs over and over again forever: void loop() { digitalWrite(3, HIGH); digitalWrite(13, HIGH); delay(1000); digitalWrite(4, HIGH);

digitalWrite(12, HIGH); delay(1000); digitalWrite(5, HIGH); digitalWrite(11, HIGH); delay(1000); digitalWrite(6, HIGH); digitalWrite(10, HIGH); delay(1000); digitalWrite(7, HIGH); digitalWrite(9, HIGH); delay(1000); digitalWrite(8, HIGH); delay(1000); digitalWrite(3, LOW); digitalWrite(13, LOW); delay(1000); digitalWrite(4, LOW); digitalWrite(12, LOW); delay(1000); digitalWrite(5, LOW); digitalWrite(11, LOW); delay(1000); digitalWrite(6, LOW); digitalWrite(10, LOW); delay(1000); digitalWrite(7, LOW); digitalWrite(9, LOW); delay(1000); digitalWrite(8, LOW); delay(1000); } Here the output will be the blinking of LEDs first from outer most LEDs then 2nd last, 3rd last and so on till central LED. Than the process will reverse and loop it continuously.

Task : Perform the practical of Knight rider sequence thorugh arduino and then paste the picture with this handout