SendTweet

Unfortunately Twitter changed their API and require SSL connections which the CC3000 does not support. This page is only for reference as the SendTweet example does not work anymore and is not included in the latest library.

SendTweet

This example sketch sends “tweets” (Twitter messages) from an Arduino with CC3000 WiFi. Usually this requires extra proxy software running on another computer, but this sketch operates directly from the Arduino.

This is a barebones example that issues a single fixed message, but it’s easily adapted to send different information such as a periodic sensor reading.

In addition to the WiFi setup explained below, it’s necessary to set up a Twitter developer account and complete an application form before this can be used. That procedure is explained on the Twitter Setup page of the Internet of Things Printer tutorial.

One additional configuration step is required on the Twitter developer site: from your applications “Settings” tab, set access to “Read and Write.” This is necessary so our sketch can send tweets; the printer sketch only reads tweets.
Before you run the sketch, edit it to replace the dummy SSID and password with your own:
#define WLAN_SSID     "yourNetwork"  // cannot be longer than 32 characters!
#define WLAN_PASS     "yourPassword"
Also, make sure that the right wireless security scheme is selected (unsecured, WEP, WPA, or WPA2)
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2
#define WLAN_SECURITY   WLAN_SEC_WPA2
Here's a sample of the Serial Monitor output of SendTweet. You should see something similar:
Hello! Initializing CC3000...Firmware V. : 1.19
OK
Deleting old connection profiles...OK
Connecting to network...Started AP/SSID scan


Connecting to Turlingdrome...Waiting to connect...OK
Requesting address from DHCP server...OK
IP Addr: 192.168.0.4
Netmask: 255.255.255.0
Gateway: 192.168.0.1
DHCPsrv: 192.168.0.1
DNSserv: 192.168.0.1
Locating time server...found
Connecting to time server...
Connect to 155.101.3.115:123
connected!
Issuing request...OK
Awaiting response...success!
Locating Twitter server...OK
Connecting to server...

Connect to 199.59.150.9:80
OK
Issuing HTTP request...OK
Awaiting response...success!
Waiting ~1 hour...
Last updated on 2015-05-04 at 04.24.29 PM Published on 2013-09-16 at 01.57.40 PM