INF2004-Project v0.1
 
Loading...
Searching...
No Matches
main.c File Reference

Driver demo code for the wheel encoder. More...

#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <sys/types.h>
#include "hardware/pwm.h"
#include "hardware/gpio.h"
#include "hardware/timer.h"
#include "pico/stdio.h"
#include "encoder/wheel_encoder.h"
Include dependency graph for main.c:

Macros

#define ENCODER_PIN   22
 GP22 for encoder input.
 
#define MM_TO_CM   10.0f
 Conversion factor from mm to cm.
 
#define MOTOR_PIN_ANTICLKWISE   17
 GPIO pin number for anticlockwise rotation.
 
#define MOTOR_PIN_CLKWISE   16
 GPIO pin number for clockwise rotation.
 
#define PWM_CLKDIV   100
 PWM clock divider.
 
#define PWM_PIN   0
 GPIO pin number for PWM output to control motor speed.
 
#define PWM_WRAP   62500
 PWM wrap value.
 

Functions

int main ()
 

Variables

wheel_encoder_t g_encoder
 Global struct for holding encoder data.
 

Detailed Description

Driver demo code for the wheel encoder.

Author
Bryan Seah
Version
0.1
Date
2023-11-26