need help sending unsigned long to arduino via serial

Hi Guys,

i am trying to output a unsigned long to Arduino Leonardo via the serial to control an AD8950 module i just got today. i searched on internet but didn't find something that could work for me.
"i have found the code for the ad8950 to output the frequency"

please can someone help me point in the right direction.

Thanks Timi

Hi,

i need to input from pc to arduino the frequency and it is a number with 6 digit and the string.toint() does not cover it. Please can someone help me out.

Thanks Timi,

Hi Timi

You want to read the 6 digit integer into a variable of type long, I assume?

Take a look at the code attached to this thread:

It includes a function called readOneFloat(). You could try modifying this to read long instead.

Where it has ...

inputFloat = atof(inputSeveral);

... use the atol() instead of atof() and change inputFloat to be a variable of type long.

Regards

Ray

Hi Ray that is excatly what i needed. Will try it asap i got time today. Someone should get this examples and make a free doc about these stuff for newbies like me :stuck_out_tongue:

Thanks a lot Timi,

I think you want to use strtoul instead. Another solution is to use sscanf, it's much more powerful but requires much more memory.

Hi guys,

Thanks for your help. It worked via the links from Ray. I didn't try the stroul or scanf but will try later as soon as i made the circuit stable and start to see how i can make it better given my limited abilities :stuck_out_tongue: :P.

Thanks again,

Timi