For even more fun take a look at WiFi.init() in the user contrib branch; it returns a bool indicating whether or not a connection was made and it (optionally) takes a param that indicates the number of seconds to try connecting.
WiFi.init() from the regular (non user contrib) branch
- Code: Select all
void WiShield::init()
{
zg_init();
#ifdef USE_DIG0_INTR
attachInterrupt(0, zg_isr, LOW);
#endif
#ifdef USE_DIG8_INTR
// set digital pin 8 on Arduino
// as ZG interrupt pin
PCICR |= (1<<PCIE0);
PCMSK0 |= (1<<PCINT0);
#endif
while(zg_get_conn_state() != 1) {
zg_drv_process();
}
stack_init();
}