#include <LiquidCrystal.h>
//LCD pin to Arduino
const int pin_RS = 8;
const int pin_EN = 9;
const int pin_d4 = 4;
const int pin_d5 = 5;
const int pin_d6 = 6;
const int pin_d7 = 7;
const int pin_BL = 10;
LiquidCrystal lcd( pin_RS, pin_EN, pin_d4, pin_d5, pin_d6, pin_d7);
int main(void) {
init();
// put your setup code here, to run once:
unsigned char switches;
DDRC = 0x00;
DDRA = 0xFF;
PORTC = 0xFF;
Serial.begin(115200);
Serial.println("Welcome to the Micocontrollers!");
Serial.println("-------------------------------");
// put your setup code here, to run once:
/*lcd.begin(16, 2);
lcd.setCursor(0,0);
lcd.print("TAFE SA");
lcd.setCursor(0,1);
lcd.print("Slide the pot");*/
while (1) {
WriteLCDInt(0,0,65536);
delay(3000);
lcd.clear();
WriteLCDInt(11,0,123456);
delay(3000);
lcd.clear();
WriteLCDInt(0,1,-756);
delay(3000);
lcd.clear();
delay(3000);
WriteLCDInt(2,3,666);
delay(3000);
lcd.clear();
/*int x;
x = analogRead (0);
Serial.println(x, DEC);
delay(5000);*/
}
}
void WriteLCDInt (int col, int row, double number){
if (col >= 0 && col <=15 && row >=0 && row<=1 && number >-1000000000000000 && number < 100000000000000000)
{
lcd.setCursor(col,row);
lcd.print(number);
}else{
lcd.clear();
lcd.print("invalid position of the cursor");
}
}