|
楼主 |
发表于 2017-10-19 20:51
|
显示全部楼层
忘记经代码了。补上。
#include <Arduino.h>
#include "KittenBot.h"
#include "ServoTimer2.h"
KittenBot kb;
ServoTimer2 servo;
void setup(){
servo.attach(A2);
delay(5*1000);
kb.runDCMotor(0,100);
kb.runDCMotor(1,100);
delay(2*1000);
kb.motorStop();
kb.motorRunByIndex(2,100);
kb.motorRunByIndex(3,100);
delay(1*1000);
kb.motorStop();
kb.runDCMotor(0,-100);
kb.runDCMotor(1,-100);
delay(2*1000);
kb.motorStop();
kb.motorRunByIndex(2,100);
kb.motorRunByIndex(3,100);
delay(1*1000);
kb.motorStop();
servo.write(10);
delay(2*1000);
servo.write(20);
delay(2*1000);
kb.motorRunByIndex(2,100);
kb.motorRunByIndex(3,100);
delay(2*1000);
kb.motorStop();
servo.write(0);
delay(2*1000);
servo.write(90);
delay(2*1000);
kb.runDCMotor(0,100);
kb.runDCMotor(1,100);
delay(2*1000);
kb.motorStop();
kb.motorRunByIndex(2,100);
kb.motorRunByIndex(3,100);
delay(1*1000);
kb.motorStop();
servo.write(10);
delay(2*1000);
servo.write(20);
delay(2*1000);
servo.write(0);
delay(2*1000);
servo.write(90);
delay(2*1000);
kb.runDCMotor(0,100);
kb.runDCMotor(1,100);
delay(2*1000);
kb.motorStop();
kb.motorRunByIndex(2,100);
kb.motorRunByIndex(3,100);
delay(1*1000);
kb.motorStop();
servo.write(10);
delay(2*1000);
servo.write(20);
delay(2*1000);
servo.write(0);
delay(2*1000);
servo.write(90);
delay(2*1000);
}
void loop(){
kb.loop();
}
因为是用WIFI操作的,所以可以根据需要来进行编程 。 |
|