Things used in this project

Hardware components:
 0000s 0004 facing left
Pebble Watch
×1
Linkitone 03
MediaTek Labs LinkIt ONE
×1
Software apps and online services:
CloudPebble IDE

Schematics

How-To
No Wiring Required! Simple connect the WiFi antenna to the LinkIt.
LinkIt Schematic.rtf

Code

LinkIt Arduino Sketch (adapted from Wifi demo)C/C++
Upload to a LinkIt to use. Configure the Wifi SSID and password, along with the information you wish to send.
/*
OverHere Web Server
adapted from MediaTek WiFi Web Server demo
*/
#include <LTask.h>
#include <LWiFi.h>
#include <LWiFiServer.h>
#include <LWiFiClient.h>

#define WIFI_AP "THE FARM WiFi"
#define WIFI_PASSWORD "organicfarm"
#define WIFI_AUTH LWIFI_WPA  // choose from LWIFI_OPEN, LWIFI_WPA, or LWIFI_WEP according to your WiFi AP configuration

LWiFiServer server(80);

String information = "STUFF HERE";



void setup()
{
  LWiFi.begin();
  Serial.begin(115200);

  // keep retrying until connected to AP
  Serial.println("Connecting to AP");
  //Serial.println(LWiFi.connect(WIFI_AP,LWiFiLoginInfo(WIFI_AUTH, WIFI_PASSWORD)));
  while (0 == LWiFi.connect(WIFI_AP, LWiFiLoginInfo(WIFI_AUTH, WIFI_PASSWORD)))
  {
   delay(200); //Serial.println("Connecting");
  }
  Serial.println("Got past connecting");
  printWifiStatus();
  Serial.println("Wifi Status has been printed");
  Serial.println("Start Server");
  server.begin();
  Serial.println("Server Started");
}

int loopCount = 0;

void loop()
{
  // put your main code here, to run repeatedly:
  delay(500);
  loopCount++;
  LWiFiClient client = server.available();
  if (client)
  {
    Serial.println("New client has arrived.");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected())
    {
      if (client.available())
      {
        // we basically ignores client request, but wait for HTTP request end
        int c = client.read();
        Serial.print((char)c);

        if (c == '\n' && currentLineIsBlank)
        {
          Serial.println("send response");
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: application/json");
          client.println("Connection: close");  // the connection will be closed after completion of the response
//          client.println("Refresh: 5");  // refresh the page automatically every 5 sec
          client.println();
          client.println(information);
//          client.println("<!DOCTYPE HTML>");
  //        client.println("");
          // output the value of each analog input pin
//          client.print("<b>Hax</b>");
         // client.print(" is ");
         // client.print(loopCount);
         // client.println("<br />");
  //        client.println("</html>");
       //   client.println();
          break;
        }
        if (c == '\n')
        {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r')
        {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(500);

    // close the connection:
    Serial.println("close connection");
    client.stop();
    Serial.println("client disconnected");
  }
}

void printWifiStatus()
{
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(LWiFi.SSID());

  // print your WiFi shield's IP address:
  IPAddress ip = LWiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  Serial.print("subnet mask: ");
  Serial.println(LWiFi.subnetMask());

  Serial.print("gateway IP: ");
  Serial.println(LWiFi.gatewayIP());

  // print the received signal strength:
  long rssi = LWiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}
OverThere Code Watchapp
Fork and pull in CloudPebble IDE. App.JS contains main code.

Credits

Woodworks finallogo
Priansh Shah

Hacker/student from Livingston, NJ

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Life Saver
Intermediate
  • 3,634
  • 72

Work in progress

Detect road accident, raise SOS, share location, share & monitor vital health stats during accident using Pebble. #SaveLife

Life Saver

Team Enigma

Pebble controlled DIY SmartGarage with the Sparkcore
Intermediate
  • 7,293
  • 97

Full instructions

Build it yourself and control your garage door with the Pebble Smartwatch and the Sparkcore

Smartwatch car remote
Intermediate
  • 11,043
  • 72

Full instructions

Controlling a car using a Pebble watch, an Android phone and an Arduino

Particle Sumo Bot
Intermediate
  • 3,336
  • 59

Full instructions

3D Printed Particle.io powered Sumo Bot with Pololu motor controller

RunTracker One
Intermediate
  • 924
  • 17

Work in progress

Go running with only one device - your smartwatch - and still enjoy all your music, GPS tracking, and more!

RunTracker One

Team Wesley Crushers

PebbleCannon
Intermediate
  • 940
  • 17

Vanquish your foes, control a nerf gun with your pebble watch.

Add projectSign up / Login