Skip to content
Snippets Groups Projects
Select Git revision
  • 3db40d5f11cd10acd3a8ca27e4a44d31da44dd71
  • main default protected
2 results

Robotcar_functions.h

Blame
  • Forked from bits_libs / BitS1-Robotcar
    Source project has a limited visibility.
    Robotcar_functions.h 20.48 KiB
    /***************************************************
       ________  ___  _________  ________    _____
      |\   __  \|\  \|\___   ___\\   ____\  / __  \
      \ \  \|\ /\ \  \|___ \  \_\ \  \___|_|\/_|\  \
       \ \   __  \ \  \   \ \  \ \ \_____  \|/ \ \  \
        \ \  \|\  \ \  \   \ \  \ \|____|\  \   \ \  \
         \ \_______\ \__\   \ \__\  ____\_\  \   \ \__\
          \|_______|\|__|    \|__| |\_________\   \|__|
                                    \|_________|
      Name:
      BitS1 v2
    
      Author:
      Prof. Kamau
      Jannis Kampmann
      Timo Altan
      IFK TH Köln
    
      Last Modified:
      21.08.2023
        Switch from libraries "DeviceDriverSet_xxx0" to "thk-motor-driver-v2.0" & "MPU6050_getdata" to "thk_imu-v2.0"
      08 September 2022
        improvement outline / format
      15 Juli 2022
        Recoding all functions
    
    **************************************************/
    
    #define Key_pin 2
    #define RGBLed_pin 4
    #define Echo_pin 12
    #define Trig_pin 13
    #define OpticSensorR A0
    #define OpticSensorM A1
    #define OpticSensorL A2
    #define Voltage_pin A3
    #define NUM_LEDS 60
    
    const int MOTOR_COUNT = 1;
    const int MOTOR_STBY = 3;
    const int MOTOR_PWM_A = 5;
    const int MOTOR_IN1 = 8;
    const int MOTOR_IN2 = 8;
    const int MOTOR_PWM_B = 6;
    const int MOTOR_IN3 = 7;
    const int MOTOR_IN4 = 7;
    
    thk_MotorDriverTB6612FNG motorR(MOTOR_COUNT, MOTOR_STBY, MOTOR_PWM_A, MOTOR_IN1, MOTOR_IN2, 0, 0, 0);
    thk_MotorDriverTB6612FNG motorL(MOTOR_COUNT, MOTOR_STBY, MOTOR_PWM_B, MOTOR_IN3, MOTOR_IN4, 0, 0, 0);
    
    const int INTERRUPT_PIN = 0;   // Wenn kein Interrupt Pin angeschlossen ist, dann Interrupt Pin gleich 0 setzen.
    thk_IMU imu(INTERRUPT_PIN);
    
    extern unsigned long start_time = 0;
    char commandline_input = 'E';
    char last_direction = 'D';
    int commandline_output = 3;
    int not_enough_voltage_counter = 0;
    int low_voltage_counter = 0;
    int modecounter;
    int obstacle_velocity = 0;
    int no_reflection = 950;
    int divisor = 1000;
    int rest = divisor / 2;
    boolean mode_changed = false;
    float voltage_low = 7.2;
    float voltage_min = 7.0;
    float yaw = 0;
    float pitch = 0;
    float roll = 0;