Arduino Forum

Using Arduino => Interfacing w/ Software on the Computer => Topic started by: delinquentme on Feb 20, 2011, 11:28 pm

Title: I DO NOT want ghetto data conversions because of telnet
Post by: delinquentme on Feb 20, 2011, 11:28 pm
Ha. i think the title sums it up.

What I'm after:
RoR App <=> MAGIC DATA TRANSFER*  <=> Arduino Ethernet shield

*magic data transfer has been achieved using telnet
... BUT with this AWFUL ascii converted data

Example:
I telnet in, and send it:
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
# stepper rotates



ABSOLUTELY NOT what im after...

i want to send it:
"100"
# stepper steps 100 steps
"-100"
# stepper steps reverse 100 steps

1. CAN this be done with telnet?
2. MUST i resort to this fugly data conversion

if ( #2 == 'true'){
    Forget telnet ... what can i use to send real STRICT .. unconverted data types?
}


I simply cannot imagine that there is __NO__ way to send my data as an INTEGER .. and not have to do this wonky conversion / reconversion bc im using TELNET as a transfer method

... telnet is the simplest solution .. which id like to use .. but id REALLY REALLY like to send it actual integers
Title: Re: I DO NOT want ghetto data conversions because of telnet
Post by: PaulS on Feb 21, 2011, 01:44 am
Telnet sends ascii data. You need to collect the characters in an char array, keeping it NULL terminated, and convert the ascii representation of the number ("100") to an integer. It happens that there is a function, atoi() to do exactly that.
Title: Re: I DO NOT want ghetto data conversions because of telnet
Post by: delinquentme on Feb 21, 2011, 01:54 am
ok so after some research TELNET is exactly NOT the way to do this

so im gonna make a new post with what im actually going to do