Hello guys! I'm really sorry if I got the topic wrong and if this is a noob question. I'm a little new.
I'll start off with my code:
/*
Simple Serial Communication
*/
int val;
int ledPin = 13;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
while(Serial.available()==0);
val = Serial.read()-'0';
Serial.print("The value you entered is: ");
Serial.println(val);
}
If I enter 215, I get back:
The value you entered is: 2
The value you entered is: 1
The value you entered is: 5
I appreciate all the help! I figure this is important for when I attach sensors or want to set manual analog outputs using my computer because if a sensor's resolution is 10bit, or I want to turn a motor 180 degrees, it won't do for me to send 1024 or 180 and it to be received as 1, 0, 2, 4 or 1,8,0.
Thanks a lot!
Moderator edit:
[code] [/code] tags added.