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.
StateMachine Class Reference
This class implements a simple state machine for a mobile robot. More...
#include <StateMachine.h>
Public Member Functions | |
StateMachine (Controller &controller, DigitalOut &enableMotorDriver, DigitalOut &led0, DigitalOut &led1, DigitalOut &led2, DigitalOut &led3, DigitalOut &led4, DigitalOut &led5, DigitalIn &button, IRSensor &irSensor0, IRSensor &irSensor1, IRSensor &irSensor2, IRSensor &irSensor3, IRSensor &irSensor4, IRSensor &irSensor5) | |
Creates and initializes a state machine object. | |
virtual | ~StateMachine () |
Deletes the state machine object and releases all allocated resources. | |
int | getState () |
Gets the actual state of this state machine. |
Detailed Description
This class implements a simple state machine for a mobile robot.
It allows to move the robot forward, and to turn left or right, depending on distance measurements, to avoid collisions with obstacles.
Definition at line 21 of file StateMachine.h.
Constructor & Destructor Documentation
StateMachine | ( | Controller & | controller, |
DigitalOut & | enableMotorDriver, | ||
DigitalOut & | led0, | ||
DigitalOut & | led1, | ||
DigitalOut & | led2, | ||
DigitalOut & | led3, | ||
DigitalOut & | led4, | ||
DigitalOut & | led5, | ||
DigitalIn & | button, | ||
IRSensor & | irSensor0, | ||
IRSensor & | irSensor1, | ||
IRSensor & | irSensor2, | ||
IRSensor & | irSensor3, | ||
IRSensor & | irSensor4, | ||
IRSensor & | irSensor5 | ||
) |
Creates and initializes a state machine object.
Definition at line 20 of file StateMachine.cpp.
~StateMachine | ( | ) | [virtual] |
Deletes the state machine object and releases all allocated resources.
Definition at line 33 of file StateMachine.cpp.
Member Function Documentation
int getState | ( | ) |
Gets the actual state of this state machine.
- Returns:
- the actual state as an int constant.
Definition at line 42 of file StateMachine.cpp.
Generated on Sat Jul 23 2022 17:01:00 by
