This Is a Basic Program for a Beginner
by bhavin_patel in Circuits > LEDs
1675 Views, 14 Favorites, 0 Comments
This Is a Basic Program for a Beginner
This is a basic program for a beginner
Step 1 :
- first of the you can go on this practical before do remember this things what you need in this practical. You need some led , wire , breadboard and arduino.
Step 2 :
- Now, you can go on proper arrangement with some wire and led. This led inserted on breadboard in proper way and next connect arduino by connect usb cable through your pc or leptop.
Step 3 :
Now,
you should install arduino software in your pc or lepto[pe . if you have good knowledge about c program then you can make it otherwise you can go on my program which I made it . which is program loopiteration and arrays.
Forloopitration
int timer = 1000;
void setup() {
for (int APin = 2; APin < 7; APin++) {
pinMode(APin, OUTPUT);
Serial.begin(9600);
}
}
voidloop() {
for (int APin = 2; APin < 7; APin++) {
digitalWrite(APin, HIGH);
delay(timer);
digitalWrite(APin, LOW);
}
for (int APin = 6; APin >= 2; APin--) {
digitalWrite(APin, HIGH);
delay(timer);
digitalWrite(APin, LOW);
}
}
Arrays
int timer = 100;
int APins[] = {
2, 7, 4, 6, 5, 3
};
int pinCount = 6;
void setup() {
for (int APin = 0; APin < pinCount; APin++) {
pinMode(ledPins[APin], OUTPUT);
Serial.begin(9600);
}
}
void loop() {
for (int APin = 0; APin < pinCount; APin++) {
digitalWrite(ledPins[APin], HIGH);
delay(timer);
digitalWrite(ledPins[APin], LOW);
Serial.println(delay);
}
for (int APin = pinCount - 1; APin >= 0; APin--) {
digitalWrite(ledPins[APin], HIGH);
delay(timer);
digitalWrite(ledPins[APin], LOW);
Serial.println(delay);
}
}
Step 4 :
now,
you have made it program then upload in arduino by usb cable and led will blink and you can enjoy
Here I am showing you some picture by led on loopiteration and arrays program which I have made it small practical.