I am new to the arduino world, but I have decided for my first project to build a simple drink dispensing machine using an arduino, LCD shield, NEOPIXEL 24 RGB ring, and a few peristaltic pumps. I have managed to come up with a working code to control everything except the NEOPIXEL ring. I have tried borrowing bits of code from the examples in the library, but I have not been able to figure out how to make them work in my project. I was hoping someone here would be able to help me with writing a bit of code.
Can pay a reasonable amount for help.
Here is my code with comments explaining what I am trying to do...
#include <Wire.h>
#include <Adafruit_RGBLCDShield.h>
#include <utility/Adafruit_MCP23017.h>
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
int whiskeyVolume = 0;
int vodkaVolume = 0;
float pump1Run = 0;
float pump2Run = 0;
int pump1Analog = A0;
int pump1Digital = 9;
int pump2Analog = A1;
int pump2Digital = 10;
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print("Drink Machine");
delay(1000);
lcd.setCursor(0,1);
lcd.print("Version 1.0");
delay(4000);
lcd.clear();
lcd.print("Hit Left Button");
lcd.setCursor(0,1);
lcd.print("To Purge Pump");
uint8_t i=0;
}
void loop() {
uint8_t buttons = lcd.readButtons();
pump1Run = (vodkaVolume* 44.4)1200;
pump2Run = (whiskeyVolume 44.4)*1200;
if (buttons) {
lcd.clear();
lcd.setCursor(0,0);
if (buttons & BUTTON_LEFT){
lcd.print("Purging Pump For");
lcd.setCursor(0,1);
lcd.print("10 Seconds...");
analogWrite(pump1Analog,255);
digitalWrite(pump1Digital,HIGH);
delay(10000);
analogWrite(pump1Analog,0);
digitalWrite(pump1Digital,LOW);
analogWrite(pump2Analog,255);
digitalWrite(pump2Digital,HIGH);
delay(10000);
analogWrite(pump2Analog,0);
digitalWrite(pump2Digital,LOW);
lcd.clear();
lcd.print("Purge Finished");
delay(3000);
lcd.clear();
lcd.print("Hit Up Vodka"); // START NEOPIXEL TRACING/CRAWLING LIGHTS, CONTINUE
//UNTIL PUMPING
lcd.setCursor(0,1);
lcd.print("Down For Whiskey");
}
if (buttons & BUTTON_UP) {
vodkaVolume = (vodkaVolume+1);
lcd.print("Vodka");
lcd.setCursor(8,1);
lcd.print(vodkaVolume);
lcd.setCursor(10,1);
lcd.print("Shot");
}
if(buttons & BUTTON_DOWN){
whiskeyVolume = (whiskeyVolume+1);
lcd.print("Whiskey");
lcd.setCursor(8,1);
lcd.print(whiskeyVolume);
lcd.setCursor(10,1);
lcd.print("Shot");
}
if(buttons & BUTTON_RIGHT){
lcd.print("Vodka 0 ");
lcd.setCursor(0,1);
lcd.print("Whiskey 0 ");
whiskeyVolume = (whiskeyVolume=0);
vodkaVolume = (vodkaVolume=0);
}
if(buttons & BUTTON_SELECT){ //START DIFFERENT NEOPIXL SEQUENCE WHILE PUMPING
//(SOMETHING FAST AND BRIGHT)
lcd.print("Dispensing");
lcd.setCursor(0,1);
lcd.print("Beverage...");
analogWrite(pump1Analog,255);
digitalWrite(pump1Digital,HIGH);
delay(pump1Run);
analogWrite(pump1Analog,0);
digitalWrite(pump1Digital,LOW);
analogWrite(pump2Analog,255);
digitalWrite(pump2Digital,HIGH);
delay(pump2Run);
analogWrite(pump2Analog,0);
digitalWrite(pump2Digital,LOW);
lcd.clear();
lcd.print("Enjoy!");
delay(5000);
lcd.clear();
whiskeyVolume = (whiskeyVolume=0);
vodkaVolume = (vodkaVolume=0) ;
lcd.print("Hit Up Vodka"); // RETURN TO NEOPIXEL TRACING/CRAWLING LIGHTS
lcd.setCursor(0,1);
lcd.print("Down For Whiskey");
}
lcd.readButtons();
delay(350);
}
}