// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int buttonPin1 = 2;
const int ledPin1 = 4;
int currentState1 = 0;
const int buttonPin2 = 3;
const int ledPin2 = 5;
int currentState2 = 0;
const int XStepPin=2; // Connect X Step Pin with Ardunio
const int XDirPin=5; // Connect X Direction Pin with Ardunio
void setup() {
pinMode(ledPin1, OUTPUT);
pinMode(buttonPin1, INPUT);
pinMode(ledPin2, OUTPUT);
pinMode(buttonPin2, INPUT);
}
void loop() {
currentState1 = digitalRead(buttonPin1);
currentState2 = digitalRead(buttonPin2);
if (currentState1 == HIGH & currentState2 == LOW) {
digitalWrite(ledPin1, HIGH);
digitalWrite(XDirPin,HIGH);
digitalWrite(XStepPin,HIGH);
}
else if (currentState1 == LOW & currentState2 == HIGH) {
digitalWrite(ledPin2, HIGH);
digitalWrite(XDirPin,LOW);
digitalWrite(XStepPin,HIGH);
}
else if (currentState1 == LOW & currentState2 == LOW) {
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin1, LOW);
digitalWrite(XStepPin,LOW);
}
else if (currentState1 == HIGH & currentState2 == HIGH) {
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin1, LOW);
digitalWrite(XStepPin,LOW);
}
delay(50);
}