MyRobot is a library for the Arduino Platform. The intention is to be a complete robot controller that uses the Arduino Hardware Platform in general. This looks to improve code writing, making it faster, easier to use and makes use of a simple and readable syntax, since any kind of logic that involves code development is being done by lib, from mathematical calculations needed to Motor movements. The user will only have to worry about making the necessary and correctly made wiring.
APIHere it is listed all the functions and functionalities that lib is available to the user. Remembering that the entire development process is still in progress, so take into account any other update or modification that may occur in the API.
ServosTo configure the servo motors:
void servos(unsigned int esqPin, unsigned int dirPin);
Two pins are connected to the servos.
Analog SensorsTo configure analog sensors:
void analogSensors(int pins [], uint8_t STATE);
Passed an array of pins and the I / O state (Input or Output) of the sensor.
Digital SensorsTo configure the digital sensors:
void digitalSensors(int pins []; uint8_t STATE);
UltrasoundTo configure the Ultrasonic sensors:
void ultra(unsigned int TrigPin, unsigned int EchoPin);
Two pins are connected to the ultrasonic sensor.
UsageThe basic usage for this in an Arduino code, looks like this:
#include <MyRobot.h>
MyRobot bot;
int AnalogPins[4] = { 0, 1, 2, 3 };
void setup() {
Serial.begin(9600);
// Initializing some basic stuff like pins and states:
bot.servo(10, 11);
bot.ultra(12, 13);
bot.analogSensors(AnalogPins, INPUT);
}
void loop() {
// Using servos:
bot.goAhead();
delay(300);
bot.stopServo();
// Using Ultrassonic:
Serial.println( bot.getDistancia() );
// Using Analog Sensor:
Serial.println( bot.getAnalogRead(AnalogPins[0]) );
}
ExamplesYou can check some examples from the repository in Github, where the lib source code is hosted. Click here to go to the examples.
ContributeThis is a totally open-source project, so do not hesitate to send us your suggestions by adding issues to the Github repository by clicking here. Also help with pull requests development, all help is welcome.
And keep coding doing awesome things :)
Comments
Please log in or sign up to comment.