It's worth noting that the blue WiFi LED remains on even though it can't accept any connections once the socket disconnects.
The sketch is below...
- Code: Select all
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Gavin Williams <[email protected]>
* <http://www.wi-drive.co.uk>
*/
char buffer[8];
Servo steer;
Servo accelerate;
void setup()
{
WiFi.init();
steer.attach(3);
steer.write(90);
accelerate.attach(5);
accelerate.write(90);
}
void loop()
{
WiFi.run();
char acceleration[4] = {buffer[0], buffer[1], buffer[2], '\0'};
char steering[4] = {buffer[3], buffer[4], buffer[5], '\0'};
steer.write(atoi(steering));
accelerate.write(atoi(acceleration));
}