ckho:
Then JoeN's suggestion may be better.
Just use Serial.parseInt() to read the value as int from your sensor.
I try to use parseInt, but the program cannot run. And here is my program.
</>
#include <SoftwareSerial.h>
char Reading[5];
int Num;
char R;
SoftwareSerial sensor(9, 8); // RX, TX
void setup()
{
Serial.begin(9600);
Serial.println("initializing");
sensor.begin(9600);
Serial.println("Success");
}
void loop() {
if(sensor.available()){
R = sensor.read(); //Read and store the sensor reading into a char R
Num = Serial.parseInt(R);
Serial.println(Num);
delay(300);
}
}