Looking to see if anyone had any success sending a data result message to Twitter directly from a CR1000 connected to a network and then to the Internet. If a little Ardueno board can do it, should be able to do it with a CR1000.
I'm sure the CR1000 can do it also.
You will need to form a HTTP request using the information provided by the Twitter Developer's site
https://dev.twitter.com/
try starting here
https://dev.twitter.com/docs/intro-twitterapi
then you might try taking a looking at this post
http://www.campbellsci.com/forum/messages.cfm?threadid=1AECB84D-A609-DBB8-6AB1D57E9B8223B1
Recla,
It's not Twitter, but it is Twitter like. Sonoautomated pointed me to Pachube. I thought you would be interested in some code I wrote to post data from my datalogger.
Const CRLF = CHR(13) & CHR(10)
Const FeedID = "1111"
Const ApiKey = "abcdefghijklmnopqrstuvwxyz"
Const LogInt = 300 'seconds
Const PostInt = 300 'seconds
Const NumDatStream = 4
Dim ID(NumDatStream) As String * 31 = {"Battery", "PanelTemp", "TC", "4"}
Public PachubeDat(NumDatStream)
Public PTemp, batt_volt, TC
Public IPSocket As Long
Dim HPST As String * 150
Dim Dat As String * 254
Dim DatLen, DatVar
DataTable (Pachube,True,1000)
DataInterval (0,LogInt,Sec,10)
Sample (NumDatStream,PachubeDat(),FP2)
EndTable
Sub PachubeJSON(Dest As String * 254, Field, Recs)
Dim I
Dim RecTime As String * 31
Dim FieldVal
Dest = ""
If Recs >= 1 Then
For I = Recs To 1 Step - 1
RecTime = Pachube.Timestamp(4,I)
If Left(RecTime,1) = "-" Then Exit For
MoveBytes (RecTime,10,"T",0,1)
MoveBytes (RecTime,19,"Z",0,1)
MoveBytes (RecTime,29,"",0,1)
FieldVal = Pachube.PachubeDat(Field,I) 'get field value
If Dest <> "" Then (Dest = Dest & ",")
Dest = Dest & "{""at"":""" & RecTime & """,""value"":""" & FieldVal & """}"
Next I
Dest = "{""datapoints"":[" & Dest & "]}"
EndIf
EndSub
BeginProg
Scan (10,Sec,0,0)
Battery (batt_volt)
PanelTemp (PTemp,250)
TCDiff (TC,1,mV2_5C,1,TypeT,PTemp,True ,0,250,1.0,0)
PachubeDat(1) = batt_volt
PachubeDat(2) = PTemp
PachubeDat(3) = TC
PachubeDat(4) = RND
CallTable (Pachube)
NextScan
SlowSequence
Scan (PostInt,Sec,3,0)
IPSocket = TCPOpen("api.pachube.com",80,1024)
If IPSocket<>0 Then
For DatVar = 1 To NumDatStream
PachubeJSON(Dat, DatVar, PostInt/LogInt)
DatLen = Len (Dat)
HPST = "POST /v2/feeds/" & FeedID & "/datastreams/" & ID(DatVar) & "/datapoints HTTP/1.1" & CRLF
SerialOut(IPSocket,HPST,"",0,0)
HPST = "User-Agent: Campbell Scientific Datalogger" & CRLF
SerialOut(IPSocket,HPST,"",0,0)
HPST = "Host: api.pachube.com" & CRLF
SerialOut(IPSocket,HPST,"",0,0)
HPST = "Accept: */*" + CRLF
SerialOut(IPSocket,HPST,"",0,0)
HPST = "X-PachubeApiKey: " & ApiKey & CRLF
SerialOut(IPSocket,HPST,"",0,0)
HPST = "Content-Length: " & DatLen & "" & CRLF
SerialOut(IPSocket,HPST,"",0,0)
HPST = "Content-Type: application/x-www-form-urlencoded" + CRLF
SerialOut(IPSocket,HPST,"",0,0)
HPST = CRLF
SerialOut(IPSocket,HPST,"",0,0)
SerialOut(IPSocket,Dat,"",0,0)
Delay (1,1,Sec)
Next DatVar
EndIf
NextScan
EndSequence
EndProg
https://pachube.com/feeds/34773
http://api.pachube.com/v2/#create-datapoint-post-v2-feeds-feed-id-datastreams-datastream-id-datapoints
* Last updated by: Sam on 8/27/2011 @ 12:42 AM *