This is an old revision of the document!
Related to: [HW] Motor Module
Diese Bibliothek enthält Funktionen um die verschiedenen HomeLab Motoren zu kontrollieren. Es gibt Funktionen für die DC, Stepper und Servomotoren, This library contains functions to control different HomeLab motors. There are functions for DC, stepper and servo motors.
Initializes one of the DC motor controllers. Parameters:
Drives one of the DC motor controllers. Parameters:
Initializes one of the unipolar stepper motor controllers. Parameters:
Unipolar stepper motor half-stepping command. Functions is blocking as it is fulfilled as long as steps are done. Parameters:
Initializes bipolar stepper motor controller.
Bipolar stepper motor half-stepping command. Functions is blocking as it is fulfilled as long as steps are done. Parameters:
Initializes one of a servo motor PWM signal generations units in ATmega128 timer 1. PWM signal is 50 hz with high period of 1.5 ms ± 0.5 ms. Parameters:
Servo motor pulse width control command. If positioning servo motor is driven, its position is altered, if rotating one, its rotation speed is altered. Parameters:
Das folgende Programm veranschaulicht das Nutzen von DC, Stepper und Servomotoren. The following program demonstrates the usage of DC, stepper and servo motors.
#include <homelab/module/motors.h> int main(void) { // DC motors initialization. dcmotor_init(0); dcmotor_init(1); // Bipolar stepper initialization. bipolar_init(); // Servo motors initialization. servomotor_init(0); servomotor_init(1); // One DC motors drives forward, another in backward direction. dcmotor_drive(0, -1); dcmotor_drive(1, +1); // Rotating the stepper motor 100 steps in one direction // and then back with twice the speed. bipolar_halfstep(1, 100, 50); bipolar_halfstep(-1, 100, 25); // Rotating servo motors in opposite directions. servomotor_position(0, -100); servomotor_position(1, +100); }