// Howdy 👋.
//
// If you are new to writing code in Flux make sure to check out our get started docs: https://docs.flux.ai/reference/introduction
//
// We also have a Flux Slack Community in case you need help: https://join.slack.com/t/fluxcommunity/shared_invite/zt-p48n941f-wzQ06kGmuFJ2HXnGYT1JkA
//
// To infinity and beyond 🚀
#include < avr / io.h >
#include < util / delay.h >
#define LCD_PORT PORTB // Connect LCD data pins (D4-D7) to PORTB
#define LCD_DDR DDRB // Data Direction Register for LCD
#define RS PD0 // Register Select pin connected to PD0
#define EN PD1 // Enable pin connected to PD1
#define SENSOR_PIN 0 // LM35 connected to ADC0
#define COOLING_RELAY PD3 // Relay connected to PD3
// Function to send commands to the LCD
void LCD_Command(unsigned char cmnd) {
LCD_PORT = (LCD_PORT & 0x0F) | (cmnd & 0xF0); // Send higher nibble
PORTD &= ~(1 << RS); // RS = 0 for command
PORTD |= (1 << EN); // Enable pulse