Arduino Nano İle Yukarı/Aşağı Sayıcı Yapımı

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Arduino Nano ile buton kullanımı için devremizde iki adet buton kullanacağız. Aynı zamanda butonlar yardımıyla yukarı-aşağı sayıcı yapacağız.

Devrenin Bağlantı Şeması

 

Program Kodları

#include <LiquidCrystal_I2C.h>
#define buton_a 5
#define buton_b 6

LiquidCrystal_I2C lcd(0x27,16,2);

byte sayici = 0;

void setup() {
lcd.init();
lcd.backlight();
pinMode(buton_a,INPUT_PULLUP);
pinMode(buton_b,INPUT_PULLUP);
}

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

void loop() {

if(digitalRead(buton_a) == LOW)
{
while(digitalRead(buton_a) == LOW)delay(1);sayici++;
}
if(digitalRead(buton_b) == LOW)
{
while(digitalRead(buton_b) == LOW)delay(1);sayici–;
}
if(sayici > 100) sayici = 0;

lcd.clear();
lcd.setCursor(0,0);
lcd.print(sayici);
delay(100);
}