Download Print this page

Demo Codes - Waveshare Motor Driver HAT User Manual

Advertisement

Motor Driver HAT
DEV_Config.c(h): Defines PINS used and communication type, different between
BCM2835 and WiringPi.
PCA9685.c(h): Drive code of PCA9685 chip. Could output 16-channel PWM signal
via I2C interface
MotorDriver.c(.h): Drive code of TB6612FNG chip, control two motors.
main.c: main function

DEMO CODES

1. initialize BCM2835 libraries
if(DEV_ModuleInit())
exit(0);
2. Initialize motor and PCA9685
Motor_Init();
3. Control motors
Motor_Run(MOTORA, FORWARD, 100);
Parameter 1: MOTORA or MOTORB
Parameter 2: FORWARD or BACKWARD
Parameter 3: 0~100
If you use this module to control robot, with this function you can control the
whole motion of robot.
11 / 16

Advertisement

loading