Hello,
I am having problems converting a string to an integer. I am trying to use some RF modules to transmit potentiometer analog readings to another Arduino. The receiver code is where the problem is.
// Include RadioHead Amplitude Shift Keying Library
#include <RH_ASK.h>
// Include dependant SPI Library
#include <SPI.h>
// Create Amplitude Shift Keying Object
RH_ASK rf_driver;
void setup()
{
// Initialize ASK Object
rf_driver.init();
// Setup Serial Monitor
Serial.begin(9600);
}
void loop()
{
// Set buffer to size of expected message
uint8_t buf[4];
uint8_t buflen = sizeof(buf);
// Check if received packet is correct size
if (rf_driver.recv(buf, &buflen))
{
// Convert received data into string
String str_out = String((char*)buf);
// Print values to Serial Monitor
Serial.print(str_out);
// Convert String to Int
int int_out = srt_out.toInt();
}
}
This code runs into problems trying to convert the string to an integer. the following error is returned.
Reciever:47:21: error: 'srt_out' was not declared in this scope
int int_out = srt_out.toInt();
^
exit status 1
'srt_out' was not declared in this scope
What could be causing this?
Thanks!