Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
SeeedStudioShieldBot Class Reference
Seeed Studio Shield Bot Control Class In order to use this properly, you need to connect a jumper between pins eight and three on the shield bot, and you can't use either pins 8 or 3, which correspond to PTA13 and PTA12, respectively. More...
#include <SeeedStudioShieldBot.h>
Public Member Functions | |
| SeeedStudioShieldBot (PinName mot1A, PinName mot1En, PinName mot1B, PinName mot2A, PinName mot2En, PinName mot2B, PinName sensor_right, PinName sensor_inright, PinName sensor_center, PinName sensor_inleft, PinName sensor_left) | |
| Create a shield bot object. | |
| void | left_motor (float speed) |
| Switch on the left motor at the given speed. | |
| void | right_motor (float speed) |
| Switch on the right motor at the given speed. | |
| void | forward (float speed) |
| Switch on both motors, forwards at the given speed. | |
| void | backward (float speed) |
| Switch on both motors, backwards at the given speed. | |
| void | left (float speed) |
| Switch on both motors at the given speed, in opposite directions so as to turn left. | |
| void | right (float speed) |
| Switch on both motors at the given speed, in opposite directions so as to turn right. | |
| void | turn_left (float speed) |
| Turns left. | |
| void | turn_right (float speed) |
| Turns right. | |
| void | disable_left_motor () |
| Disable the left motor, by driving enable pin for the second motor low... | |
| void | disable_right_motor () |
| Disable the left motor, by driving enable pin for the first motor low... | |
| void | enable_left_motor () |
| Enable the left motor, by driving enable pin for the second motor high... | |
| void | enable_right_motor () |
| Enable the left motor, by driving enable pin for the first motor high... | |
| void | stop (int motor) |
| Stop a chosen motor. | |
| void | stopLeft () |
| Stop left motor. | |
| void | stopRight () |
| Stop right motor. | |
| void | stopAll () |
| Stop both motors at the same time. | |
| float | line_position () |
| Gives an indication of the data given by the reflectivity sensors. | |
Detailed Description
Seeed Studio Shield Bot Control Class In order to use this properly, you need to connect a jumper between pins eight and three on the shield bot, and you can't use either pins 8 or 3, which correspond to PTA13 and PTA12, respectively.
Also, in order to provide power to the freedom board, when running just of a lipo battery, you need to connect between 5V and VIN on the shield bot. Code/notes above only tested with version 0.9b, may not be needed/may not work in other cases...
Definition at line 8 of file SeeedStudioShieldBot.h.
Constructor & Destructor Documentation
| SeeedStudioShieldBot | ( | PinName | mot1A, |
| PinName | mot1En, | ||
| PinName | mot1B, | ||
| PinName | mot2A, | ||
| PinName | mot2En, | ||
| PinName | mot2B, | ||
| PinName | sensor_right, | ||
| PinName | sensor_inright, | ||
| PinName | sensor_center, | ||
| PinName | sensor_inleft, | ||
| PinName | sensor_left | ||
| ) |
Create a shield bot object.
- Parameters:
-
mot1A Left Motor A pin, default D5 mot1B Left Motor B pin, default D6 mot1En Left Motor enable pin, default D7 mot2A Right Motor A pin, default D8 mot2B Right Motor B pin, default D9 mot2En Right Motor enable pin, default D10 sensor_right Sensor right pin, default A0 sensor_inright Sensor in-right pin, default A1 sensor_center Sensor right pin, default A2 sensor_inleft Sensor in-left pin, default A3 sensor_left Sensor left pin, default D4
Definition at line 5 of file SeeedStudioShieldBot.cpp.
Member Function Documentation
| void backward | ( | float | speed ) |
Switch on both motors, backwards at the given speed.
- Parameters:
-
speed The speed, from 0.0 to 1.0 at which to spin the motor.
Definition at line 84 of file SeeedStudioShieldBot.cpp.
| void disable_left_motor | ( | ) |
Disable the left motor, by driving enable pin for the second motor low...
Definition at line 110 of file SeeedStudioShieldBot.cpp.
| void disable_right_motor | ( | ) |
Disable the left motor, by driving enable pin for the first motor low...
Definition at line 105 of file SeeedStudioShieldBot.cpp.
| void enable_left_motor | ( | ) |
Enable the left motor, by driving enable pin for the second motor high...
Definition at line 100 of file SeeedStudioShieldBot.cpp.
| void enable_right_motor | ( | ) |
Enable the left motor, by driving enable pin for the first motor high...
Definition at line 95 of file SeeedStudioShieldBot.cpp.
| void forward | ( | float | speed ) |
Switch on both motors, forwards at the given speed.
- Parameters:
-
speed The speed, from 0.0 to 1.0 at which to spin the motor.
Definition at line 73 of file SeeedStudioShieldBot.cpp.
| void left | ( | float | speed ) |
Switch on both motors at the given speed, in opposite directions so as to turn left.
- Parameters:
-
speed The speed, from 0.0 to 1.0 at which to spin the motors.
Definition at line 43 of file SeeedStudioShieldBot.cpp.
| void left_motor | ( | float | speed ) |
Switch on the left motor at the given speed.
- Parameters:
-
speed The speed, from 0.0 to 1.0 at which to spin the motor.
Definition at line 29 of file SeeedStudioShieldBot.cpp.
| float line_position | ( | ) |
Gives an indication of the data given by the reflectivity sensors.
Definition at line 118 of file SeeedStudioShieldBot.cpp.
| void right | ( | float | speed ) |
Switch on both motors at the given speed, in opposite directions so as to turn right.
- Parameters:
-
speed The speed, from 0.0 to 1.0 at which to spin the motors.
Definition at line 49 of file SeeedStudioShieldBot.cpp.
| void right_motor | ( | float | speed ) |
Switch on the right motor at the given speed.
- Parameters:
-
speed The speed, from 0.0 to 1.0 at which to spin the motor.
Definition at line 17 of file SeeedStudioShieldBot.cpp.
| void stop | ( | int | motor ) |
Stop a chosen motor.
- Parameters:
-
motor Number, either 1 or 2 choosing the motor.
Definition at line 137 of file SeeedStudioShieldBot.cpp.
| void stopAll | ( | ) |
Stop both motors at the same time.
Different to disable.
Definition at line 158 of file SeeedStudioShieldBot.cpp.
| void stopLeft | ( | ) |
Stop left motor.
Definition at line 146 of file SeeedStudioShieldBot.cpp.
| void stopRight | ( | ) |
Stop right motor.
Definition at line 152 of file SeeedStudioShieldBot.cpp.
| void turn_left | ( | float | speed ) |
Turns left.
- Parameters:
-
speed The speed, from 0.0 to 1.0 at which to spin the motor.
Definition at line 55 of file SeeedStudioShieldBot.cpp.
| void turn_right | ( | float | speed ) |
Turns right.
- Parameters:
-
speed The speed, from 0.0 to 1.0 at which to spin the motor.
Definition at line 61 of file SeeedStudioShieldBot.cpp.
Generated on Mon Jul 18 2022 17:25:39 by
1.7.2