ATAL Tinkering Lab Practical

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

ATAL Tinkering Lab Practical

1. LED Blinking Project

Coding:-
void setup() {

pinMode(13, OUTPUT);//LED
}

void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}

2. Relay ON/OFF Project

Coding:-
void setup() {

pinMode(13, OUTPUT);// RELAY


}

void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}

3. LED ON/OFF using Button Switch.

Coding:-
const int buttonPin = 2;
const int ledPin = 13;

int buttonState = 0;
void setup() {

pinMode(ledPin, OUTPUT);

pinMode(buttonPin, INPUT);
}

void loop() {

buttonState = digitalRead(buttonPin);

if (buttonState == HIGH) {

digitalWrite(ledPin, HIGH);
} else {

digitalWrite(ledPin, LOW);
}
}

4. ONE Motor rotate clockwise and anticlockwise Project


Coding:-

void setup() {

pinMode(13, OUTPUT); //Motor IN1 PIN


pinMode(12, OUTPUT);// Motor IN2 PIN
}

void loop() {
digitalWrite(13, HIGH);
digitalWrite(12, LOW);
delay(1000);
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
delay(1000);
}

5. Two Motor rotate clockwise and anticlockwise Project


Coding:-

void setup() {

pinMode(13, OUTPUT); //First Motor IN1 PIN


pinMode(12, OUTPUT);// First Motor IN2 PIN
pinMode(11, OUTPUT); // Second Motor IN1 PIN
pinMode(10, OUTPUT);// Second Motor IN2 PIN
}

void loop() {
digitalWrite(13, HIGH);
digitalWrite(12, LOW);
digitalWrite(11, HIGH);
digitalWrite(10, LOW);
delay(1000);
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
digitalWrite(11, LOW);
digitalWrite(10, HIGH);
delay(1000);
}

You might also like