/**

 * Simple Read

 * 

 * Read data from the serial port and change the color of a rectangle

 * when a switch connected to a Wiring or Arduino board is pressed and released.

 * This example works with the Wiring / Arduino program that follows below.

 */

 

 

import processing.serial.*;

import http.requests.*;

 

Serial myPort;  // Create object from Serial class

String val;      // Data received from the serial port

 

void setup() 

{

  String portName = Serial.list()[0];

  myPort = new Serial(this, portName, 9600);

  println(portName);

}

 

void draw()

{

 if ( myPort.available() > 0) {  // If data is available,

    val = myPort.readString();

    println(val);// read it and store it in val

    println("https://dweet.io/dweet/for/iness0?temp="+val);

    GetRequest get = new GetRequest("https://dweet.io/dweet/for/iness0?temp="+val);

    get.send();

    println("Reponse Content: " + get.getContent());

    println("Reponse Content-Length Header: " + get.getHeader("Content-Length"));

  }

}

 

/*

 

 

// CONNECTIONS:         Nano

// DS3231 SDA --> SDA   A4

// DS3231 SCL --> SCL   A5

// DS3231 VCC --> 3.3v or 5v

// DS3231 GND --> GND

 

#if defined(ESP8266)

#include <pgmspace.h>

#else

#include <avr/pgmspace.h>

#endif

 

 

#include <Wire.h> // must be included here so that Arduino library object file references work

#include <RtcDS3231.h>

RtcDS3231<TwoWire> Rtc(Wire);

 

void setup () 

{

    Serial.begin(9600);

 

}

 

void loop () 

{

    RtcTemperature temp = Rtc.GetTemperature();

    Serial.print(temp.AsFloat());

    delay(1000); // one second

}

 

*/