You are on page 1of 2

COUNTER

#include <LiquidCrystal.h> if (statusMasuk == HIGH) maksimal = 0;


LiquidCrystal lcd(12, 11, 5, 4, 3, 2); { lcd.setCursor(9,0);
const int buttonMasuk = 6; Penghitung++; lcd.print(Penghitung);
const int buttonKeluar = 7; maksimal--; lcd.setCursor(9,1);
const int buttonReset = 8; digitalWrite(led, HIGH); lcd.print("KOSONG");
int Penghitung = 0; delay(100); digitalWrite(led, HIGH);
int statusMasuk = 0; digitalWrite(led, LOW); delay(5000);
int statusKeluar = 0; lcd.setCursor(9,0); digitalWrite(led, LOW);
int statusReset = 0; lcd.print(Penghitung); delay(1000);
int statusTerakhir = 0; lcd.setCursor(9,1); }
int led = 13; lcd.print(maksimal); }
int maksimal = 20; } statusTerakhir = statusKeluar;
delay(50); }
void setup() {
pinMode(buttonMasuk, INPUT); }
pinMode(buttonKeluar, INPUT); statusTerakhir = statusMasuk;
COUNTER 2
pinMode(buttonReset, INPUT); statusKeluar =
pinMode(led, OUTPUT); digitalRead(buttonKeluar); #include <LiquidCrystal.h>
lcd.begin(16,2); if (statusKeluar != statusTerakhir) { LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
lcd.setCursor(1,0); if (statusKeluar == HIGH) int button;
lcd.print("Selamat Datang"); { int data=8;
lcd.setCursor(2,1); Penghitung-=1; int count=0;
lcd.print("Di Boarduino"); maksimal++; void setup() {
delay(5000); digitalWrite(led, HIGH); lcd.begin(16, 2);
lcd.clear(); delay(100); pinMode(data, INPUT);
}
lcd.setCursor(1,0); digitalWrite(led, LOW);
lcd.print("Total :"); lcd.setCursor(9,0);
void loop() {
lcd.setCursor(9,0); lcd.print(Penghitung);
button = digitalRead(data);
lcd.print("KOSONG"); } lcd.setCursor(0, 0);
lcd.setCursor(1,1); delay(50); lcd.print("By AzeDocumenter");
lcd.print("Sisa : "); if (Penghitung > 0) if (button == HIGH){
lcd.setCursor(9,1); { lcd.setCursor(0, 1);
lcd.print(maksimal); lcd.clear(); lcd.print(count++);
} delay(3); delay(200);
lcd.setCursor(1,0); } else {
void loop() { lcd.print("Total :"); lcd.setCursor(0, 1);
statusReset = lcd.setCursor(1,1); lcd.print(count);
digitalRead(buttonReset); lcd.print("Sisa : "); }
}
if (statusReset == HIGH) { lcd.setCursor(9,0);
IR
Penghitung = 0; lcd.print(Penghitung);
maksimal = 20; lcd.setCursor(9,1); const int pin_2 = 2;
lcd.clear(); lcd.print(maksimal); const int led = 13;
delay(50); }
lcd.setCursor(1,0); void setup () {
lcd.print("Total :"); if (Penghitung <= 0) pinMode (pin_2, INPUT);
lcd.setCursor(1,1); { pinMode (led, OUTPUT);
lcd.print("Sisa : "); Penghitung = 0; Serial.begin(9600);
lcd.setCursor(9,0); maksimal = 20; }
lcd.print("KOSONG"); lcd.setCursor(1,1);
lcd.setCursor(9,1); lcd.print("Sisa : "); void loop() {
int kondisiSensor =
lcd.print(maksimal); lcd.setCursor(9,1);
digitalRead(PIN_2);
digitalWrite(led, HIGH); lcd.print(maksimal);
Serial.println(kondisiSensor);
delay(100); lcd.setCursor(9,0); if (kondisiSensor == HIGH)
digitalWrite(led, LOW); lcd.print("KOSONG"); digitalWrite(led, HIGH);
} } else digitalWrite(led, LOW);
statusMasuk = if (Penghitung >= maksimal) delay (1200);
digitalRead(buttonMasuk); { }
if (statusMasuk != statusTerakhir) { Penghitung = 20;
ESP
#define BLYNK_PRINT Serial

#include <ESP8266_Lib.h>
#include
<BlynkSimpleShieldEsp8266.h>

// You should get Auth Token in


the Blynk App.
// Go to the Project Settings (nut
icon).
char auth[] =
"8133fxxxxxxxxxxxxx305f12b5";

// Your WiFi credentials.


// Set password to "" for open
networks.
char ssid[] = "Example123";
char pass[] = "xxxxxxxx";

// Hardware Serial on Mega,


Leonardo, Micro...
//#define EspSerial Serial1

// or Software Serial on Uno,


Nano...
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX,
TX

// Your ESP8266 baud rate:


#define ESP8266_BAUD 9600

ESP8266 wifi(&EspSerial);

void setup()
{
// Debug console
Serial.begin(9600);

delay(10);

// Set ESP8266 baud rate


EspSerial.begin(ESP8266_BAUD);
delay(10);

Blynk.begin(auth, wifi, ssid, pass);


}

void loop()
{
Blynk.run();
}

You might also like