Project showcase
Tweet from Arduino through your smartphone

Tweet from Arduino through your smartphone © CC0

In this tutorial, you will post a tweet with a push of a button through Arduino.

  • 499 views
  • 0 comments
  • 2 respects

Components and supplies

About this project

In this project, you can easily tweet from Arduino with a push of a button through your smartphone. 


Code

Twitter Shield ExampleArduino
/*

Twitter Shield Example

This example shows an application on 1Sheeld's Twitter shield.

By using this example, you can tweet each time you press
the hardware push button placed on pin 12.

OPTIONAL:
To reduce the library compiled size and limit its memory usage, you
can specify which shields you want to include in your sketch by
defining CUSTOM_SETTINGS and the shields respective INCLUDE_ define. 

*/

#define CUSTOM_SETTINGS
#define INCLUDE_TWITTER_SHIELD

/* Include 1Sheeld library. */
#include <OneSheeld.h>

/* A name for the button on pin 12. */
int buttonPin = 12;
/* A name for the LED on pin 13. */
int ledPin = 13;

void setup() 
{
  /* Start communication. */
  OneSheeld.begin();
  /* Set the button pin as input. */
  pinMode(buttonPin,INPUT);
  /* Set the LED pin as output. */
  pinMode(ledPin,OUTPUT);
}

void loop()
{
  /* Always check the button state. */
  if(digitalRead(buttonPin) == HIGH)
  {
    /* Turn on the LED. */
    digitalWrite(ledPin,HIGH);
    /* Tweet. */
    Twitter.tweet("I'm tweeting from @Arduino via @1Sheeld!");
    /* Wait for 300 ms. */
    OneSheeld.delay(300);
  }
  else
  {
    /* Turn off the LED. */
    digitalWrite(ledPin,LOW);
  }
}
Codebender

Schematics

Twitter tutorial.fzz
Twitter%20tutorial.fzz

Comments

Similar projects you might like

Control your RoboArm with your Smartphone

Project in progress by Team Zone Team

  • 9,199 views
  • 7 comments
  • 27 respects

Capture and Tweet

Project showcase by tesla nerd

  • 965 views
  • 0 comments
  • 8 respects

Controlling LED light intensity using smartphone light senso

Project tutorial by Nikola Travis

  • 1,760 views
  • 0 comments
  • 3 respects

Game of Thrones Shame Button with Arduino and 1Sheeld

Project tutorial by Amr Saleh

  • 3,136 views
  • 0 comments
  • 5 respects

Control Your Light Switch with Your Smartphone

Project tutorial by Alasdair Allan

  • 13,557 views
  • 1 comment
  • 33 respects
Add projectSign up / Login