Pages: [1]   Go Down
Author Topic: Twitter and NTP Time  (Read 834 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello all together

 I have a question for the forum community
 Is it possible to send a Tweet with the current time?
 I guess that i must use udp ntp required at the time of a server on the network.
 Just as it is possible to add this time to the Twitter message using this code below.

 Message should look like so after, for example, on Twitter

 User post: The weather is beautiful at 15:23:34

 Hope Finally somebody has an idea or usable code

 thanks for read and help
from Germany
 smiley-fat
« Last Edit: December 21, 2011, 02:12:29 am by arduinocc » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

is it possible , has anybody an idea ?
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Does this help at all? I don't have a net shield yet, so I can't try it myself.

http://arduino.cc/en/Tutorial/UdpNtpClient
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could go and hit NIST (or whatever other servers you can find) but I suspect you'll find it easier just to plug in a real time clock. Don't forget to address timezone and daylight saving time adjustment issues if you're displaying timestamps within your message.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Fort Lauderdale, FL
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The Time library simplifies the task of tracking the current time.  Additionally, the library comes with an example, called "TimeNTP", that shows how to connect to a NTP server and update the time.  A RTC is helpful but not necessary in this case.

http://www.arduino.cc/playground/Code/Time
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.c

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK thanks that helps me a lot, but the main problem is to add the time to the message. can there anybody help me ?

why can i add there the ntp time ?
Code:
char msg [] = "message to send"; 

or add there ?
Code:
twitter.post( (msg)) ...

can anyone help me, much thanks too all

regards from germany arduino club

Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 631
Posts: 50115
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
char msg [] = "message to send"; 
msg is a fixed size array. There is no room to add more data to the array (the time).

If you create a larger array, fixed size, initialized properly, you could append the time to, and send, the larger array.
Code:
char msgToSend[80];
msgToSned[0] = '\0';
strcat(msgToSend, msg);
strcat(msgToSend, " ");
strcat(msgToSend, timeString);
twit.post(msgToSend);

This presumes that you have a string called timeString that contains the tine, of course.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


this error  for this line from you msgToSend[0] = '\0';
how can i fix it ?


try:35: error: expected constructor, destructor, or type conversion before '=' token
try:36: error: expected constructor, destructor, or type conversion before '(' token
try:37: error: expected constructor, destructor, or type conversion before '(' token
try:38: error: expected constructor, destructor, or type conversion before '(' token
Try.cpp: In function 'void loop()':
try:156: error: 'timString' was not declared in this scope
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 167
Safety first.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You should post all your code.

I'm not sure if you have msgToSend[0] or msgToSned[0], both versions of which have appeared in this thread.
I am also unsure whether you have timString or timeString, reasoning from the error output you posted.
Logged

Fort Lauderdale, FL
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You can't run instructions outside of a function.  The code you added, the strcats, needs to be moved to a function...
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.c

Pages: [1]   Go Up
Jump to: