-
-
Save GiovanniBalestrieri/61503e9dac21e9e6ee07 to your computer and use it in GitHub Desktop.
Serial Communication between Matlab and Arduino
This file contains hidden or 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 a=0; | |
void setup() | |
{ | |
Serial.begin(9600); | |
} | |
void loop() | |
{ | |
serialRoutine(); | |
} | |
void serialRoutine() | |
{ | |
if(Serial.available()>0) | |
{ | |
char t = Serial.read(); | |
if (t =='T') | |
{ | |
Serial.println("Ok"); | |
} | |
else if (t== 'M') | |
{ | |
a++; | |
Serial.println(a); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment