background image

 

 

 

 

Basic

 

Kit

 

for

 

Turtle

 

2WD

 

SKU:ROB0118

 

 

 

Function Introduction 

This Kit will teach you how to build a automatic obstacle - avoidance robot which is achieved on the 
platform of the Turtle Robot,based on ultrasonic sensor as distance measuring device,and combined 
with servo.  

STEP 1: Assemble Robot

 

Refer to 

Instruction Manual

 

http://www.dfrobot.com.cn/image/data/ROB0005/CN/ROB0005%20InstructionManual%20V1.1.pdf

 

Precautions:  

1. Instruction Manual says nothing about how to deal with motor wire. The next pictrue tells it.  

 

Содержание ROB0118

Страница 1: ...the platform of the Turtle Robot based on ultrasonic sensor as distance measuring device and combined with servo STEP 1 Assemble Robot Refer to Instruction Manual http www dfrobot com cn image data RO...

Страница 2: ...2 Finished the robot chassis Then following the connection diagram to wire the hardware Motor Connection Physical map...

Страница 3: ...oid setup void loop carAdvance 100 100 delay 1000 carBack 100 100 delay 1000 carTurnLeft 250 250 delay 1000 carTurnRight 250 250 delay 1000 void carStop Motor Stop digitalWrite speedPin_M2 0 digitalWr...

Страница 4: ...talWrite directionPin_M2 LOW void carTurnRight int leftSpeed int rightSpeed Turn Right analogWrite speedPin_M2 leftSpeed digitalWrite directionPin_M1 LOW analogWrite speedPin_M1 rightSpeed digitalWrit...

Страница 5: ...rasonic Sensor Position Please see the Installation Manual http www dfrobot com cn images upload File 20141030183325g7lofm pdf 3 Fixed Servo Position STEP4 Debug Ultrasonic Sensor and Servo 1 Hardware...

Страница 6: ...Ultrasonic Sensor and Servo Controll...

Страница 7: ...ate servo object to control a servo int pos 60 int sweepFlag 1 int URPWM 3 PWM Output 0 25000US Every 50US represent 1cm int URTRIG 10 PWM trigger pin uint8_t EnPwmCmd 4 0x44 0x02 0xbb 0x01 distance m...

Страница 8: ...TRIG triggering a se nsor reading digitalWrite URTRIG LOW digitalWrite URTRIG HIGH reading Pin PWM will output pulses unsigned long distance pulseIn URPWM LOW if distance 50000 the reading is invalid...

Страница 9: ...M1 5 M1 Speed Control int speedPin_M2 6 M2 Speed Control int directionPin_M1 4 M1 Direction Control int directionPin_M2 7 M1 Direction Control unsigned long actualDistance 0 Servo myservo create servo...

Страница 10: ...ntln actualDistance delay 100 if sweepServo check 1 servoSweep if actualDistance 30 myservo write 90 if pos 90 carBack 100 100 Serial println carBack delay 100 carTurnRight 150 150 Serial println carT...

Страница 11: ...ial write EnPwmCmd i int MeasureDistance a low pull on pin COMP TRIG triggering a sensor r eading digitalWrite URTRIG LOW digitalWrite URTRIG HIGH reading Pin PWM will output pulses unsigned long dist...

Страница 12: ...n_M2 leftSpeed digitalWrite directionPin_M1 LOW analogWrite speedPin_M1 rightSpeed digitalWrite directionPin_M2 LOW void carTurnRight int leftSpeed int rightSpeed Turn Right analogWrite speedPin_M2 le...

Страница 13: ...o to po sition in variable pos if pos 119 sweepFlag false assign the var iable again else if pos 60 pos 120 pos pos 1 myservo write pos if pos 61 sweepFlag true Your own car was born https www dfrobot...

Отзывы: