SlideShare a Scribd company logo
Controlling Motors for Robot
Moving the bot…..
MOTOR 1 MOTOR 2 MOVEMENT
10 01 FORWARD
10 00 SLIGHT RIGHT
10 10 SHARP RIGHT
00 01 SLIGHT LEFT
01 01 SHARP LEFT
01 10 BACKWARD
BOT
Wheels
Lets Program the Motors…
#include<avr/io.h>
#include<compat/deprecated.h>
#include<util/delay.h>
int main(void)
{
DDRD=0b11111111; //PORT D pins are output//
sbi(PORTD,4); //Set bit 4 of port D//
sbi(PORTD,5); //Set bit 5 of port D//
DDRC=0b11110000;
while(1)
{
PORTC=0b10010000; //Move Forward
}
}
#include<avr/io.h>
#include<compat/deprecated.h>
#include<util/delay.h>
int main(void)
{
DDRD=0b11111111; //PORT D pins are output//
sbi(PORTD,4); //Set bit 4 of port D//
sbi(PORTD,5); //Set bit 5 of port D//
DDRC=0b11110000;
while(1)
{
PORTC=0b10010000; //Move Forward
_delay_ms(1000);
PORTC=0b01100000; //Move Backward
_delay_ms(1000);
}
Lets turn the bot…..#include<avr/io.h>
#include<compat/deprecated.h>
#include<util/delay.h>
int main(void)
{
DDRD=0b11111111; //PORT D pins are
output//
sbi(PORTD,4); //Set bit 4 of port D//
sbi(PORTD,5); //Set bit 5 of port D//
DDRC=0b11110000;
while(1)
{
PORTC=0b10000000; //Slight right turn
_delay_ms(1000);
PORTC=0b10100000; //Sharp right turn
_delay_ms(1000);
}}
Now take a left turn….
#include<avr/io.h>
#include<util/delay.h>
int main(void)
{
DDRD=0b11111111; //PORT D pins are output//
sbi(PORTD,4); //Set bit 4 of port D//
sbi(PORTD,5); //Set bit 5 of port D//
DDRC=0b00001111;
while(1)
{
PORTC=0b00010000; //Slight left turn
_delay_ms(1000);
PORTC=0b01010000//Sharp left turn
_delay_ms(1000);
}

More Related Content

TXT
Ir remote kit_blink.pde
PPTX
Programming A Robot Using
TXT
Metal detecting robot sketch
PPTX
8051 microcontroller
DOCX
DOCX
(381877808) 102054282 5-listing-program
DOCX
Dam gate open close lpc prog
PPTX
Embedded Systems Project Based Training|Engineering Projects,Summer Training
Ir remote kit_blink.pde
Programming A Robot Using
Metal detecting robot sketch
8051 microcontroller
(381877808) 102054282 5-listing-program
Dam gate open close lpc prog
Embedded Systems Project Based Training|Engineering Projects,Summer Training

What's hot (19)

PDF
Nefrock勉強会 in大岡山「FPGAでゲーム機を作ろう!の会」Day4
PDF
Dsd lab Practical File
PDF
Micro
DOCX
Micro Assignment 1
PPTX
Robotic control
PDF
Advanced motion controls mc1xdz01
PPT
Interrupts
PDF
Gd35 manual v1.5
TXT
Two digit-countdown-timer
PDF
Sample slide Allen-Bradley
PPTX
Arduino cic3
PDF
Advanced motion controls mc1xdz
PDF
ADC (Analog to Digital conversion) using LPC 1768
DOCX
CODING IN ARDUINO
PDF
Solution manual 8051 microcontroller by mazidi
DOC
22 microcontroller programs
PDF
Advanced motion controls mc1xzdcr
Nefrock勉強会 in大岡山「FPGAでゲーム機を作ろう!の会」Day4
Dsd lab Practical File
Micro
Micro Assignment 1
Robotic control
Advanced motion controls mc1xdz01
Interrupts
Gd35 manual v1.5
Two digit-countdown-timer
Sample slide Allen-Bradley
Arduino cic3
Advanced motion controls mc1xdz
ADC (Analog to Digital conversion) using LPC 1768
CODING IN ARDUINO
Solution manual 8051 microcontroller by mazidi
22 microcontroller programs
Advanced motion controls mc1xzdcr
Ad

Similar to Controlling Motors for Robot (20)

TXT
PIC and LCD
DOCX
Microcontroladores: programas de CCS Compiler.docx
PPTX
Sensors and Actuators in Arduino, Introduction
DOCX
codings related to avr micro controller
PDF
Combine the keypad and LCD codes in compliance to the following requ.pdf
TXT
Flicking LED C code
PPTX
introduction to ARM C programming language
PDF
báo cáo thực hành kỹ thuật vi xử lý PTIT
PDF
What will be quantization step size in numbers and in voltage for th.pdf
DOCX
Codigo fuente
DOCX
Microcontroller (8051) general and simple alp n cprograms
PDF
Pwm wave
PDF
PWM wave generator using microcontroller
PDF
Arduino uno basic Experiments for beginner
PPTX
mod-4.pptx
PDF
What's wrong with my code- I am coding a battleship game that uses a d (1).pdf
TXT
TXT
Atmega lcd programing_with_header_file
PPTX
LCD_Example.pptx
PIC and LCD
Microcontroladores: programas de CCS Compiler.docx
Sensors and Actuators in Arduino, Introduction
codings related to avr micro controller
Combine the keypad and LCD codes in compliance to the following requ.pdf
Flicking LED C code
introduction to ARM C programming language
báo cáo thực hành kỹ thuật vi xử lý PTIT
What will be quantization step size in numbers and in voltage for th.pdf
Codigo fuente
Microcontroller (8051) general and simple alp n cprograms
Pwm wave
PWM wave generator using microcontroller
Arduino uno basic Experiments for beginner
mod-4.pptx
What's wrong with my code- I am coding a battleship game that uses a d (1).pdf
Atmega lcd programing_with_header_file
LCD_Example.pptx
Ad

More from Varad Manglekar (10)

PPTX
Cross Helmet
PPTX
Basic concepts of practical electronics
PPTX
Sensors and Switches
PPTX
PPTX
Line follower robot
PPTX
Introduction to Embedded System
PPTX
Introduction to embedded systems
PPTX
Basic components in Embedded System
PPTX
simple ADC Interfacing
PPTX
Basic interfacing of LEDs
Cross Helmet
Basic concepts of practical electronics
Sensors and Switches
Line follower robot
Introduction to Embedded System
Introduction to embedded systems
Basic components in Embedded System
simple ADC Interfacing
Basic interfacing of LEDs

Recently uploaded (20)

PDF
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
PDF
737-MAX_SRG.pdf student reference guides
PPTX
Artificial Intelligence
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
Geodesy 1.pptx...............................................
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
Current and future trends in Computer Vision.pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Construction Project Organization Group 2.pptx
PPTX
Sustainable Sites - Green Building Construction
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PREDICTION OF DIABETES FROM ELECTRONIC HEALTH RECORDS
737-MAX_SRG.pdf student reference guides
Artificial Intelligence
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Geodesy 1.pptx...............................................
Foundation to blockchain - A guide to Blockchain Tech
R24 SURVEYING LAB MANUAL for civil enggi
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Fundamentals of safety and accident prevention -final (1).pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Internet of Things (IOT) - A guide to understanding
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Current and future trends in Computer Vision.pptx
CYBER-CRIMES AND SECURITY A guide to understanding
Construction Project Organization Group 2.pptx
Sustainable Sites - Green Building Construction
Categorization of Factors Affecting Classification Algorithms Selection
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks

Controlling Motors for Robot

  • 2. Moving the bot….. MOTOR 1 MOTOR 2 MOVEMENT 10 01 FORWARD 10 00 SLIGHT RIGHT 10 10 SHARP RIGHT 00 01 SLIGHT LEFT 01 01 SHARP LEFT 01 10 BACKWARD
  • 4. Lets Program the Motors… #include<avr/io.h> #include<compat/deprecated.h> #include<util/delay.h> int main(void) { DDRD=0b11111111; //PORT D pins are output// sbi(PORTD,4); //Set bit 4 of port D// sbi(PORTD,5); //Set bit 5 of port D// DDRC=0b11110000; while(1) { PORTC=0b10010000; //Move Forward } }
  • 5. #include<avr/io.h> #include<compat/deprecated.h> #include<util/delay.h> int main(void) { DDRD=0b11111111; //PORT D pins are output// sbi(PORTD,4); //Set bit 4 of port D// sbi(PORTD,5); //Set bit 5 of port D// DDRC=0b11110000; while(1) { PORTC=0b10010000; //Move Forward _delay_ms(1000); PORTC=0b01100000; //Move Backward _delay_ms(1000); }
  • 6. Lets turn the bot…..#include<avr/io.h> #include<compat/deprecated.h> #include<util/delay.h> int main(void) { DDRD=0b11111111; //PORT D pins are output// sbi(PORTD,4); //Set bit 4 of port D// sbi(PORTD,5); //Set bit 5 of port D// DDRC=0b11110000; while(1) { PORTC=0b10000000; //Slight right turn _delay_ms(1000); PORTC=0b10100000; //Sharp right turn _delay_ms(1000); }}
  • 7. Now take a left turn…. #include<avr/io.h> #include<util/delay.h> int main(void) { DDRD=0b11111111; //PORT D pins are output// sbi(PORTD,4); //Set bit 4 of port D// sbi(PORTD,5); //Set bit 5 of port D// DDRC=0b00001111; while(1) { PORTC=0b00010000; //Slight left turn _delay_ms(1000); PORTC=0b01010000//Sharp left turn _delay_ms(1000); }