Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save urmil0071/468d270bf9b80a2a77298a92c8b85924 to your computer and use it in GitHub Desktop.
Save urmil0071/468d270bf9b80a2a77298a92c8b85924 to your computer and use it in GitHub Desktop.
(INCOMPLETE)(MINIMAL INSTRUCTIONS) Add 0x24 and 0x56 and show it on LCD without using lcd.print() or lcd.write()
#include <Arduino.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(A0,A1,A2,A3,A4,A5);
void setup()
{
lcd.begin(16,2);
lcd.clear();
lcd.setCursor(0,0);
byte x1=0x24;
byte x2=0x56;
byte z=x1+x2;
byte z1=z>>4;
z1=z1&0x0F;
byte z2= z>>0;
z2=z2&0x0F;
if (z1<=9)
{
z1=z1+0x30;
}
else
{
z1=z1+0x37;
}
if (z2<=9)
{
z2=z2+0x30;
}
else
{
z2=z2+0x37;
}
Serial.begin(9600);
byte p=0;
/// configure LCDDR
digitalWrite(A0,LOW);
digitalWrite(A0,HIGH);
delay(5);
byte zz[]={z1,z2};
byte i,cc;
while(p<=1)
{ i=7; // for loop variable
cc=1;
while(cc<=2)
{
for (byte pc=5;i>=i-3;i--,pc--) ///i-3 = 7-3 = 4 /// pc goes from 5 to 2
{
bitWrite(PORTC,pc,bitRead(zz[p],i));
} // for loop ends
digitalWrite(A1,LOW);
digitalWrite(A1,HIGH);
digitalWrite(A1,LOW);
delay(5);
cc=cc+1;
} // second while ends
p=p+1;
} // first while ends
pinMode(13,OUTPUT); // added this to check whether the program gets stuck at loops or not
}
void loop()
{
digitalWrite(13,HIGH);
delay(500);
digitalWrite(13,LOW);
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment