WiFly - Alpha 2 Library - Hangs...

For the discussion of Arduino related topics.

Moderator: phalanx

Post Reply
nadeaup
Posts: 4
Joined: Tue Jan 25, 2011 6:28 pm

WiFly - Alpha 2 Library - Hangs...

Post by nadeaup » Tue Jan 25, 2011 6:35 pm

I am using the WebServer Sketch and modified it to read the GET off of a Submit. I have run into a couple of problems. 1st if I uncomment all the "Option" lines the WiFly shield hangs and the green LED stays solid until I close the web browser. The 2nd problem is when I leave the lines commented and then select and item and hit Submit the WiFly Shield hangs 99% of the time until I close the web browser and then it restarts.

I'm thinking it may be a bug in the library...

Code is below!

#include "WiFly.h"
#include "Credentials.h"
#include <WString.h>

String inString = String(100);
#define maxLength 25

#define RUM_PIN 3
#define VODKA_PIN 4
#define PEACHTREE_PIN 5
#define KAHLUA_PIN 6
#define BAILEYS_PIN 7
#define CRANBERRY_PIN 8
#define COKE_PIN 9
#define ORANGEJUICE_PIN 10

Server server(80);
void setup() {
WiFly.begin();
if (!WiFly.join(ssid)) {
while (1) {
}
}
Serial.begin(9600);
Serial.print("IP: ");
Serial.println(WiFly.ip());
server.begin();
}

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) {
if (inString.substring(0)=="cowboyroy") {
Serial.println("cowboyroy!");
// then open valves and stuff...
} else if (inString.substring(0)=="sexonthebeach11") {
Serial.println("Sex on the Beach!");
// then open valves and stuff...
}

client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("<title>OctaBar</title>");
client.println();
client.println("<body><h2>OctaBar!</h2><br><hr>");
client.println("Please select your drink<br><br>");
client.println("<form method=get>");
client.println("<select name=drink>");
client.println("<option selected value='default'>Select a Drink!</option>");
client.println("<option value='agilligansisland'>A Gilligan's Island </option>");
client.println("<option value='jamaicansunrise'>Jamaican Sunrise </option>");
client.println("<option value='sexonthebeach11'>Sex on the Beach 11 </option>");
client.println("<option value='backfire'>Backfire </option>");
client.println("<option value='cowboyroy'>Cowboy Roy </option>");
client.println("<option value='mistolin'>Mistolin </option>");
client.println("<option value='mudslide1'>Mudslide 1 </option>");
client.println("<option value='powerscrewdriver'>Power screwdriver </option>");
client.println("<option value='screamingorgasm'>Screaming Orgasm </option>");
client.println("<option value='woowoo'>Woo Woo </option>");
/*
client.println("<option value='bermudatriangle'>Bermuda Triangle </option>");
client.println("<option value='brassmonkey'>Brass Monkey </option>");
client.println("<option value='cranberrynewt'>Cranberry Newt </option>");
client.println("<option value='cranberrytoad'>Cranberry Toad </option>");
client.println("<option value='fuzzypeachclari'>Fuzzy Peachclari </option>");
client.println("<option value='fuzzyscrew'>Fuzzy Screw </option>");
client.println("<option value='georgiapeach'>Georgia Peach </option>");
client.println("<option value='wuwu'>Wu Wu </option>");
client.println("<option value='airhead'>Airhead </option>");
client.println("<option value='aranov'>Aranov </option>");
client.println("<option value='babyguiness'>Baby Guinness </option>");
client.println("<option value='badhabbit'>Bad Habit </option>");
client.println("<option value='butterynipple3'>Buttery Nipple 3</option>");
client.println("<option value='chisterpetterson'>Christer Petterson</option>");
client.println("<option value='concrete'>Concrete </option>");
client.println("<option value='cranberryfrog'>Cranberry Frog </option>");
client.println("<option value='cucaracha2'>Cucaracha 2</option>");
client.println("<option value='dreamsicle1'>Dreamsicle 1</option>");
client.println("<option value='fuzzynavel'>Fuzzy Navel</option>");
client.println("<option value='fuzzyrussian'>Fuzzy Russian</option>");
client.println("<option value='fuzzyberry'>Fuzzyberry</option>");
client.println("<option value='grandmomsslipper'>Grandmom's slipper </option>");
client.println("<option value='hotafternoon'>Hot Afternoon </option>");
client.println("<option value='irishfloat'>Irish Float</option>");
client.println("<option value='machine'>Machine </option>");
client.println("<option value='orangatang'>Orangatang </option>");
client.println("<option value='orgasmaladenmark'>Orgasm a la Denmark </option>");
client.println("<option value='rumcoke'>Rum and Coke </option>");
client.println("<option value='sailorsdelight'>Sailor's Delight </option>");
client.println("<option value='screwdriver'>Screwdriver </option>");
client.println("<option value='silkpanties'>Silk Panties </option>");
client.println("<option value='skydiver'>Skydiver</option>");
client.println("<option value='thevaitkus'>The Vaitkus </option>");
client.println("<option value='tootsie'>Tootsie </option>");
client.println("<option value='tootsieroll2'>Tootsie Roll 2</option>");
client.println("<option value='twinsorgasm'>Twins Orgasm</option>");
*/
client.println("</select>");
client.println("<INPUT type='submit' value='Send'>");
client.println("</form>");

client.println("</body></html>");
break;
}
if (c == '\n') {
current_line_is_blank = true;
}
else if (c != '\r') {
current_line_is_blank = false;
}
}
}
inString = "";
delay(100);
client.stop();
}
}

