Professional Documents
Culture Documents
void setup()
{
buttonPin = 11;//whatever pin your button is plugged into
r = 12;
pinMode(buttonPin, INPUT_PULLUP);
pinMode(r, INPUT);
while(digitalRead(r) == LOW)
{
digitalWrite(dirPin,LOW); // Enables the motor to move in a particular direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 400; x++)
digitalWrite(stepPin,HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin,LOW);
delayMicroseconds(2000);
if(digitalRead(r) == HIGH)
break;
}
}
void loop()
{
delay(500);
lcd.setCursor(2,1); // column, row
lcd.print("Bottle 1/6");
digitalWrite(m,HIGH);
delay(1850);
digitalWrite(m,LOW);
delay(1000); // One second delay
tone(buzzer, 1000);
delay(200);
noTone(buzzer);
}
{
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular
direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 100; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin,LOW);
delayMicroseconds(2000);
}
delay(500);
lcd.setCursor(2,1); // column, row
lcd.print("Bottle 2/6");
digitalWrite(m,HIGH);
delay(1850);
digitalWrite(m,LOW);
delay(1000); // One second delay
tone(buzzer, 1000);
delay(200);
noTone(buzzer);
}
{
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular
direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 100; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin,LOW);
delayMicroseconds(2000);
}
delay(500);
lcd.setCursor(2,1); // column, row
lcd.print("Bottle 3/6");
digitalWrite(m,HIGH);
delay(1850);
digitalWrite(m,LOW);
delay(1000); // One second delay
tone(buzzer, 1000);
delay(200);
noTone(buzzer);
}
{
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular
direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 100; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin,LOW);
delayMicroseconds(2000);
}
delay(500);
lcd.setCursor(2,1); // column, row
lcd.print("Bottle 4/6");
digitalWrite(m,HIGH);
delay(1850);
digitalWrite(m,LOW);
delay(1000); // One second delay
tone(buzzer, 1000);
delay(200);
noTone(buzzer);
}
{
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular
direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 100; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin,LOW);
delayMicroseconds(2000);
}
delay(500);
lcd.setCursor(2,1); // column, row
lcd.print("Bottle 5/6");
digitalWrite(m,HIGH);
delay(1850);
digitalWrite(m,LOW);
delay(1000); // One second delay
tone(buzzer, 1000);
delay(200);
noTone(buzzer);
}
{
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular
direction
// Makes 200 pulses for making one full cycle rotation
for(int x = 0; x < 100; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(2000);
digitalWrite(stepPin,LOW);
delayMicroseconds(2000);
}
delay(500);
lcd.setCursor(2,1); // column, row
lcd.print("Bottle 6/6");
digitalWrite(m,HIGH);
delay(1850);
digitalWrite(m,LOW);
delay(1000); // One second delay
}
lcd.clear();
lcd.setCursor(0,0); // column, row
lcd.print("Job Done! Place");
lcd.setCursor(2,1); // column, row
lcd.print("New Bottles");
tone(buzzer, 1500);
delay(300);
noTone(buzzer);
delay(100);
tone(buzzer, 1500);
delay(300);
noTone(buzzer);
delay(100);
tone(buzzer, 1500);
delay(300);
noTone(buzzer);
delay(100);
tone(buzzer, 1500);
delay(300);
noTone(buzzer);
delay(100);
tone(buzzer, 1500);
delay(300);
noTone(buzzer);
delay(100);
}}