Adapt WiFi Module ESP8266 code for use with Tiny WiFi Shield

GrandPoohbah

  • Jr. Member
  • **
    • Posts: 7
    • View Profile
I want to try out Pushsafer www.pushsafer.com using my Tiny WiFi Shield, but their SendEvent example uses the ESP8266WiFi.h library.

Has anyone adapted a sketch that uses the ESP8266WiFi.h library to use the WiFi101.h library instead?


GrandPoohbah

  • Jr. Member
  • **
    • Posts: 7
    • View Profile
I got working and here's how:

I discovered that ESP8266 library is based on WiFi101, the library used for the Tiny WiFi Shield. The two libraries should blend together nicely. It's a matter of either adding WiFiClient, Pushsafer, and ArduinoJson to your Tiny Circuit sketch or adding Wire and WiFi101 to the Pushsafer sendEvent example sketch.

Before you start editing the sketch, go to the pushsafer.com web site and do the following:
Create a free account and get a Pushsafer key.
Download the client app to your device (I used the iOS client app).
Start up the client app and register your device.
These steps will allow you to receive notifications from the Tiny Circuits sketch.

Starting with the Pushsafer sendEvent.ino example sketch, make the following modifications:
Install the ArduinoJson library in your IDE library (used by Pushsafer)
Add <Wire.h> and <WiFi101.h>  // For Tiny Circuits WiFi Shield
Change all references to "Serial" to "SerialUSB". Do this in the example and the Pushsafer.cpp files.
Add your ssid, password, and Pushsafer key to the sketch.
Add Wire.begin(); // For Tiny Circuits WiFi Shield
Add WiFi.setPins(8, 2, A3, -1) // For Tiny Circuits WiFi Shield
Compile and run the example.
Your notification will appear in your client app almost immediately.

Have fun. This is a nice way to receive notifications from your Arduino no matter where you are.


 

SMF spam blocked by CleanTalk