AVR-Playground/main.c
2024-03-24 00:00:32 +01:00

44 lines
986 B
C

/*
* This code utilizes the AVR libraries for I2C and UART communication.
* Make sure to connect the SDA and SCL pins of the ATmega328P to the
* corresponding pins of your I2C temperature sensor. Additionally, you might
* need pull-up resistors for the I2C lines.
*/
#define LED_PIN PB5 // Define the pin connected to the LED
#include <avr/io.h>
#include <util/delay.h>
#include <math.h>
#include "MPU6050.h"
#include "i2c.h"
#include "uart.h"
void blink() {
// Set the LED pin as output
DDRB |= (1 << LED_PIN);
while (1) {
// Turn on the LED by setting the pin high
PORTB |= (1 << LED_PIN);
// Delay for 500 milliseconds
_delay_ms(500);
// Turn off the LED by setting the pin low
PORTB &= ~(1 << LED_PIN);
// Delay for 500 milliseconds
_delay_ms(500);
}
}
int main(void) {
initUART();
while(1) {
UART_println("Hello, World!");
_delay_ms(1000);
}
return 0;
}