librairie pour robot Zumo
« Back to documentation index
zumo Class Reference
zumo control class
More...
#include <zumo.h >
Public Member Functions
zumo ()
Create the zumo object connected to the default pins.
zumo (PinName nrst, PinName tx, PinName rx)
Create the zumo object connected to specific pins.
void reset (void)
Force a hardware reset of the 3pi.
void stop (void)
Stop both motors.
float battery (void)
Read the battery voltage on the 3pi.
float line_position (void)
Read the position of the detected line.
void calibrated_sensors (unsigned short ltab[5])
lecture capteurs calibres
char speed (short spg, short spd)
fonction speed
char Calibrate_line_sensor_wait ()
Calibrate the sensors.
void leds (int val)
Write to the 8 LEDs.
Detailed Description
zumo control class
Example:
#include "mbed.h"
#include "zumo.h"
zumo pi;
int main() {
wait(0.5);
pi.forward(0.5);
wait (0.5);
pi.left(0.5);
wait (0.5);
pi.backward(0.5);
wait (0.5);
pi.right(0.5);
wait (0.5);
pi.stop ();
}
Definition at line 98 of file zumo.h .
Constructor & Destructor Documentation
Create the zumo object connected to the default pins.
Parameters:
nrst GPIO pin used for reset. for futre use
tx Serial transmit pin. Default is p9
rx Serial receive pin. Default is p10
Definition at line 12 of file zumo.cpp .
zumo
(
PinName
nrst ,
PinName
tx ,
PinName
rx
)
Create the zumo object connected to specific pins.
Definition at line 7 of file zumo.cpp .
Member Function Documentation
Read the battery voltage on the 3pi.
Returns: battery voltage as a float
Definition at line 103 of file zumo.cpp .
char Calibrate_line_sensor_wait
(
)
Calibrate the sensors.
Definition at line 51 of file zumo.cpp .
void calibrated_sensors
(
unsigned short
ltab [5] )
lecture capteurs calibres
Returns: tableau val capteurs de gauche à droite 0 blanc (reflexion max) 1000 noir (pas de reflexion)
Definition at line 112 of file zumo.cpp .
Write to the 8 LEDs.
Parameters:
leds An 8 bit value to put on the LEDs
Definition at line 127 of file zumo.cpp .
float line_position
(
void
)
Read the position of the detected line.
Returns: position as A normalised number -1.0 - 1.0 represents the full range. -1.0 means line is on the left, or the line has been lost 0.0 means the line is in the middle 1.0 means the line is on the right
Definition at line 108 of file zumo.cpp .
Force a hardware reset of the 3pi.
Definition at line 17 of file zumo.cpp .
char speed
(
short
spg ,
short
spd
)
fonction speed
Returns: pour le future retourne 0x0A pour indiquer bonne prise en compte. Pour le moment retourne rien.
Definition at line 27 of file zumo.cpp .
Stop both motors.
Definition at line 21 of file zumo.cpp .