DFRobot ROB0117 Краткое руководство по эксплуатации - Страница 11

Просмотреть онлайн или скачать pdf Краткое руководство по эксплуатации для Микроконтроллеры DFRobot ROB0117. DFRobot ROB0117 13 страниц. Basic kit for cherokey 4wd

2015/11/4
2. Download Code
#include <Servo.h>
#include <Metro.h>
Metro measureDistance = Metro(50);
Metro sweepServo = Metro(20);
int speedPin_M1 = 5;
int speedPin_M2 = 6;
int directionPin_M1 = 4;
int directionPin_M2 = 7;
unsigned long actualDistance = 0;
Servo myservo; // create 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};
void setup(){
myservo.attach(9);
Serial.begin(9600);
SensorSetup();
}
void loop(){
if(measureDistance.check() == 1){
https://www.dfrobot.com/wiki/index.php?title=Basic_Kit_for_Cherokey_4WD_SKU:ROB0117
Basic Kit for Cherokey 4WD SKU:ROB0117 - Robot Wiki
//M1 Speed Control
//M2 Speed Control
//M1 Direction Control
//M1 Direction Control
// distance measure command
// Serial initialization
// Sets the baud rate to 9600
11/13