Somewhat working state

This commit is contained in:
Imbus 2024-03-24 02:35:30 +01:00
parent 19c7d6d0bc
commit 7e4643e789

26
main.c
View file

@ -8,8 +8,8 @@
#define LED_PIN PB5 // Define the pin connected to the LED #define LED_PIN PB5 // Define the pin connected to the LED
#include <avr/io.h> #include <avr/io.h>
#include <util/delay.h>
#include <math.h> #include <math.h>
#include <util/delay.h>
#include "MPU6050.h" #include "MPU6050.h"
#include "i2c.h" #include "i2c.h"
@ -33,23 +33,34 @@ void blink() {
} }
int main(void) { int main(void) {
// int16_t accel_data[3]; // Array to store accelerometer data (X, Y, Z)
// int16_t gyro_data[3]; // Array to store gyroscope data (X, Y, Z)
int32_t iteration = 0;
initUART(); initUART();
UART_println("ATmega328P Initialized!"); UART_println("UART Initialized!");
DEBUG("DEBUG mode enabled!");
I2C_init(); I2C_init();
UART_println("I2C Initialized!"); UART_println("I2C Initialized!");
MPU6050_Init(); MPU6050_Init();
UART_println("MPU6050 Initialized!");
while (1) { while (1) {
UART_println("Hello, World!"); UART_println("%d Hello, World!", iteration++);
_delay_ms(1000); _delay_ms(1000);
// Read accelerometer data
// MPU6050_Read_Accel(accel_data);
// // Read gyroscope data
// MPU6050_Read_Gyro(gyro_data);
} }
return 0; return 0;
} }
// int main() { // int main() {
// int16_t accel_data[3]; // Array to store accelerometer data (X, Y, Z)
// int16_t gyro_data[3]; // Array to store gyroscope data (X, Y, Z)
// // Initialize MPU-6050 // // Initialize MPU-6050
// i2c_init(); // i2c_init();
@ -62,8 +73,9 @@ int main(void) {
// MPU6050_Read_Gyro(gyro_data); // MPU6050_Read_Gyro(gyro_data);
// // Print accelerometer and gyroscope data // // Print accelerometer and gyroscope data
// printf("Accelerometer (mg): X=%d, Y=%d, Z=%d\n", accel_data[0], accel_data[1], accel_data[2]); // printf("Accelerometer (mg): X=%d, Y=%d, Z=%d\n", accel_data[0],
// printf("Gyroscope (°/s): X=%d, Y=%d, Z=%d\n", gyro_data[0], gyro_data[1], gyro_data[2]); // accel_data[1], accel_data[2]); printf("Gyroscope (°/s): X=%d, Y=%d,
// Z=%d\n", gyro_data[0], gyro_data[1], gyro_data[2]);
// _delay_ms(1000); // Delay for 1 second // _delay_ms(1000); // Delay for 1 second
// } // }