Sie sind auf Seite 1von 4

1.

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
lcd.begin(16, 2); lcd.print("hello, world!");
}
void loop() { lcd.setCursor(0, 1); lcd.print(millis()/1000);
}
2..
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int tombol=10,tombol2=9,tombol3=8;
void setup() {
lcd.begin(16, 2);
pinMode(tombol,INPUT); pinMode(tombol2,INPUT);pinMode(tombol3,INPUT);
}
void loop() {
if(digitalRead(tombol)==LOW){
lcd.setCursor (0,0);
lcd.print("Hello world");
}
else if(digitalRead(tombol2)==LOW){
lcd.clear();
lcd.setCursor(0, 1); lcd.print("hello world");
}
else if(digitalRead(tombol3)==LOW){
lcd.clear();
}
}
4.#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
lcd.begin(16, 2);
lcd.print("hello, world!");
delay(1000);
}
void loop() {
for (int positionCounter = 0;positionCounter < 13;positionCounter++) { lcd.scrol
lDisplayLeft();
delay(150);
}
for (int positionCounter = 0;positionCounter < 29;positionCounter++) { lcd.scrol
lDisplayRight();
delay(150);
}
for (int positionCounter = 0; positionCounter < 16;positionCounter++) { lcd.scro
llDisplayLeft();
delay(150);
}
delay(1000);
}
5..#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int tmbl1=10,tmbl2=9,tmbl3=8;
void setup() {
lcd.begin(16, 2);
lcd.print("hello, world!");
delay(1000);
pinMode(tmbl1,INPUT);
pinMode(tmbl2,INPUT);
pinMode(tmbl3,INPUT);
}
void loop() {
if(digitalRead(tmbl1)==LOW){
for (int positionCounter = 0;positionCounter < 13;positionCounter++) { lcd.scrol
lDisplayRight();
delay(150);
}}
else if(digitalRead(tmbl2)==LOW){
for (int positionCounter = 0;positionCounter < 13;positionCounter++) { lcd.scrol
lDisplayLeft();
delay(150);
}}

delay(150);
}
6..
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup(){ lcd.begin(16, 2);
Serial.begin(9600);
}
void loop() {
if (Serial.available()) { delay(100);
lcd.clear();
while (Serial.available() > 0) { lcd.write(Serial.read());
}
}
}

7..
8..
9..
#include <LiquidCrystal_SR_LCD3.h>
const int PIN_LCD_STROBE=2;
const int PIN_LCD_DATA = 3;
const int PIN_LCD_CLOCK = 4;
LiquidCrystal_SR_LCD3 lcd(PIN_LCD_DATA, PIN_LCD_CLOCK, PIN_LCD_STROBE);
int tom=7,tom2=6,tom3=5;
int led=10,led2=9,led3=8;
void setup(){
lcd.begin(16,2);
lcd.home ();
pinMode(tom,INPUT);pinMode(tom2,INPUT);pinMode(tom3,INPUT);
delay(1000);
lcd.clear();
pinMode(led,OUTPUT);pinMode(led2,OUTPUT);pinMode(led3,OUTPUT);
}
void loop() {
if((digitalRead(tom)==HIGH)and(digitalRead(tom2)==HIGH)){
lcd.clear();
}
if((digitalRead(tom)==LOW)and(digitalRead(tom2)==HIGH)){
lcd.setCursor (0, 0);lcd.print("TOMBOL 1 DITEKAN");
}
else if((digitalRead(tom2)==LOW)and(digitalRead(tom)==HIGH)){
lcd.setCursor (0, 1);lcd.print("TOMBOL 2 DITEKAN");
}
}
10..
#include <LiquidCrystal_SR_LCD3.h>
const int PIN_LCD_STROBE=2;
const int PIN_LCD_DATA = 3;
const int PIN_LCD_CLOCK = 4;
LiquidCrystal_SR_LCD3 lcd(PIN_LCD_DATA, PIN_LCD_CLOCK, PIN_LCD_STROBE);
int tom=7,tom2=6,tom3=5;int i,a;
int led=9,led2=10,led3=11;int pot=A0;
void setup(){
lcd.begin(16,2);
lcd.home ();
lcd.setCursor (0, 0);
lcd.print(" Variasi LED");
pinMode(tom,INPUT);pinMode(tom2,INPUT);pinMode(tom3,INPUT);pinMode(pot,OUTPUT);
delay(1000);
lcd.clear();
pinMode(led,OUTPUT);pinMode(led2,OUTPUT);pinMode(led3,OUTPUT);
}
void loop() {
if((digitalRead(tom)==HIGH)and(digitalRead(tom2)==HIGH)and(digitalRead(tom3)==
HIGH)){
lcd.clear();
digitalWrite(led,LOW);digitalWrite(led2,LOW);digitalWrite(led3,LOW);
analogWrite(led,0);analogWrite(led2,0);analogWrite(led3,0);
lcd.setCursor(0,0);
lcd.print("Tekan Tombol : ");
lcd.setCursor(0,1);lcd.print("(1.3LED ON) (2.RUNNINLED) (3.FADDING)");
for (int positionCounter = 0;positionCounter < 13;positionCounter++) { lcd.scrol
lDisplayRight();
delay(150);
}
}
if((digitalRead(tom)==LOW)and(digitalRead(tom2)==HIGH)and(digitalRead(tom3)==HIG
H)){
lcd.clear();lcd.setCursor (0, 0);lcd.print("LED ON ALL POTENSIO");
a=analogRead(pot);
a=a/4;
analogWrite(led,a);
analogWrite(led2,a);
analogWrite(led3,a);
}
else if((digitalRead(tom)==HIGH)and(digitalRead(tom2)==LOW)and(digitalRead(tom3)
==HIGH)){
lcd.clear();
lcd.setCursor (0, 0);
lcd.print("Running LED");
for (int positionCounter = 0;positionCounter < 13;positionCounter++) { lcd.scrol
lDisplayRight();
delay(150);}
digitalWrite(led,HIGH);delay(100);
digitalWrite(led,LOW);delay(100);
digitalWrite(led2,HIGH);delay(100);
digitalWrite(led2,LOW);delay(100);
digitalWrite(led3,HIGH);delay(100);
digitalWrite(led3,LOW);delay(100);
}
else if((digitalRead(tom)==HIGH)and(digitalRead(tom2)==HIGH)and(digitalRead(tom3
)==LOW)){
lcd.clear();
lcd.setCursor (0, 0);
lcd.print("FADDING LED");
for (int positionCounter = 0;positionCounter < 13;positionCounter++) { lcd.scrol
lDisplayRight();
delay(150);}
for(i=255;i>=0;i-=5){
analogWrite(led,i);delay(100);
analogWrite(led2,i);delay(100);
analogWrite(led3,i);delay(100);
}
}}