YUN Question: Checking if Wifi 0n the AR9331 is fully operat

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
TrackDaySolutions
 
Posts: 36
Joined: Fri Nov 22, 2013 4:46 pm

YUN Question: Checking if Wifi 0n the AR9331 is fully operat

Post by TrackDaySolutions »

I'm working on a project that links a Mega2560 to a YUN via serial communications. The Mega2560 handles all of the sensor related comm & applications work, and the YUN simply provides access to data over HTTP that is sent from the Mega2560 and cached in data structures on the ATmega32U4 side of the YUN. The YUN is set up as the master for serial communications and requests data updates on a period basis from the Mega2560 (The code I am using is similar to the EasyTransfer library, but is optimized for my needs). I believe the AR9331 and the ATmega32U4 boot fully independently of each other, and my issue is that I wish the ATmega32U4 to wait for the AR9331 to fully boot and it's WiFi network (it is running in AP mode) to be fully operational (ready to accept connections). I am hoping that in my setup() routine I can post some kind of call though the bridge to verify that my network is being published. I know the bridge.begin() call doesn't block and It's unclear to me if the server.listenOnLocalHost() or server.begin() calls I have in the setup() routine will block until my network is published either. The only thing I could think of to use the Bridge process function and run a shell command of the pretty-wifi-info.lua script, parse the output until it appears the network is up and running. This seems to be sketchy way to prove my AP is fully up and running. I'm hoping someone can think of a more direct and reliable way of knowing when I should actually engage the code that i have in my loop() routine...

Thanks,
Pete

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: YUN Question: Checking if Wifi 0n the AR9331 is fully op

Post by adafruit_support_mike »

It would probably be easier to approach the problem from the other side. Have the Linux side send a message to the Arduino side at the end of its boot process.

TrackDaySolutions
 
Posts: 36
Joined: Fri Nov 22, 2013 4:46 pm

Re: YUN Question: Checking if Wifi 0n the AR9331 is fully op

Post by TrackDaySolutions »

Good point Mike. My Unix scripting days are long behind me but I'll figure it out. Are you aware of any example code that could use as a basis for such a call from the Linino side ? All I am aware of is the Bridge calls from the MCU...

-Pete

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: YUN Question: Checking if Wifi 0n the AR9331 is fully op

Post by adafruit_support_mike »

Hmm.. looking at the options, you could probably do it just by waiting for a Console connection to become active:

Code: Select all

void setup () {
    Bridge.begin();
    Console.begin();
    
    while ( ! Console ) {
    }
}
The while loop shouldn't end until the Arduino side gets a response from the Linux side, which will have to wait until the Linux side has finished booting.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”