Feeling interest for a WiFi shield

Oppps. Didn't see your code segment.
[editting]

There's no need to copy the data before printing.
Besides, the message variable is simply a pointer and
have no memory for character data associated when
declared as char *message;

What's wrong with using simply:

Serial.print(&data[44]);

???
&data[44] is a char * that points to the 45th character in data[], 44 char's
after the start of data.

No need for all that code.

Then what if I need to use the message array outside the processData routine? Will that be possible when you only make a pointer to the data array?
Wouldn't the data array be unavailable after the routine is finished?

In C, arguments are passed by value and thus your function has a copy
of the pointer, not a copy of the data. Because of this, the pointer can be
modified at will. So long as you only read what the pointer points to then
the original data is preserved and still available.

I've tried your &data[44] thing (I just started at byte 100 instead), but it doesn't work!

/*
 * A simple sketch that uses WiServer to serve a web page
 */


#include <WiServer.h>

#include <LCD4Bit.h> 
//create object to control an LCD.  
//number of lines in display=2
LCD4Bit lcd = LCD4Bit(2); 

#define WIRELESS_MODE_INFRA      1
#define WIRELESS_MODE_ADHOC      2

// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {192,168,2,124};      // IP address of WiShield
unsigned char gateway_ip[] = {192,168,2,254};      // router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0};      // subnet mask for the local network
const prog_char ssid[] PROGMEM = {"PRJWLAN"};            // max 32 bytes

unsigned char security_type = 2;      // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2

// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"MatheV_home"};      // max 64 characters

// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d,      // Key 0
                          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      // Key 1
                          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,      // Key 2
                          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00      // Key 3
                        };

// setup the wireless mode
// infrastructure - connect to AP
// adhoc - connect to another WiFi device
unsigned char wireless_mode = WIRELESS_MODE_INFRA;

unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters ----------------------------------------

char* message;
boolean dataReady = false;

int currentHour = 1;

//POST request settings
   // IP Address for www.tkjweb.dk  
   uint8 ip[] = {188,40,48,208};
   
   // Create a POST request that sends an email 
   POSTrequest getTable(ip, 80, "www.tkjweb.dk", "/skoleskema.php", tableInput);
   
   // This function generates the body of our POST request
   void tableInput() {
       WiServer.print("wt=false&hour=");
       WiServer.print(currentHour);
   }   
   
   
void processData(char* data, int len) {
     message = &data[100];
     dataReady = true;
}



void setup() {
  // Initialize WiServer and disable the Webpage Serving Feature
  WiServer.init(NULL);
  
  // Enable Serial output and ask WiServer to generate log messages (optional)
  Serial.begin(9600);
  WiServer.enableVerboseMode(true);
  
  //POST request setup
  getTable.setReturnFunc(processData);  
    
  currentHour = 1;
  getTable.submit();
  while (dataReady == false) {
    // Run WiServer
    WiServer.server_task();
  
    delay(10);
  }
  Serial.print("Message: ");
  Serial.println(message);
}

void loop() {
  // Run WiServer
  WiServer.server_task();
  
  delay(10);
}

You're not helping very much to just say "it doesn't work!". Would you
care to tell us HOW it didn't work? I mean, all you've told me is that the
car isn't running. You haven't told me if the tank has gas, the battery is
charged, oil in the engine, the engine starts, etc, etc.

Keep in mind that you copied the address of the 101th character without
verifying that the data was long enough for that pointer to point to
anything. Do you know that the URL arrived to the WiShield in one piece?

Is the rest of the code like example code that came with the WiShield?

interested to know if anyone used this with xbee together...

Hi guys.
Take a look at my WiFi SMS Gateway project, where I use the WiShield and a GM862 connected to the Arduino Duemillanove, with an ATMEGA328.
http://elec.tkjweb.dk/blog/arduino-projects/wifi-sms-gateway/

Best Regards
Thomas Jespersen

good work, Thomas!

do you mind to highlight what's the purpose(application) for
this gateway? I thought use WIFI or GPRS (only one) should be enough?

