I am building a small project where I need to test performance under different conditions, I want to be able to change a integer value in my sketch by inputting the value on the laptop connected via the UART.
I have written this;
char c;
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available())
{
c = Serial.read();
}
Serial.println(c); //for testing
delay(500); //for testing
}
Which seems to work, and holds the numbers 1 - 9 OK as a Char, however I need this number as a integer to integrate into other calculations.
Is there an easy way to either return an integer value instead of Char, or, convert the Char to an int?