Skip to content

Instantly share code, notes, and snippets.

@esmarr58
Created November 28, 2017 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esmarr58/f556a0a66ed50174e152b7fbfdb3c5e8 to your computer and use it in GitHub Desktop.
Save esmarr58/f556a0a66ed50174e152b7fbfdb3c5e8 to your computer and use it in GitHub Desktop.
String vectorCaracteres;
boolean TransmisionCompleta = false;
void setup() {
Serial.begin(9600);
}
void loop() {
//Ciclo infinito
if (TransmisionCompleta) {
//vectorCaracteres //Los datos ingresados se encuentran en esta variable
vectorCaracteres = ""; //Limpiar el String
TransmisionCompleta = false; //Limpiar la bandera
}
}
void serialEvent() {
while (Serial.available()) {
char CharEntrada = Serial.read(); //Leer un byte del puerto serial
vectorCaracteres += CharEntrada; //Agregar el char anterior al string
if (CharEntrada == '\n') { //Si se detecta un fin de linea
TransmisionCompleta = true; //Se indica al programa que el usuario termino de ingresar la informacion
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment