4.3. operations header
#ifndef OPERATIONS
#define OPERATIONS
#include
#include
#include
// Struct for handling a servo's information. Positions are in terms of pulse width (0 to 4096)
typedef struct Customservo {
uint8_t index; // PWM output pin number (Adafruit servo shield)
uint16_t minpos; // Minimum position
uint16_t maxpos; // Maximum position
uint16_t pos; // Current position
uint16_t startpos; // Predetermined "safe" initial position
uint16_t measure_start; // Starting position for speed measurement (used only for small, standard, and large servos)
byte led; // PWM output pin number for the servo's LED
float arm_length; // Length of the servo's arm (used only for small, standard, and large servos)
String* info; // List containing the servo's information
} c_servo;
// Function declarations
void servo_speed_test(c_servo& servo, Adafruit_PWMServoDriver& pwm, LiquidCrystal_I2C lcd, volatile uint8_t& counter, volatile unsigned long& end_time);
void servo_force_measurement(c_servo& servo, Adafruit_PWMServoDriver& pwm, LiquidCrystal_I2C lcd, HX711 scale, uint16_t avg);
void servo_feedback_handling(c_servo& servo, Adafruit_PWMServoDriver& pwm, LiquidCrystal_I2C lcd, byte feedback_pin, uint16_t avg);
void servo_continuous_drive(c_servo& servo, Adafruit_PWMServoDriver& pwm, LiquidCrystal_I2C lcd, uint16_t avg);
void move_to_start(Adafruit_PWMServoDriver& pwm, c_servo& servo);
void display_info(c_servo& servo, LiquidCrystal_I2C& lcd, byte pin);
void init_view(byte operation_mode, LiquidCrystal_I2C lcd);
#endif