String to integer via rfmb12

Hi all,

I'm working on an smart meter solution with an emontxv2 board. I have the interfacing with the meter all running, but now I need to send data to emoncms over rfm12.

The sketch read the data from the meter in a string (6 of them), and they look like 000456.321. Can anyone advise how to prepare those strings into something (int?), that is sendable via the rfm12 board?

ukmoose's picture

Re: String to integer via rfmb12

Take a look at Building Blocks > RFM12B - Part 2 - Sending data by radio between emonTx, emonBase and emonGLCD

Robert Wall's picture

Re: String to integer via rfmb12

You most likely cannot use the standard library scanf( ) because you'll run out of memory,  How does the data get from the emonTx to emoncms, i.e. what base node do you have? The protocol allows you 66 bytes. Provided all 6 strings are fixed in length and not more than 11 characters, you could pack them into a 66 byte block, and convert to integers where you have more processing power  (RPi?).

SO offers this solution: and I got that by searching for "arduino string to integer atoi"

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.