I have been trying use the Seeedstudio wifi shield v1.1 with Arduino Mega 2560 as part of my project but I could not make the WiFly library provided on the wiki work with the Mega. I tried to run the example sketch wifly_test but it did not work I tried some troubleshooting and found that the write commands to the shield were not successful. After a few hours of searching on the internet, I found out the problem and was able to solve it. I am posting my solution below. Anyone is welcome to add to my solution.

  • Sooo, there's no question then? If you can find the answer on the internet and already did, I fail to see why you would post this on here.
    – I. Wolfe
    Commented Mar 17, 2015 at 16:37
  • I figured the problem as a result of my search and not the solution. Please refer to my solution below
    – Waqas
    Commented Mar 17, 2015 at 17:40

1 Answer 1


The WiFly library provided at the Seeedstudio wiki uses the software serial to communicate with the WiFi shield. All the example files provided by the WiFly library use pins 2 and 3 as the Rx and Tx of the software serial. Moreover, the Wifi shield only allows pins 0-7 to be chosen as Rx and Tx by using different jumper combinations. The SoftwareSerial library, on the other hand, has the following limitation for the Arduino Mega

Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).

Thus, as a workaround, I jumped pin 2 of the shiled with pin 10 (Rx of Software Serial) and pin 3 with pin 11 (Tx of Software Serial) using connecting wires and used the jumper setting given on the wiki. Finally I made the following changes in the example code

// Pins' connection
// Arduino       WiFly
//  10    <---->    TX (via connecting pin 2 to 10 on wifi shield)
//  11    <---->    RX (via connecting pin 3 to 11 on wifi shield)
SoftwareSerial uart(10, 11); //change software serial pins for Mega

This allowed the Mega to communicate with the Wifi shield successfully using the WiFly library.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.