Created
November 28, 2017 22:48
-
-
Save esmarr58/f556a0a66ed50174e152b7fbfdb3c5e8 to your computer and use it in GitHub Desktop.
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
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