If you are using the new version 2 IDE then please refer to the page with notes on the new software.
The changes from version 1 are generally small and very positive but please read the notes as there is a potential bug that is best avoided at this early stage in learning C on an Arduino.
Serial.begin(115200);
Serial.println("Hello World");
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Type me a number");
}
void loop() {
// put your main code here, to run repeatedly:
char nChar = 0;
if (Serial.available() > 0) {
nChar = Serial.read();
if(isDigit(nChar)){
Serial.print("Number received: ");
Serial.println(nChar);
Serial.print("In binary: ");
Serial.println(nChar - 48, BIN);
Serial.println("Send me another");
} else {
Serial.println("Did not look like a number");
}
}
}
void loop() {
// put your main code here, to run repeatedly:
char nChar = 0;
if (Serial.available() > 0) {
nChar = Serial.read();
//if(isDigit(nChar)){
Serial.print("Number received: ");
Serial.println(nChar);
Serial.print("In binary: ");
Serial.println(nChar - 48, BIN);
Serial.println("Send me another");
// } else {
// Serial.println("Did not look like a number");
//}
}
}