Skip to content

Instantly share code, notes, and snippets.

@vanjikumaran
Created April 25, 2018 01:35
Show Gist options
  • Save vanjikumaran/c84acde49e2b1d14157de8d892b813e5 to your computer and use it in GitHub Desktop.
Save vanjikumaran/c84acde49e2b1d14157de8d892b813e5 to your computer and use it in GitHub Desktop.
Knight Rider LED on Ardino
# Copyright 2018 Vanji
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
int pintarray[] = {1,2,3,4,5,6,7,8,9,10};
int counter =0;
int timer=50;
void setup() {
counter=0;
while(counter<10){
pinMode(pintarray[counter],OUTPUT);
counter++;
}
}
void loop() {
counter=0;
while(counter<10){
digitalWrite(pintarray[counter],HIGH);
delay(timer);
digitalWrite(pintarray[counter],LOW);
counter++;
}
counter=10;
while(counter>=0){
digitalWrite(pintarray[counter],HIGH);
delay(timer);
digitalWrite(pintarray[counter],LOW);
counter--;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment