Struct picoborgrev::PicoBorgRev[][src]

pub struct PicoBorgRev<T: Read + Write + WriteRead> { /* fields omitted */ }

The PicoBorgRev provides an easy way to interact with a PicoBorg Reverse from rust. The communication is done via the embedded-hal i2c traits and the PicoBorg Reverse is located at the i2c address 0x44 by default.

Methods

impl<T: Read + Write + WriteRead> PicoBorgRev<T>
[src]

Attempt to create a new PicoBorgRev.

This will fail if either the i2c device has an error or the PicoBorg Reverse is not found at the default address (0x44).

Sets the drive level for motor 1, from +1 to -1.

Sets the drive level for motor 2, from +1 to -1

Sets the drive level for all motors, from +1 to -1.

Sets all motors to stopped, useful when ending a program

Gets the drive level for motor 1, from +1 to -1.

Gets the drive level for motor 1, from +1 to -1.

Sets the current state of the Led, False for off, True for on

Reads the current state of the Led, False for off, True for on

Resets the Epo latch state, use to allow movement again after the Epo has been tripped.

Reads the system Epo latch state. If false the Epo has not been tripped, and movement is allowed. If true the Epo has been tripped, movement is disabled if the Epo is not ignored (see set_epo_ignore).

Movement can be re-enabled by calling reset_epo.

Sets the system to ignore or use the Epo latch, set to false if you have an Epo switch, true if you do not.

Reads the system Epo ignore state, false for using the Epo latch, true for ignoring the Epo latch.

Sets the system to enable or disable the communications failsafe. The failsafe will turn the motors off unless it is commanded at least once every 1/4 of a second.

Set to true to enable this failsafe or set to false to disable.

The failsafe is disabled at power on.

Read the current system state of the communications failsafe, true for enabled, false for disabled. The failsafe will turn the motors off unless it is commanded at least once every 1/4 of a second.

Reads the system drive fault state, False for no problems, True for a fault has been detected. Faults may indicate power problems, such as under-voltage (not enough power), and may be cleared by setting a lower drive power.

If a fault is persistent, it repeatably occurs when trying to control the board, this may indicate a wiring problem such as:

  • The supply is not powerful enough for the motors
    • The board has a bare minimum requirement of 6V to operate correctly
    • A recommended minimum supply of 7.2V should be sufficient for smaller motors
  • The + and - connections for either motor are connected to each other
  • Either + or - is connected to ground (Gnd, also known as 0V or earth)
  • Either + or - is connected to the power supply (V+, directly to the battery or power pack)
  • One of the motors may be damaged

Faults will self-clear, they do not need to be reset, however some faults require both motors to be moving at less than 100% to clear.

The easiest way to check is to put both motors at a low power setting which is high enough for them to rotate easily, such as 30%. Note that the fault state may be true at power up, this is normal and should clear when both motors have been driven.

If there are no faults but you cannot make your motors move check get_epo to see if the safety switch has been tripped.

For more details check the website at www.piborg.org/picoborgrev and double check the wiring instructions.

Sets the system to enable or disable the encoder based move mode. In encoder move mode (enabled) the encoder_move_motor* commands are available to move fixed distances. In non-encoder move mode (disabled) the set_motor* commands should be used to set drive levels.

The encoder move mode requires that the encoder feedback is attached to an encoder signal, see the website at www.piborg.org/picoborgrev for wiring instructions.

The encoder based move mode is disabled at power on.

Read the current system state of the encoder based move mode, true for enabled (encoder moves), false for disabled (power level moves)

Moves motor 1 until it has seen a number of encoder counts, up to 32767 Use negative values to move in reverse

Moves motor 2 until it has seen a number of encoder counts. Use negative values to move in reverse.

Moves all motors until it has seen a number of encoder counts. Use negative values to move in reverse.

Reads the current state of the encoder motion, false for all motors have finished, true for any motor is still moving.

Waits until all motors have finished performing encoder based moves If the motors stop moving the function will return true or if the timeout occurs it will return false.

Sets the drive limit for encoder based moves, from 0 to 1.

Gets the drive limit for encoder based moves, from 0 to 1.

Trait Implementations

impl<T: Read + Write + WriteRead> Drop for PicoBorgRev<T>
[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl<T> Send for PicoBorgRev<T> where
    T: Send

impl<T> Sync for PicoBorgRev<T> where
    T: Sync