Thanks for the help!
-Patrick

nadeaup
Posts: 4
Joined: Tue Jan 25, 2011 6:28 pm

Re: WiFly - Alpha 2 Library - Hangs...

Post by nadeaup » Sat Jan 29, 2011 1:07 pm

Ok now i'm thinking it's not my code... I can connect to my network and get an IP --- But if I use the Auto-Connect Sketch it fails... After messing around with it and doing the commands manually one I get to "show c" it returns 8330 so it does not seems to be connecting properly. Any ideas?

follower
Posts: 280
Joined: Sun Mar 14, 2010 11:58 pm

Re: WiFly - Alpha 2 Library - Hangs...

Post by follower » Mon Feb 07, 2011 11:17 pm

nadeaup wrote:1st if I uncomment all the "Option" lines the WiFly shield hangs and the green LED stays solid until I close the web browser.
This is most likely because you're running out of RAM due to all the text. I suggest you look into using PROGMEM to store the text.

Also, rather than repeating the HTML tags for each entry I suggest you store the option values and descriptions in an array and then loop over the array to print all the HTML used. This will reduce duplication. But I would work on getting the sketch to work with a couple of options before using all of them.
The 2nd problem is when I leave the lines commented and then select and item and hit Submit the WiFly Shield hangs 99% of the time until I close the web browser and then it restarts.
I would suggest using the TextFinder library rather than the String library.

As to your connection issue I suggest working through the connection commands manually with the 'SpiUartTerminal' example tool and then paste your results here.

--Philip;

nadeaup
Posts: 4
Joined: Tue Jan 25, 2011 6:28 pm

Re: WiFly - Alpha 2 Library - Hangs...

Post by nadeaup » Fri Feb 11, 2011 4:04 am

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!!!

Code: Select all

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>"
            "<br>Please select your drink<br><br>\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><br><br><br><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();
  } 
} 

nadeaup
Posts: 4
Joined: Tue Jan 25, 2011 6:28 pm

Re: WiFly - Alpha 2 Library - Hangs...

Post by nadeaup » Thu Feb 24, 2011 7:34 pm

Ok my site is up that reviews my current project OctaBar - the automated bartender that makes 47 drinks, speaks and lets you order from it's web server via wifi wit any web browser (tuned for an iphone)! The site also covers my other upcoming projects!

Overview, the build, the problems I hit, future enhancements as well as the code can be found there...

Razorcontrol.com

Hope there is something there that others can use...

Post Reply