ROBOTICS Lab Manual
ROBOTICS Lab Manual
//The function is called once before plutoLoop() when you activate developer mode
voidonLoopStart()
{
//Do your one time stuff here
LED.flightStatus(DEACTIVATE);
//The function is called once after plutoLoop() when you deactivate developer mode
voidonLoopFinish()
{
//Do your cleanup stuff here
LED.flightStatus(ACTIVATE);
Result:
Experiment-3
Objecive: Learn about the Servo Motor
Description: In This experiment we use the servo Motor from 0° to 180° angle and plot the
angle value on ArduinoIDE Serial Plotter.
Code:
#include <Servo.h>
void setup() {
void loop() {
for (pos = 0; pos<= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
Serial.println(pos);
for (pos = 180; pos>= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
Result:
Experiment-4
Objective: Learn StepperMotor with L293D Motor Driver & Arduino
Requirement Tool & Software: NEMA Stepper Motor, Arduino IDE, L293D
MotorDriver
Description: we are using NEMA 17 bipolar stepper rated at 12V. It offers 200 steps per
revolution, and can operate at 60 RPM.
Connection: The connections are fairly simple. Start by connecting external 12V power
supply to the Vcc2 pin and 5V output on Arduino to the Vcc1 pin. Make sure you common
all the grounds in the circuit.
You also need to connect both the ENA & ENB pins to 5V output so the the motor is always
enabled.
Now, connect the input pins(IN1, IN2, IN3 and IN4) of the L293D IC to four digital output
pins(12, 11, 10 and 9) on Arduino.
Finally, connect the A+ (Red), A- (Green), B+ (Blue) and B- (Yellow) wires from the stepper
motor to the L293D’s output pins (Out4, Out3, Out2 & Out1) as shown in the illustration
below.
12 Volt Adapter
Arduino Code:
voidsetup()
{
// set the speed at 20 rpm:
myStepper.setSpeed(20);
// initialize the serial port:
Serial.begin(9600);
}
voidloop()
{
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);