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.
Dependents: NucleoF401_motor_test_simple Frequency_Counter_w_GPS_1PPS Nucleo_ACM1602_I2C_DC_Angle Frequency_Cntr_1PPS_F746ZG
DRV8830 Class Reference
#include <DRV8830.h>
Public Member Functions | |
| DRV8830 (PinName p_sda, PinName p_scl, uint8_t addr) | |
| Configure data pin. | |
| DRV8830 (I2C &p_i2c, uint8_t addr) | |
| Configure data pin (with other devices on I2C line) | |
| void | speed (float speed) |
| Set motor speed. | |
| void | set_voltage (float volt) |
| Set voltage. | |
| uint8_t | status () |
| Read status. | |
| void | reset () |
| Reset DRV8830 chip. | |
Detailed Description
DRV8830 class.
This is a driver code for the DRV8830 H-Bridge Voltage-Controlled Motor Driver. http://www.ti.com/product/drv8830
#include "mbed.h" #include "DRV8830.h" // I2C Communication DRV8830 motor(PinName p_sda, PinName p_scl, addr); // If you connected I2C line not only this device but also other devices, // you need to declare following method. I2C i2c(PinName p_sda, PinName p_scl); DRV8830 motor(I2C& p_i2c, addr); int main() { uint8_t status; // Speed control motor.speed(0.5); // CW motor.speed(-0.5); // CCW motor.speed(0.0); // Stop(FREE) // Check error and reset status = motor.status(); if (status & DRV8830_F_FAULT){ motor.reset(); } }
Definition at line 69 of file DRV8830.h.
Constructor & Destructor Documentation
| DRV8830 | ( | PinName | p_sda, |
| PinName | p_scl, | ||
| uint8_t | addr | ||
| ) |
Configure data pin.
- Parameters:
-
data SDA and SCL pins DRV8830 address (H/W configuration of A1,A0)
Definition at line 67 of file DRV8830.cpp.
| DRV8830 | ( | I2C & | p_i2c, |
| uint8_t | addr | ||
| ) |
Configure data pin (with other devices on I2C line)
- Parameters:
-
I2C previous definition DRV8830 address (H/W configuration of A1,A0)
Definition at line 73 of file DRV8830.cpp.
Member Function Documentation
| void reset | ( | ) |
| void set_voltage | ( | float | volt ) |
| void speed | ( | float | speed ) |
Set motor speed.
- Parameters:
-
speed (Range 0 to 1.0 or 0 to -1.0)
- Returns:
- none
Definition at line 79 of file DRV8830.cpp.
| uint8_t status | ( | ) |
Read status.
- Parameters:
-
none
- Returns:
- FAULT register content
Definition at line 138 of file DRV8830.cpp.
Generated on Wed Jul 13 2022 07:39:22 by
1.7.2