I am glad to day my First Arduino Project is a success!
My WiFly, Speaking, WebBased Bartender is now up and running! 47 drinks from 8 bottles!
Order your drink from any web browser and Octabar is happy to make it for you!
I’ll update this post with my website link to show how to build it…
Thanks for the PROGMEM TIP!!!
String inString = String(80);
#define maxLength 25
String readString;
int theFactor = 3000;
#define RUM_PIN A0
#define COKE_PIN A1
#define CRANBERRY_PIN A2
#define VODKA_PIN A3
#define PEACHTREE_PIN A4
#define KAHLUA_PIN 5
#define BAILEYS_PIN 6
#define ORANGE_PIN 7
//Pin 2 of the shield should be wired to the TTS256 chip.
#define txPin 2
#define RES 3
#define SPK 4
//#define E0 5
//#define E1 6
//#define E2 7
//#define E3 8
//#define E4 9
//#define E5 10
//#define E6 11
//#define E7 12
#define RDY 13
SoftwareSerial speakjet = SoftwareSerial(0, txPin);
FLASH_STRING(page_header, "HTTP/1.1 200 OK\nContent-Type: text/html\n<title>OctaBar</title>\n");
FLASH_STRING(page_body, "<meta name='viewport' content='width=320, initial-scale=1.0, user-scalable=no'>\n"
"<body><h2>OctaBar!</h2>"
"
Please select your drink
\n"
"<form method=get><select name=drink>\n"
"<option selected value='0'>Select a Drink!</option>\n"
"<option value='1'>A Gilligan's Island</option>\n"
"<option value='2'>Jamaican Sunrise</option>\n"
"<option value='3'>Rum and Coke</option>\n"
"<option value='4'>Sex on the Beach 11</option>"
"<option value='5'>Backfire</option>"
"<option value='6'>Cowboy Roy</option>"
"<option value='7'>Mistolin</option>"
"<option value='8'>Mudslide 1</option>"
"<option value='9'>Power screwdriver</option>"
"<option value='10'>Screaming Orgasm</option>"
"<option value='11'>Woo Woo</option>"
"<option value='12'>Bermuda Triangle</option>"
"<option value='13'>Brass Monkey</option>"
"<option value='14'>Cranberry Newt</option>"
"<option value='15'>Cranberry Toad</option>"
"<option value='16'>Fuzzy Peachclari</option>"
"<option value='17'>Fuzzy Screw</option>"
"<option value='18'>Georgia Peach</option>");
FLASH_STRING(page_body1, "<option value='19'>Wu Wu</option>"
"<option value='21'>Airhead</option>"
"<option value='22'>Aranov</option>"
"<option value='23'>Baby Guinness</option>"
"<option value='24'>Bad Habit</option>"
"<option value='25'>Buttery Nipple 3</option>"
"<option value='26'>Christer Petterson</option>"
"<option value='27'>Concrete</option>"
"<option value='28'>Cranberry Frog</option>"
"<option value='29'>Cucaracha 2</option>"
"<option value='30'>Dreamsicle 1</option>"
"<option value='31'>Fuzzy Navel</option>"
"<option value='32'>Fuzzy Russian</option>"
"<option value='33'>Fuzzyberry</option>"
"<option value='34'>Grandmom's slipper</option>"
"<option value='35'>Hot Afternoon</option>"
"<option value='36'>Irish Float</option>");
FLASH_STRING(page_body2, "<option value='37'>Machine</option>"
"<option value='38'>Orangatang</option>"
"<option value='39'>Orgasm a la Denmark</option>"
"<option value='40'>Sailor's Delight</option>"
"<option value='41'>Screwdriver</option>"
"<option value='42'>Silk Panties</option>"
"<option value='43'>Skydiver</option>"
"<option value='44'>The Vaitkus</option>"
"<option value='45'>Tootsie</option>"
"<option value='46'>Tootsie Roll 2</option>"
"<option value='47'>Twins Orgasm</option>");
FLASH_STRING(page_footer, "</select><INPUT type='submit' value='Send'></form>
<h4>Powered by Arduino!</h4></body></html>");
Server server(80);
void setup() {
for(int i=A0; i<=A5; i++){
pinMode(i, OUTPUT);
digitalWrite(i, LOW);
}
for(int i=5; i<=7; i++){
pinMode(i, OUTPUT);
digitalWrite(i, LOW);
}
pinMode(txPin, OUTPUT);
pinMode(SPK, INPUT);
speakjet.begin(9600);
Serial.begin(9600);
pinMode(RDY, INPUT);
pinMode(RES, OUTPUT);
digitalWrite(RES, LOW);
delay(100);
digitalWrite(RES, HIGH);
delay(1500);
speakjet.println("starting network...");
WiFly.begin();
if (!WiFly.join(ssid)) {
while (1) {
}
}
Serial.begin(9600);
Serial.print("IP: ");
Serial.println(WiFly.ip());
server.begin();
speakjet.println("I am now connected to the Neo network.");
delay(5000);
speakjet.println("Please order a drink with your web browser.");
}
int Str2int (String Str_value)
{
char buffer[3]; //max length is three units
Str_value.toCharArray(buffer, 3);
int int_value = atoi(buffer);
return int_value;
}
void loop()
{
Client client = server.available();
if (client) {
boolean current_line_is_blank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
if (inString.length()<maxLength) inString +=c;
if (c == '\n' && current_line_is_blank) {
readString=inString.substring(inString.indexOf("drink=")+6,inString.indexOf("HTTP"));
readString = readString.trim();
int n = Str2int(readString);
if (n>0 && n<48){
speakjet.println("I am now making your");
delay(2500);
}
switch (n) {
case 1:
speakjet.println("Gil e gans eye land");
digitalWrite(VODKA_PIN, HIGH);
delay(1*theFactor);
digitalWrite(VODKA_PIN, LOW);
digitalWrite(PEACHTREE_PIN, HIGH);
delay(1*theFactor);
digitalWrite(PEACHTREE_PIN, LOW);
digitalWrite(ORANGE_PIN, HIGH);
delay(3*theFactor);
digitalWrite(ORANGE_PIN,LOW);
digitalWrite(CRANBERRY_PIN, HIGH);
delay(3*theFactor);
digitalWrite(CRANBERRY_PIN,LOW);
break;
case 2:
speakjet.println("jamaican sunrise");
digitalWrite(VODKA_PIN, HIGH);
delay(2*theFactor);
digitalWrite(VODKA_PIN, LOW);
digitalWrite(PEACHTREE_PIN, HIGH);
delay(2*theFactor);
digitalWrite(PEACHTREE_PIN, LOW);
digitalWrite(ORANGE_PIN, HIGH);
delay(4.5*theFactor);
digitalWrite(ORANGE_PIN,LOW);
digitalWrite(CRANBERRY_PIN, HIGH);
delay(1*theFactor);
digitalWrite(CRANBERRY_PIN,LOW);
break;
case 3:
speakjet.println("rum and coke");
digitalWrite(RUM_PIN, HIGH);
delay(4*theFactor);
digitalWrite(RUM_PIN, LOW);
digitalWrite(COKE_PIN, HIGH);
delay(8*theFactor);
digitalWrite(COKE_PIN, LOW);
break;
case 4:
speakjet.println("sex on the beach");
digitalWrite(VODKA_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(VODKA_PIN, LOW);
digitalWrite(PEACHTREE_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(PEACHTREE_PIN, LOW);
digitalWrite(ORANGE_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(ORANGE_PIN, LOW);
digitalWrite(CRANBERRY_PIN, HIGH);
delay(.5*theFactor);
digitalWrite(CRANBERRY_PIN, LOW);
break;
case 5:
speakjet.println("backfire");
digitalWrite(KAHLUA_PIN, HIGH);
delay(.5*theFactor);
digitalWrite(KAHLUA_PIN, LOW);
digitalWrite(BAILEYS_PIN, HIGH);
delay(.5*theFactor);
digitalWrite(BAILEYS_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(.5*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 6:
speakjet.println("cow boy roy");
digitalWrite(RUM_PIN, HIGH);
delay(2*theFactor);
digitalWrite(RUM_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(2*theFactor);
digitalWrite(VODKA_PIN,LOW);
digitalWrite(ORANGE_PIN, HIGH);
delay(6*theFactor);
digitalWrite(ORANGE_PIN,LOW);
break;
case 7:
speakjet.println("mistolin");
digitalWrite(KAHLUA_PIN, HIGH);
delay(2*theFactor);
digitalWrite(KAHLUA_PIN, LOW);
digitalWrite(BAILEYS_PIN, HIGH);
delay(2*theFactor);
digitalWrite(BAILEYS_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(2*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 8:
speakjet.println("Mudslide");
digitalWrite(VODKA_PIN, HIGH);
delay(2*theFactor);
digitalWrite(VODKA_PIN, LOW);
digitalWrite(KAHLUA_PIN, HIGH);
delay(2*theFactor);
digitalWrite(KAHLUA_PIN, LOW);
digitalWrite(BAILEYS_PIN, HIGH);
delay(2*theFactor);
digitalWrite(BAILEYS_PIN,LOW);
break;
case 9:
speakjet.println("screwdriver");
digitalWrite(VODKA_PIN, HIGH);
delay(1*theFactor);
digitalWrite(VODKA_PIN, LOW);
digitalWrite(BAILEYS_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(BAILEYS_PIN, LOW);
digitalWrite(KAHLUA_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(KAHLUA_PIN, LOW);
break;
case 10:
speakjet.println("screaming orgasm");
digitalWrite(VODKA_PIN, HIGH);
delay(1*theFactor);
digitalWrite(VODKA_PIN, LOW);
digitalWrite(BAILEYS_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(BAILEYS_PIN, LOW);
digitalWrite(KAHLUA_PIN, HIGH);
delay(.5*theFactor);
digitalWrite(KAHLUA_PIN, LOW);
break;
case 11:
speakjet.println("woo woo");
digitalWrite(PEACHTREE_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(PEACHTREE_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(VODKA_PIN, LOW);
digitalWrite(CRANBERRY_PIN, HIGH);
delay(3.5*theFactor);
digitalWrite(CRANBERRY_PIN,LOW);
break;
case 12:
speakjet.println("Bermuda Triangl");
digitalWrite(RUM_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(RUM_PIN, LOW);
digitalWrite(CRANBERRY_PIN, HIGH);
delay(2*theFactor);
digitalWrite(CRANBERRY_PIN, LOW);
digitalWrite(ORANGE_PIN, HIGH);
delay(2*theFactor);
digitalWrite(ORANGE_PIN,LOW);
break;
case 13:
speakjet.println("brass monkey");
digitalWrite(RUM_PIN, HIGH);
delay(1*theFactor);
digitalWrite(RUM_PIN, LOW);
digitalWrite(ORANGE_PIN, HIGH);
delay(12*theFactor);
digitalWrite(ORANGE_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(1*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 14:
speakjet.println("cranberry newt");
digitalWrite(ORANGE_PIN, HIGH);
delay(2*theFactor);
digitalWrite(ORANGE_PIN, LOW);
digitalWrite(CRANBERRY_PIN, HIGH);
delay(2*theFactor);
digitalWrite(CRANBERRY_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(2*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 15:
speakjet.println("cranberry toad");
digitalWrite(ORANGE_PIN, HIGH);
delay(2*theFactor);
digitalWrite(ORANGE_PIN, LOW);
digitalWrite(CRANBERRY_PIN, HIGH);
delay(3*theFactor);
digitalWrite(CRANBERRY_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(3*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 16:
speakjet.println("Fuzzy Peachclari");
digitalWrite(PEACHTREE_PIN, HIGH);
delay(2*theFactor);
digitalWrite(PEACHTREE_PIN, LOW);
digitalWrite(ORANGE_PIN, HIGH);
delay(3*theFactor);
digitalWrite(ORANGE_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(3*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 17:
speakjet.println("fuzzy screw");
digitalWrite(RUM_PIN, HIGH);
delay(2*theFactor);
digitalWrite(RUM_PIN, LOW);
digitalWrite(COKE_PIN, HIGH);
delay(1*theFactor);
digitalWrite(COKE_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 18:
speakjet.println("Georgia Peach");
digitalWrite(RUM_PIN, HIGH);
delay(2*theFactor);
digitalWrite(RUM_PIN, LOW);
digitalWrite(COKE_PIN, HIGH);
delay(2*theFactor);
digitalWrite(COKE_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 19:
speakjet.println("wu wu");
digitalWrite(VODKA_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(VODKA_PIN, LOW);
digitalWrite(ORANGE_PIN, HIGH);
delay(3*theFactor);
digitalWrite(ORANGE_PIN, LOW);
digitalWrite(CRANBERRY_PIN, HIGH);
delay(3*theFactor);
digitalWrite(CRANBERRY_PIN,LOW);
break;
case 21:
speakjet.println("airhead");
digitalWrite(PEACHTREE_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(PEACHTREE_PIN, LOW);
digitalWrite(CRANBERRY_PIN, HIGH);
delay(6.5*theFactor);
digitalWrite(CRANBERRY_PIN, LOW);
break;
case 22:
speakjet.println("Aranov");
digitalWrite(ORANGE_PIN, HIGH);
delay(2*theFactor);
digitalWrite(ORANGE_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(4*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 23:
speakjet.println("Baby Guinness");
digitalWrite(KAHLUA_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(KAHLUA_PIN, LOW);
digitalWrite(BAILEYS_PIN, HIGH);
delay(.5*theFactor);
digitalWrite(BAILEYS_PIN, LOW);
break;
case 24:
speakjet.println("Bad Habit");
digitalWrite(VODKA_PIN, HIGH);
delay(2*theFactor);
digitalWrite(VODKA_PIN, LOW);
digitalWrite(PEACHTREE_PIN, HIGH);
delay(2*theFactor);
digitalWrite(PEACHTREE_PIN, LOW);
break;
case 25:
speakjet.println("Buttery Nipple");
digitalWrite(PEACHTREE_PIN, HIGH);
delay(2.4*theFactor);
digitalWrite(PEACHTREE_PIN, LOW);
digitalWrite(BAILEYS_PIN, HIGH);
delay(.9*theFactor);
digitalWrite(BAILEYS_PIN, LOW);
break;
case 26:
speakjet.println("Christer Petterson");
digitalWrite(VODKA_PIN, HIGH);
delay(3*theFactor);
digitalWrite(VODKA_PIN, LOW);
digitalWrite(BAILEYS_PIN, HIGH);
delay(3*theFactor);
digitalWrite(BAILEYS_PIN,LOW);
break;
case 27:
speakjet.println("Concrete");
digitalWrite(VODKA_PIN, HIGH);
delay(2*theFactor);
digitalWrite(VODKA_PIN, LOW);
digitalWrite(BAILEYS_PIN, HIGH);
delay(2*theFactor);
digitalWrite(BAILEYS_PIN, LOW);
break;
case 28:
speakjet.println("Cranberry Frog");
digitalWrite(CRANBERRY_PIN, HIGH);
delay(2*theFactor);
digitalWrite(CRANBERRY_PIN, LOW);
digitalWrite(ORANGE_PIN, HIGH);
delay(2*theFactor);
digitalWrite(ORANGE_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(.5*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 29:
speakjet.println("Cucaracha");
digitalWrite(KAHLUA_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(KAHLUA_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(1*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 30:
speakjet.println("Dreamsicle");
digitalWrite(BAILEYS_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(BAILEYS_PIN, LOW);
digitalWrite(ORANGE_PIN, HIGH);
delay(3.5*theFactor);
digitalWrite(ORANGE_PIN, LOW);
break;
case 31:
speakjet.println("Fuzzy Navel");
digitalWrite(PEACHTREE_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(PEACHTREE_PIN, LOW);
digitalWrite(ORANGE_PIN, HIGH);
delay(4.5*theFactor);
digitalWrite(ORANGE_PIN, LOW);
break;
case 32:
speakjet.println("fuzzy russian");
digitalWrite(PEACHTREE_PIN, HIGH);
delay(2*theFactor);
digitalWrite(PEACHTREE_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(2*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 33:
speakjet.println("fuzzy berry");
digitalWrite(PEACHTREE_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(PEACHTREE_PIN, LOW);
digitalWrite(CRANBERRY_PIN, HIGH);
delay(6.5*theFactor);
digitalWrite(CRANBERRY_PIN, LOW);
break;
case 34:
speakjet.println("Grandmom's slipper");
digitalWrite(BAILEYS_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(BAILEYS_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 35:
speakjet.println("hot afternoon");
digitalWrite(PEACHTREE_PIN, HIGH);
delay(2*theFactor);
digitalWrite(PEACHTREE_PIN, LOW);
digitalWrite(KAHLUA_PIN, HIGH);
delay(2*theFactor);
digitalWrite(KAHLUA_PIN, LOW);
break;
case 36:
speakjet.println("irish float");
digitalWrite(BAILEYS_PIN, HIGH);
delay(2*theFactor);
digitalWrite(BAILEYS_PIN, LOW);
digitalWrite(COKE_PIN, HIGH);
delay(6*theFactor);
digitalWrite(COKE_PIN, LOW);
break;
case 37:
speakjet.println("Machine");
digitalWrite(ORANGE_PIN, HIGH);
delay(2*theFactor);
digitalWrite(ORANGE_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(1*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 38:
speakjet.println("o rang a tang");
digitalWrite(ORANGE_PIN, HIGH);
delay(4*theFactor);
digitalWrite(ORANGE_PIN, LOW);
digitalWrite(CRANBERRY_PIN, HIGH);
delay(4*theFactor);
digitalWrite(CRANBERRY_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(.5*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 39:
speakjet.println("orgasm a la denmark");
digitalWrite(BAILEYS_PIN, HIGH);
delay(4*theFactor);
digitalWrite(BAILEYS_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(2*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 40:
speakjet.println("sailors dee light");
digitalWrite(PEACHTREE_PIN, HIGH);
delay(2*theFactor);
digitalWrite(PEACHTREE_PIN, LOW);
digitalWrite(CRANBERRY_PIN, HIGH);
delay(4*theFactor);
digitalWrite(CRANBERRY_PIN, LOW);
break;
case 41:
speakjet.println("screwdriver");
digitalWrite(VODKA_PIN, HIGH);
delay(2*theFactor);
digitalWrite(VODKA_PIN, LOW);
digitalWrite(ORANGE_PIN, HIGH);
delay(4*theFactor);
digitalWrite(ORANGE_PIN, LOW);
break;
case 42:
speakjet.println("silk panties");
digitalWrite(PEACHTREE_PIN, HIGH);
delay(1*theFactor);
digitalWrite(PEACHTREE_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(3*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 43:
speakjet.println("skydiver");
digitalWrite(ORANGE_PIN, HIGH);
delay(5.5*theFactor);
digitalWrite(ORANGE_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 44:
speakjet.println("the vaitkus");
digitalWrite(PEACHTREE_PIN, HIGH);
delay(1.5*theFactor);
digitalWrite(PEACHTREE_PIN, LOW);
digitalWrite(VODKA_PIN, HIGH);
delay(1*theFactor);
digitalWrite(VODKA_PIN,LOW);
break;
case 45:
speakjet.println("tootsie");
digitalWrite(KAHLUA_PIN, HIGH);
delay(2.5*theFactor);
digitalWrite(KAHLUA_PIN, LOW);
digitalWrite(ORANGE_PIN, HIGH);
delay(5.5*theFactor);
digitalWrite(ORANGE_PIN,LOW);
break;
case 46:
speakjet.println("tottsie roll");
digitalWrite(KAHLUA_PIN, HIGH);
delay(2*theFactor);
digitalWrite(KAHLUA_PIN, LOW);
digitalWrite(ORANGE_PIN, HIGH);
delay(3*theFactor);
digitalWrite(ORANGE_PIN, LOW);
break;
case 47:
speakjet.println("twin orgasm");
digitalWrite(PEACHTREE_PIN, HIGH);
delay(2*theFactor);
digitalWrite(PEACHTREE_PIN, LOW);
digitalWrite(BAILEYS_PIN, HIGH);
delay(1*theFactor);
digitalWrite(BAILEYS_PIN, LOW);
break;
}
if (n>0 && n<48) speakjet.println("Your drink is now ready");
client.println(page_header);
client.println(page_body);
client.println(page_body1);
client.println(page_body2);
client.println(page_footer);
break;
}
if (c == '\n') {
current_line_is_blank = true;
}
else if (c != '\r') {
current_line_is_blank = false;
}
}
}
inString = "";
delay(100);
client.stop();
}
}