work 5 lcd

Please download to get full document.

View again

All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
 34
 
  program LCD Mikrokontroller
Share
Transcript
  Lcd display   Latihan 2 #include <LiquidCrystal.h> LiquidCrystal lcd(36, 34, 32, 30, 28, 26); void setup() { lcd.begin(16,2); } void loop() { int i; lcd.setCursor(0,0); lcd.print( Teknik Elektro ); lcd.setCursor(0,1); lcd.print( Gadjah Mada ); { lcd.scrollDisplayLeft(); delay(300);} } Latihan 3 #include <LiquidCrystal.h> int num=0; LiquidCrystal lcd(36, 34, 32, 30, 28, 26); void setup() { int i; for(int i=47 ; i<=53 ; i+=2) {digitalWrite(i,HIGH);}  pinMode(i, INPUT); lcd.begin(16,2); lcd.display(); lcd.print(num); } void loop() { switch(button()) { case 47 : num +=1; if(0) case 49 : num -=1; if(0) case 53 : num =0; lcd.clear(); lcd.print(num); } } int button() { int i; for( int i=47 ; i <=53 ; i+=2){ if(digitalRead(i)==LOW){ while(digitalRead(i)==LOW) delay(6); return i; } } return 0; } Latihan Tambahan #include <LiquidCrystal.h> LiquidCrystal lcd(36, 34, 32, 30, 28, 26); void setup() { int i; for (i=31; i<=45; i+=2){  pinMode (i, OUTPUT); digitalWrite (i, HIGH); }  pinMode(10, INPUT); lcd.begin(16 ,2); lcd.display(); lcd.clear(); } void loop() { int tegangan = analogRead(10); int angka = (analogRead(10)* 5 / 1023 ); lcd.clear();   lcd.setCursor(0,0); lcd.print( POT_1= ); lcd.print(tegangan); lcd.setCursor(0,1); lcd.print( POT_1A= ); lcd.print(angka); int val; val = analogRead (10); turnOff (); showBar(val * 4 / 1023 - 1); delay (200); } void turnOff() { int i; for (i=31; i<= 45; i+=2) digitalWrite (i, HIGH); } void showBar(int val) { int i; for (i = 31; i<= 31+val*2; i+=2) digitalWrite (i, LOW); }
Related Search
Similar documents
View more
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks