Raspberry Pi — configure WiFi from openFrameworks

Dear openFrameworkers,

I thought there was some addon which allows you to configure WiFi from with an openFrameworks application, but I don’t find it anymore.

Does anyone know a way of how to achieve this?

Kindest regards and thank you very much!

maybe you can start from here:

is only a little script to create a file wpa_supplicant.conf and copy in /etc/wpa_supplicant/

For automatic connection boot RPI edit file /etc/network/interfaces
and if you want to go DHCP network interface wlan0 then you can use this:

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
2 Likes

Dear kashim, thank you very much. That already looks good. Lets see how this will work with setting SSID and password via some ofxGui …

I think the most complex part could be getting a list of available SSIDs and choose one from them.

Kindest regards!

a simple solution is to use iwlist tool with ofSystem:

vector<string> getESSID()
{
             vector<string> r;
             string out = ofSystem("/sbin/iwlist wlan0 scan | /bin/grep ESSID");
             vector<string> split = ofSplitString( out,"\n" );
             for( int i = 0; i < split.size(); i++ )
             {
                       string s = split[i];
                       ofStringReplace(s,"ESSID:","");
                       if(s!="")
                       {
                               ofLog()<<s;
                               r.push_back(s);
                       }
            }
            return r;
}

That sounds superb! I’ll try to implement that tomorrow and let you know if I got it to work. : )

Thank you very much!

@kashim That seems to work very great. Thank you very much!

good! :slight_smile: