#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <stdio.h>
#include <math.h>
long long int binNumber = 0;
int power = 0;
int num=4;
// while (num > 0) {
// int rem = num % 2;
// long long int temp = pow(10, power);
// binNumber += rem * temp;
// power++;
// num /= 2;
// }
int bin=1;
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
Wire.setSDA(8);
Wire.setSCL(9);
Wire.begin();
int num=12;
int binaryNum[32]; // Assuming 32 bit integer.
int i=0;
for ( ;num > 0; ){
binaryNum[i++] = num % 2;
num /= 2;
}
// Printing array in reverse order.
for (int j = i-1; j >= 0; j--)
printf("%d", binaryNum[j]);
lcd.init();
lcd.backlight();
lcd.begin(0,2);
lcd.print("Hello World!");
lcd.setCursor(2, 1);
bin++;
lcd.print(bin);
bin++;
}
void loop() {
bin++;
delay(1); // Adding a delay() here speeds up the simulation
}