my code is :
int val = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
while (Serial.available())
val = Serial.read() - '0';
Serial.println(val);
}
in serial monitor:
if i? put a 1 i get
1
-38
what should i do?
my code is :
int val = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
while (Serial.available())
val = Serial.read() - '0';
Serial.println(val);
}
in serial monitor:
if i? put a 1 i get
1
-38
what should i do?