Skip to content

Instantly share code, notes, and snippets.

@araffin
Created April 2, 2018 19:24
Show Gist options
  • Save araffin/67985826f1e163458b6bb9bac78a32e2 to your computer and use it in GitHub Desktop.
Save araffin/67985826f1e163458b6bb9bac78a32e2 to your computer and use it in GitHub Desktop.
Example of common approach to use Arduino Serial
// If we have received data
if (Serial.available() > 0)
{
// Read the order sent by the computer
order_received = Serial.read();
// If the received byte is the character 'a'
if (order_received == 'a')
// This correspond to the action GO_FORWARD
// It will be used later to send speed order to the motor
action = GO_FORWARD;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment