bool radioControlInit() { bool result = true; if (WiFi.status() == WL_NO_SHIELD) { printf( "WiFi shield not present\n"); result = false; } String fv = WiFi.firmwareVersion(); if (fv != "1.1.0") { printf( "Please upgrade the firmware\n"); } while (status != WL_CONNECTED) { printf( "Attempting to start AP with SSID: %s\n",ssid); status = WiFi.apbegin(ssid, channel); delay(10000); } printf( "AP mode already started\n"); printWifiData(); printCurrentNet(); printf( "Establish WiFi Server\n"); Udp.begin(localPort); memset(receiverBuffer, '\0', sizeof(receiverBuffer)); memset(transceiverBuffer, '\0', sizeof(transceiverBuffer)); radio_last_tv=millis(); return result; }
void loop() { // check the network connection once every 10 seconds: delay(10000); printCurrentNet(); // Trying to connect to http://hasthelargehadroncolliderdestroyedtheworldyet.com/ Serial5.println("Trying to connect to : www.hasthelargehadroncolliderdestroyedtheworldyet.com :"); httpRequest(); while( client.available() ) { Serial5.print((char)(client.read())); } Serial5.println("END"); }
void setup() { WiFi = WiFiClass(); client = WiFiClient(); delay(500); // Waiting for initialization // SPI.begin(); //Initialize Serial5 and wait for port to open: Serial5.begin(9600); while (!Serial5) { ; // wait for Serial5 port to connect. Needed for Leonardo only } // check for the presence of the shield: if (WiFi.status() == WL_NO_SHIELD) { Serial5.println("WiFi shield not present"); // don't continue: while(true); } // attempt to connect to Wifi network: while ( status != WL_CONNECTED) { Serial5.print("Attempting to connect to WPA SSID: "); Serial5.println(ssid); // Connect to WPA/WPA2 network: status = WiFi.begin(ssid, pass); // wait 10 seconds for connection: delay(10000); } // you're connected now, so print out the data: Serial5.print("You're connected to the network"); printCurrentNet(); printWifiData(); }