Hello Everyone, I just needed a lot of help with using arduino and setting up my lcd. The problem im facing mainly is with the lcd I do not know how to wire and how to make it count the rotations of the motor (Basically everytime the motor does a full rotation I want it to display that as 2 hits). I managed to get the motor up and running but the LCD im confused about. Could anyone help me with the wiring and the coding please?
This is the code I have for the motor:
`#define dirPin 2
#define stepPin 3
#define Switch 4
#define stepsPerRevolution 400
void setup()
{
// Declare pins as output:
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
pinMode(Switch, INPUT_PULLUP);
digitalWrite(stepPin, LOW);
}
void loop()
{
if(digitalRead(Switch)==LOW)
{
// Set the spinning direction clockwise:
digitalWrite(dirPin, LOW);
// Spin the stepper motor 1 revolution slowly:
// These four lines result in 1 step:
digitalWrite(stepPin, HIGH);
delayMicroseconds(10);
digitalWrite(stepPin, LOW);
delayMicroseconds(400);
}
else
{
delayMicroseconds(10);
}
delay(5);
}`
What should I add to have it display the number of full rotations as two hits.