Pesquisar

Postagens populares

sexta-feira, 11 de maio de 2012

Continuous2Wheels - For two wheels servo motor Arduino Robots


Continuous2Wheels - Lib for Arduino

Continuous2Wheels is an Arduino Library to control arduino's two wheels "by Continuous Servo Motors" robot moves.


Official page code: Continuous2Wheels no GitHub






Installation

Clone or 
download the code of project to Arduino's libraries folder: 

on Ubuntu (/usr/share/arduino/libraries/) if you have installed Arduino's IDE with apt-get or if downloaded: on Windows, Mac or Linux (The folder is inside the decompressed folder)

Now is everything ready
, just: 

Open your Arduino's IDE,  got to SKETCKS LIBRARIES → Import: Continuous2Wheels
 

Usage

#include <Servo.h>
#include <Continuous2Wheels.h> //Importing the lib

Servo rightWheel, leftWheel;
int rightWheelPin = 9; // right wheel pin
int leftWheelPin = 10; // left whreel pin
double wheelRadius = 3.6; // wheels radius in centimeter
double bendRadius = 12.2; // bend radius, is the distance from one wheel to another, it's the truck size, in centimeter
// Creating a instance for lib
// Don't forget to pass the Servo pointers, to do it, just put & before the name
Continuous2Wheels c2w(&rightWheel, &leftWheel, wheelRadius, bendRadius);

void setup(){
     // Configure the servo motors normally
     rightWheel.attach(rightWheelPin);
     leftWheel.attach(leftWheelPin);
}

void loop(){
     c2w.forward(45); // Move the robot forward in a speed of 45
     delay(4000);
     c2w.bend(90); // Make a bend to right of 90° degrees
     delay(4000);
     c2w.backward(45); // Move the robot backward in a speed of 45
     delay(4000);
     c2w.bend(-90); // Make a bend to left of 90° degrees
     delay(4000);
     c2w.stop(); // Stop the wheels
     delay(10000);
}

This example uses the simplest functionalities from the lib, son I'll post another post with advanced functionalities, but, DON'T WAIT for this if you want to see then now, got to the official page code Continuous2Wheels no GitHub


Licença Creative Commons

 O trabalho Continuous2Wheels de AJ Alves foi licenciado com uma Licença Creative Commons - Atribuição - CompartilhaIgual 3.0 Não Adaptada.
Com base no trabalho disponível em github.com.
Podem estar disponíveis autorizações adicionais ao âmbito desta licença em github.com/zerokol/.

Nenhum comentário: