ROBOTICS PRACTICAL FILE AURDINO 7 Tinkercad
ROBOTICS PRACTICAL FILE AURDINO 7 Tinkercad
MAHAVIDYALAYA
UNIVERSITY OF DELHI
B.SC (HONS.) ELECTRONICS ,4TH SEMESTER
**********************************************************************
*********************************************************************
SEC- “ROBOTICS”
PRACTICAL FILE
***********************************************************************
**************************************************************
..
INDEX
SNO. NAME OF EXPERIMENT DATE OF EXP. DATE OF SUB. SIGNATURE
void loop()
{
digitalWrite(5, HIGH);
delay(400);
digitalWrite(5, LOW);
delay(400);
digitalWrite(10, HIGH);
delay(400);
digitalWrite(10, LOW);
delay(400);
digitalWrite(12, HIGH);
delay(400);
digitalWrite(12, LOW);
delay(400);
}
2.
CODE:
int brightness = 0; AIM: To control the brightness of a LED using
void setup() analogWrite command
{
pinMode(13, OUTPUT);
}
void loop()
{
for (brightness = 0; brightness <=255;
brightness += 5)
{
analogWrite(9, brightness);
delay(1000);
}
for (brightness = 255; brightness >= 0;
brightness -= 5)
{
analogWrite(13, brightness);
delay(1000);
}
}
const int buzzer = 12;
const int buz = 13;
void setup(){
CODE: 3. AIM: To demonstrate basic BUZZER.
pinMode(buzzer, OUTPUT); (BUZZER)
pinMode(buz,OUTPUT);
}
void loop(){
tone(buzzer, 1000); // Send 1KHz sound
signal...
delay(500); // ...for 1 sec
noTone(buzzer); // Stop sound...
delay(1000); // ...for 1sec
}
CODE: (LCD 8 BIT MODE) 4.
#include <LiquidCrystal.h> AIM: To print data using 16*2 LCD display(8-pins
configuration)
LiquidCrystal lcd(2,3,4,5,6,7,8,9,10,11);
void setup()
{
lcd.begin(16,2);
}
void loop()
{
lcd.setCursor(0,0);
}
#include <Servo.h>
CODE:
5. AIM: To demonstrate the SERVO MOTOR
Servo servo1;
Servo servo2; (SERVO
Servo servo3;
Servo servo4; MOTORS)
void setup()
{
servo1.attach(8);
servo2.attach(9);
servo3.attach(7);
servo4.attach(6);
}
void loop()
{
servo1.write(0);
delay(1000);
servo1.write(360);
delay(1000);
servo2.write(0);
delay(1000);
servo2.write(360);
delay(1000);
servo3.write(360);
delay(1000);
servo3.write(0);
delay(1000);
servo4.write(360);
delay(1000);
servo4.write(0);
delay(1000);
}
CODE: (DC 6.
MOTORS)
void setup() AIM: To control the speed of a DC MOTOR using
{ potentiometer and transistor.
pinMode(11, OUTPUT);
}
void loop()
{
digitalWrite(11, HIGH);
delay(10);
}
const int LED = 8; // the pin for the LED
const int BUTTON = 13; // input pin of the
7.
pushbutton AIM: To control a LED using PUSH BUTTON
int val = 0; // stores the state of the input pin
int old_val = 0; // stores the previous value
of "val"
int state = 0; // 0 = LED off while 1 = LED on
int brightness = 128; // Stores the brightness
value
void setup() {
pinMode(LED, OUTPUT); // tell Arduino LED
is an output
pinMode(BUTTON, INPUT); // and BUTTON
is an input
}
void loop() {
val = digitalRead(BUTTON); // read input
value and store it
CODE:
#include <LiquidCrystal.h>
#include <IRremote.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup() {
// set up the LCD's number of columns and rows:
Serial.begin(9600);
lcd.begin(16, 2);
irrecv.enableIRIn();
// Print a message to the LCD.
}
.
void loop() {
Serial.println(" ");
irrecv.resume(); // Restart the ISR state machine and Receive
the next value
}
.
switch(results.value) case 16589023 :
{ {
case 16580863 : lcd.print("BACKWARD");
{ delay(1000);
lcd.print(" ON/OFF"); lcd.clear();
delay(1000); break;
lcd.clear(); }
break; case 16621663 :
} {
case 16613503 : lcd.print("PAUSE/PLAY");
{ delay(1000);
lcd.print("VOL+"); lcd.clear();
delay(1000); break;
lcd.clear(); } case 16605343 :
break; {
} lcd.print("FAST FORWARD");
case 16597183 : delay(1000);
{ lcd.clear();
lcd.print("FUNC/STOP"); break;
delay(1000); }
lcd.clear();
break;
}
.
case 16584943 : case 16609423 :
{ case 16623703 :
{ {
lcd.print("DOWN");
delay(1000); lcd.print("ST/REPT"); lcd.print(" FIVE");
lcd.clear(); delay(1000); break;
break; lcd.clear(); } case 16607383 :
} break; {
case 16617583 : } lcd.print(" SIX");
{ case 16582903 :
lcd.print("VOL-"); break;
{ }
delay(1000);
lcd.clear(); lcd.print(" ONE"); case 16586983 :
break; break; {
} } lcd.print(" SEVEN");
case 16601263 : case 16615543 : break;
{ { }
lcd.print("UP"); lcd.print(" TWO");
delay(1000); case 16619623 :
break; {
lcd.clear();
break; } lcd.print(" EIGHT");
} case 16599223 : break;
case 16593103 : { }
{ lcd.print(" THREE"); case 16603303 :
lcd.print("O"); break; {
break; }
} case 16625743 :
lcd.print(" NINE");
{
case 16591063 : break;
lcd.print("EQ"); { }
delay(1000); lcd.print("FOUR"); }
lcd.clear();
break;
break; }
.} }
}
.