Sending message to arduino

Hello!!!

Well though it may sound a very trivial question, but I am really confused here... I am relatively still learning to program with C and arduino..

I want to send the following message to the Arduino:

char chr[12] = {'T', '1', '4', '6', '5', '9', '4','8', '7', '9', '0' };

But really can't figure out how, I have tried normally :

Serial.write(chr);

This I guess is not working.. I believe I need to convert the character array to a byte array..

Any support would be deeply appreciated! :) :) I need some hints from all of you!

Cheers

Pramit

sood: This I guess is not working..

How do you know it is not working?

I want to send the following message to the Arduino:

Where from ?

Thank you so much for starting this discussion!

Well it is a part of a larger program.

What I try to do is a modification to the example code given as part of the Time library for Arduino.

To sync the arduino, We need to send character 'T' followed by a 10-digit Unix_timestamp.

So I just wanted to send this particular message to the Arduino without manually typing it in theserial monitor and then pressing 'send'. I wanted to write this message through the program itself.

Please prompt me if you need the code! But generally how do we send such a character array to the arduino?

Thank you!

Pramit

sood: So I just wanted to send this particular message to the Arduino without manually typing it in theserial monitor and then pressing 'send'. I wanted to write this message through the program itself.

Say what? :o

I am sorry to sound this stupid.. But please guide me... :)

It is not clear what you want to do.

generally how do we send such a character array to the arduino?

Send it as a series of chars and as each character is received by the Arduino put it into an array of chars until it is complete. If you need it to be a string on the Arduino then zero terminate it.

This may help Serial input basics - updated

sood: To sync the arduino, We need to send character 'T' followed by a 10-digit Unix_timestamp.

Even if you do figure out how to send this data it will not sync very accurately. Because of the time taken to send the message the actual clock time will be different from when the message was created.

Reminds me of the Goon show program where the stupid one (I know - weren't they all) had the time written on a piece of paper :)

If you tell us what you are trying to do someone may have a better suggestion.

...R

So I just wanted to send this particular message to the Arduino without manually typing it in the serial monitor and then pressing 'send'. I wanted to write this message through the program itself.

What program? How will this program determine the Unix time it wants to set within the time library.

It sounds like you want the Arduino to send the timestamp to itself. Is that correct?

Thank you very much everyone!!!

Well I guess I need to sincerely apologize for not stating things clearly. Therefore I have posted a new topic in same thread: ‘Programming’, describing my problem in detail…

Here’s the link:

Thank you again!

Pramit