The binary way of sending / ASCII
- Binary : machinery reader / ASCII : much easier to read
All the examples shown here sent the sensor values as ASCII-encoded strings. As mentioned above, that means you sent three bytes to send a three-digit value. If that same value was less than 255, you could send it in one raw binary byte. So ASCII is definitely less efficient. However, it’s more readable for debugging purposes, and if the receiving program is well-suited to convert strings to numbers, then ASCII is a good way to go.
const
int
buttonPin **=**
2; // digital input
void
**setup**() {
// configure the serial connection:
Serial.begin(9600);
// configure the digital input:
pinMode(buttonPin, **INPUT**);
}
void
**loop**() {
// read the first analog sensor:
**int**
sensorValue **=**
analogRead(A0);
// print the results:
Serial.print(sensorValue);
Serial.print(",");
// read the second analog sensor: