Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <LiquidCrystal.h>
- LiquidCrystal lcd(8,9,4,5,6,7);
- //kode modifikasi dari kode:credits to mem
- //http://forum.arduino.cc/index.php/topic,46320.0.html
- void printBits(byte lcdCol, byte lcdRow, byte myByte){
- lcd.setCursor(lcdCol,lcdRow);
- for(byte mask = 0x80; mask; mask >>= 1){
- if(mask & myByte)
- lcd.print('1');
- else
- lcd.print('0');
- }
- }
- void setup(void)
- {
- //
- lcd.begin(16,2);
- lcd.clear();
- lcd.print("Mulai");
- delay(600);
- int varA = 0b00100001;
- lcd.clear();
- //lcd.print(varA,BIN);
- printBits(0,0,varA);
- //delay(5);
- //varA <<= 3;
- //lcd.setCursor(0,1);
- //lcd.print(varA,BIN);
- //printBits(0,1,varA);
- //delay(2000);
- }
- void loop(void)
- {
- //
- byte varB = 0b00100001;
- byte i=0;
- //lcd.clear();
- //lcd.setCursor(0,1);
- //lcd.print(" ");
- for(i;i<10;i++)
- {
- lcd.setCursor(14,1);
- lcd.print(i);
- //lcd.setCursor(0,1);
- printBits(0,1,varB);
- varB<<=1;
- delay(3000);
- }
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement