Created
April 2, 2018 19:24
-
-
Save araffin/67985826f1e163458b6bb9bac78a32e2 to your computer and use it in GitHub Desktop.
Example of common approach to use Arduino Serial
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
// 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