I am working on a project to control motors over a web server. The Wifi101 library has an example called SimpleWebServerWiFi to turn on and off an LED. I tested out the example and it works perfectly fine. I assumed tweaking the code would give me what I am planning to do. So I altered the code and now I'm getting a 'printWiFiStatus' was not declared in scope error. Any advice? I attatched the altered code.
the last } you have closes " if (client) { // if you get a client,"
hitting ctrl-t on a PC or cmd-t on a Mac will indent your code and you will see easily that void printWifiStatus() { is not indented to the very left, so means something is wrong
I am having an issue with controlling my motors over a web server that the WiFi101 Shield has created. The WiFi 101 shield comes with a SimpleWebServerWiFi example which turns on and off an LED light which works perfectly. I though I could alter it a bit and make it do what I want it to do. The code compiles fine but the IP address that the shield is supposed to create does not work at all. The page does not exist and my motors are on when they should be off. Any suggestions? I have attatched my code
An obvious error in the sketch is that you are using pin 10 for the motor PWM and that is already used as the SPI SS (chip select) line for the WiFi module, so there is a conflict of use there.
Change M2PWM to another pin (for example pin 9 or 11 on an UNO) and see if works.
michellem1021:
The motor shield uses pin 10 for M2PWM. I dont know how I would be able to change that
OK, you need to find a way, or accept that you will not be able to get it working!
One way is to put the motor shield on the top of the stack with the offending pin bent outwards so it does not go into the socket below, and hardwire it via a connecting wire to another spare and suitable (PWM capable) pin.