LED blink speed with numbers between 1-255

Hy!

I have made a Code for LED blink speed manipulating with Potentiometer. The blinking started only if I send "start" command and will end if I send "stop". And now i would like this controlling with numbers 1-255 achieve. How can i send any numbers via Serial(not only 0-9)?

int led=13; int potpin=5; byte ch; String stringone,stringtwo,stringin; int speedszam;

void setup() { Serial.begin(9600); pinMode(led,OUTPUT); stringone= String("start"); stringtwo= String("stop"); speedszam= analogRead(potpin); }

void loop() { ch=0; stringin='\0'; while (Serial.available()) { ch=Serial.read(); stringin+=(char)ch; delay(1); } if (stringin==stringone) { while(stringin != stringtwo) { speedszam= analogRead(potpin); digitalWrite(led,HIGH); delay(speedszam); digitalWrite(led,LOW); delay(speedszam); ch=0; stringin='\0'; while (Serial.available()) { ch=Serial.read(); stringin+=(char)ch; delay(1); } } } }

And now i would like this controlling with numbers 1-255 achieve. How can i send any numbers via Serial(not only 0-9)?

The same way you type them in the serial monitor - one digit at a time. Of course, you'll need some kind of end of packet marker to tell you when you can stop reading. This particular topic only comes up about 8 or 10 times a day.

Things will be much easier if you use a single character for stop and start - for example 's' and 'e' (for end). Don't waste resources sending irrelevant data.

...R

Don't waste resources sending irrelevant data.

And don't waste resources on Strings, either.