Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
Joshua Young
Created July 18, 2016

Twitter Bot

A interactive robot that responds to users twitter account when they tweet the access code.

49
Twitter Bot

Things used in this project

Hardware components

Kinetis Freedom Board with FlexIO
NXP Kinetis Freedom Board with FlexIO
×1
ESP8266 ESP-01
Espressif ESP8266 ESP-01
×1
Jumper wires (generic)
Jumper wires (generic)
×1
NEMA 17 Stepper Motor
OpenBuilds NEMA 17 Stepper Motor
×1
Servos (Tower Pro MG996R)
×1
Oak Plywood 0.203"
×1

Software apps and online services

ThingSpeak API
ThingSpeak API
Twitter
Twitter

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)

Story

Read more

Code

Thingspeak code

C/C++
#include "mbed.h"
#include "ESP8266Interface.h"
#include "TCPSocketConnection.h"
#include "ifttt.h"

//added from ESP8266_HTTP_HelloWorld
#include "HTTPClient.h"
#include "Websocket.h"

//added dnsresolve to try andd resolve url
//#include "dnsresolve.h"

//Setup for water sensor  
AnalogIn   ain(A0);             //Readd water sensor
DigitalOut dout(LED1);          //Set LED to track sensor
int flagVar = 0;                //varible to track on off sensor flag

int varOne = 0;                 // flag to track information sent so far.

ESP8266Interface wifi(D1,D0,D2,"your SSID","your password",115200); // TX,RX,Reset,SSID,Password,Baud
RawSerial pc(USBTX, USBRX); // tx, rx


//***********************************8    added from HTTP program  (2 variables below)
HTTPClient http;
char str[512];


 Servo myservo(local p15);

int main()
{
    pc.baud(9600);
    wifi.init(); //Reset
    wifi.connect(); //Use DHCP
    printf("IP Address is %s \n\r", wifi.getIPAddress());
    TCPSocketConnection socket;
    //p3BOd9RqoIvPxpKWx7uyD68x8suCOP_s3pPzF5icyki
    // Initialize ifttt object, add up to 3 optional values, trigger event. 
    



  
   
 /*  char theUrl = DNSResolver("http://.thingspeak.com"); 
   pc.printf("URL is = c%   
   HTTP return code  %d  = data from function ", theUrl,DNSResolver()); 
 */      
 
   //GET  Read to see if request was made.

    pc.printf("\n Reading feild 1 Thingspeak...\n\r");
    int fieldOne = http.get("http://"your thing speak"/fields/2/last?key=your key", str, 512);//IP address is httpbin.org/get
    int loopBreak = atoi (str); 
     pc.printf("Field Speak READ: %s\n\r", str);
       for(float p=0; p<1.0; p += 0.1) {
        myservo = p;
        wait(0.8);
    
}

Credits

Joshua Young

Joshua Young

2 projects • 0 followers

Comments