Subject:
|
Re: string functions and Interactive-C
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Sun, 2 May 1999 15:18:22 GMT
|
Original-From:
|
SHETTI.NITIN.MANGESH <shettin@giasbmcSTOPSPAMMERS.vsnl.net.in>
|
Viewed:
|
972 times
|
| |
| |
> I would like to be able to construct various useful strings and send them
> out the serial port (not just to the display). For example, I would like
> to be able to do something like:
>
> sprintf(buffer,"Motor Temperature is %d",mot_temp);
> send_serial_1(buffer);
>
>
> But there is no sprintf function. Can anyone offer a suggestion or some
> existing code for creating and sending strings (that include numeric
> variables) to the serial port?
Dear Matt,
Serial i/o routines available in the FAQ at the MIT site for the
handy board send characters. Write a function which using % and /
operators to convert a number into digits. The function should send each
digit as a character along the serial port.
Whenever you wish to send a string ("Motor Temperature is ") use
the send_serial_1() function you have mentioned. Don't send a newline.
Next you send the number (mot_temp) digit by digit using the function
given in para 1.
I hope this works.
Yours sincerely,
Nitin
|
|
Message is in Reply To:
| | string functions and Interactive-C
|
| I would like to be able to construct various useful strings and send them out the serial port (not just to the display). For example, I would like to be able to do something like: sprintf(buffer,"Motor Temperature is %d",mot_temp); (...) (25 years ago, 2-May-99, to lugnet.robotics.handyboard)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|