Servo-Test

Moderator: paulluis

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable
André
Posts: 2
Joined: Sat Nov 05, 2016 9:31 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Servo-Test

Postby André » Sat Dec 10, 2016 11:23 am

#include <Servo.h>
Servo motorL;
Servo motorR;

void setup() {
motorL.attach(9);
motorR.attach(8);
}
void loop() {
drive(0, 170, 2000 );
stop();
delay(1000);
drive(1, 170, 2000 );
stop();
delay(1000);
}
/**
* direction: 0 oder 1
* speed: 0 - 180 eingeben
* time: angabe der zeit in millisec
*/
void drive(int direction, int speed, int time){

if(direction == 0 ){
motorL.write(180-speed);
motorR.write(speed);
}
if(direction == 1 ){
motorL.write(speed);
motorR.write(180-speed);
}
delay(time);

}
/**
* stop
*/
void stop(){
motorL.write(90);
motorR.write(90);
}

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Return to “Servo”

Who is online

Users browsing this forum: No registered users and 0 guests