Created
May 31, 2018 08:57
-
-
Save jueti/24273bb2f51ea0a45a5433506f16b01c to your computer and use it in GitHub Desktop.
Arduino: type convertion, convert a DEC to int
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int incomingByte = 0; // for incoming serial data | |
void setup() { | |
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps | |
} | |
void loop() { | |
// send data only when you receive data: | |
if (Serial.available() > 0) { | |
// read the incoming byte: | |
incomingByte = Serial.read(); | |
// say what you got: | |
Serial.print("I received: "); | |
Serial.println(incomingByte, DEC); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment