Loading...
Pages: [1]   Go Down
Author Topic: Convert from ascii to int  (Read 433 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 1
Posts: 110
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear all, how can I convert from ascii to integer??

Is there any formula?

Tnx
Logged

Atlanta
Offline Offline
Full Member
***
Karma: 4
Posts: 128
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

standard C funtion called atoi

int atoi ( const char * str );
Logged


Maitland, Australia
Offline Offline
Jr. Member
**
Karma: 1
Posts: 88
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This question comes up all the time. Why isn't in the Reference section I wonder?
Logged

There are 3 kinds of people in the world. Those who are good at maths, and those who aren't.

New Hampshire
Offline Offline
God Member
*****
Karma: 13
Posts: 776
There are 10 kinds of people, those who know binary, and those who don't.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

atoi() is a function that is part of the AVR libc library  The Reference homepage provides the following info:

Quote
The Arduino language is based on C/C++. It links against AVR Libc and allows the use of any of its functions; see its user manual for details.

with links to the Libc reference and user manual.

So, in short, it is in the Reference section.
Logged


Ontario
Offline Offline
God Member
*****
Karma: 15
Posts: 717
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Another more flexible option is strtol()
http://avr-libc.nongnu.org/user-manual/group__avr__stdlib.html#gaf8ce3b8dae3d45c34c3b172de503f7b3
Logged

0
Online Online
Tesla Member
***
Karma: 50
Posts: 6531
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Three days ago:

http://arduino.cc/forum/index.php/topic,51209.0.html
Logged

Why I like my 2005 rio yellow Honda S2000 with the top down, and more!
GOOGLE ADVANCED FORUM SEARCH BELOW!  
Go to:  http://www.google.com/advanced_search?hl=en
put in key search words,
use site or domain:  http://arduino.cc/forum
or in a google search box put key words site:http://arduino.cc/forum

Pages: [1]   Go Up
Print
 
Jump to: