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.
#define WLAN_SSID "yourNetwork" // cannot be longer than 32 characters! #define WLAN_PASS "yourPassword"
// Security can be WLAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or WLAN_SEC_WPA2 #define WLAN_SECURITY WLAN_SEC_WPA2
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...