The purpose is for example is you set this up so this is running all the time, then you can make scripts which just calls the URL adress and then it sends an SMS (from your own number - so if you have free SMS, you can send free SMS's via the internet).

I thought about making a PHP script which calls the URL, so maybe in an ordering-system, people can get a confirmation SMS when their package is shipped.

what did you have to do get the wishield up and running with your arduino? can you give us beginners a little step by step ? pliiiiiise :-/

@BrainBoy

here you could find more info -
http://asynclabs.com/wiki/index.php?title=AsyncLabsWiki

Has anyone tried this code out?

Admittedly I know next to nothing about programming but when I try to plop it in my code I get compile errors about zg_init() etc being out of scope.

To soft reset the WiShield, you can use the following function and call it whenever you want to reset the WiShield and cause it to reconnect to the AP. This piece of code blocks until the WiShield reconnects to the AP.

Code:

void wishield_reset()
{
// setup initial state
zg_init();

// setup the interrupt pin
attachInterrupt(0, zg_isr, LOW);

// loop here until connection established
while(zg_get_conn_state() != 1) {
zg_drv_process();
}
}

My code:

int conn_state; // This variable will be used to hold connection state of WiShield to APz

 // This function generates a tweet with the current temperature and humidity
void currentTemp() {
   WiServer.print("["); 
   WiServer.printTime(millis()); // Append time Arduino has been running - gets around duplicate tweet filtering
   WiServer.print("] ");
   WiServer.print("Humidor temp and humidity is: ");
   WiServer.print(temp_c);
   WiServer.print(" C and ");
   WiServer.print(humidity);
   WiServer.print("%");
 }
 
 void wishield_reset()
{
  // setup initial state
  zg_init();

  // setup the interrupt pin
  attachInterrupt(0, zg_isr, LOW);

  // loop here until connection established
  while(zg_get_conn_state() != 1) {
    zg_drv_process();
  }
}


TWEETrequest sentMyTweet(auth, currentTemp);


//MsTimer2 12 hour timer ISR 
void timerISR() 
{
   intTimer = true;  // When this ISR is run the flag is set for another email to be sent
}

void setup()
{
   Serial.begin(57600);

   WiServer.init(NULL);
   WiServer.enableVerboseMode(false);
   //set up WiServer to allow this app to do socket send/recv outside of
   //WiServer to enable SMTP email send
   WiServer.setSockFunc(socket_app_appcall, 25);

   //set up global state data
   intTimer = true;

   //setup the timerISR to be called every 12 hours
   MsTimer2::set(emailTimer, timerISR); 
   MsTimer2::start();
   
}

void loop()
{ 
  
  
  if (tweet == 0) // Tweets once at inital startup.  Next tweet won't happen for <intervalTweet>
  {
    ++tweet; // Increment initial tweet count
    Serial.println("Tweeting...");
    sentMyTweet.submit();
  }
    
  if (millis() - previousMillis > intervalHum) 
  {
    previousMillis = millis();
    temp_c = sht1x.readTemperatureC();
    humidity = sht1x.readHumidity();
    conn_state=zg_get_conn_state();
    Serial.println(conn_state);
  }

FYI -
Asynclabs has cyber-week discount on going, with free shipping.
Read their front page for more detail.

Some of my customers are readers here, so i just want to introduce our PCB and prototype here. Wish could help u on the development of new products.

We are professional PCB and prototype suppliers with certification of ISO9001, ISo14001, UL, TS16949 and Rohs. Our standard is IPC class 2.

our double-sided PCB can be finished in 4-7 days. Delivery time to Europe, like espan, is about 4 days.

As for quick turn prototype for new product, it can be completed in 48 hours.

We will arrange production based on customers' gerber file.

our company web is www.super-well.com (have multi country language selection)

our cooperation Ebay shop is Vroom | eBay Stores

my msn is amyhu86755@hotmail.com, welcome to receive ur inquiry.

For the past decades, buyers in the US, Europe, South Amercia and Asia have always been using Superwell PCB and PCBA services in their products.

Why they choose us?

Professional Technology High Efficience
One-Stop Service Fair Price

We can offer:
HDI PCB (4 -16 layers)
Multi-layer PCB (10 -40 layers)
Quick Turn Prototype
Multi-type and small-batch PCB
Microwave PCB
Heavy Copper PCB
Customer Special Required PCB
PCBA


Almost a year passed after we introduced the wishield. Now it is
time for something new -

Widuino (BlackWidow) - a combo of arduino atmega328 and wishield

Widuino Mini (YellowJacket) - a small factor of widuino

The price is $75 for BlackWidow and $55 for YellowJacket. Please
do let us know your thoughts.

wishield v2 is coming - it has 16Mbits flash on board! more detail at asynclabs.com.

Hello!

Will international shipping be available?
Im from Portugal and Im interested in WiShield.

Looking forward to see its 2nd version :slight_smile:

All new products are available now.(ship to world-wide)

widuino
wifi arduino mini
wishield 2.0 with 16Mbits flash
flashshield

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1266813017

wishield with external low profile antenna -

asynclabs.com