SparkFun Forums 

Where electronics enthusiasts find answers.

Everything pertaining to the service, the phant project which powers it, and user projects which talk to the service.
By morb1lee
I am currently trying to upload data into The weather shield will return the correct information via serial on a demo code. However when I try upload it to (phant posting example), it shows up 998...a serial print also confirms this.
Code: Select all
SparkFun ESP8266 AT library - Phant Posting Example
Jim Lindblom @ SparkFun Electronics
Original Creation Date: July 16, 2015

This example demonstrates how to use the TCP client 
functionality of the SparkFun ESP8266 WiFi library to post 
sensor readings to a Phant stream on

This sketch is set up to post to a publicly available stream
Please don't abuse it! But feel free to post a few times to
verify the sketch works. If it fails, check the HTTP response
to make sure the post rate hasn't been exceeded.

This sketch also requires that the Phant Arduino library be
installed. You can download it from the GitHub repository:

Development environment specifics:
  IDE: Arduino 1.6.5
  Hardware Platform: Arduino Uno
  ESP8266 WiFi Shield Version: 1.0

This code is beerware; if you see me (or any other SparkFun 
employee) at the local, and you've found our code helpful, 
please buy us a round!

Distributed as-is; no warranty is given.
// The SparkFunESP8266WiFi library uses SoftwareSerial
// to communicate with the ESP8266 module. Include that
// library first:
#include <SoftwareSerial.h>
// Include the ESP8266 AT library:
#include <SparkFunESP8266WiFi.h>
// This example also requires the Phant Arduino library.
// Download the library from our GitHub repo:
#include <Phant.h>
#include <Wire.h>
#include "SparkFunHTU21D.h"
HTU21D myHumidity;

// WiFi Network Definitions //
// Replace these two character strings with the name and
// password of your WiFi network.
const char mySSID[] = "xxx";
const char myPSK[] = "xxx";

//IPAddress myIP; // IPAddress to store the local IP

// Phant Constants //
// Phant detsination server:
const char phantServer[] = "";
// Phant public key:
const char publicKey[] = "LQgML4dqD3FGlKdRx5Da";
// Phant private key:
const char privateKey[] = "A1WRxyrv68fl0apRyemN";
// Create a Phant object, which we'll use from here on:
Phant phant(phantServer, publicKey, privateKey);

void setup() 
  int status;
  // To turn the MG2639 shield on, and verify communication
  // always begin a sketch by calling cell.begin().
  status = esp8266.begin();
  if (status <= 0)
    Serial.println(F("Unable to communicate with shield. Looping"));
    while(1) ;
  esp8266.setMode(ESP8266_MODE_STA); // Set WiFi mode to station
  if (esp8266.status() <= 0) // If we're not already connected
    if (esp8266.connect(mySSID, myPSK) < 0)
      Serial.println(F("Error connecting"));
      while (1) ;
  // Get our assigned IP address and print it:
  Serial.print(F("My IP address is: "));
  Serial.println(F("Press any key to post to Phant!"));

void loop()
  // If data has been sent over a TCP link:
  if (.available())
  {  // Print it to the serial monitor:
  // If a character has been received over serial:
  if (Serial.available())
    // !!! Make sure we haven't posted recently
    // Post to Phant!
    // Then clear the serial buffer:
    while (Serial.available());

void postToPhant()
  // Create a client, and initiate a connection
  ESP8266Client client;
  if (client.connect(phantServer, 80) <= 0)
    Serial.println(F("Failed to connect to server."));
  float temp = myHumidity.readTemperature();
  // Set up our Phant post using the Phant library. For
  // each field in the Phant stream we need to call
  // phant.add([field], value).
  // Value can be any data type, in this case we're only
  // using integers.
  // Storing fields in flash (F()) will save a good chunk
  // of RAM, which is very precious.
  Serial.println(F("Posting to Phant!"));
  // Encapsulate a inside a gprs.print(). 
  // takes care of everything in the HTTP header
  // including newlines.

  // available() will return the number of characters
  // currently in the receive buffer.
  while (client.available())
    Serial.write(; // read() gets the FIFO char
  // connected() is a boolean return value - 1 if the 
  // connection is active, 0 if it's closed.
  if (client.connected())
    client.stop(); // stop() closes a TCP connection.

long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]