Hola, el siguiente código pide desde la terminal, varios objetos o datos, un nombre, edad, altura luego recibe el dato cadena, o numero, esto se hace con la función pre-incluida, Serial.available() pero deseo ver el código por medio de interrupción y ISR, algún experto en arduino que por favor lo desee portar o en codigo (c,c++,,mikrobasic, etc) para cualquier PIC u otro microcontrolador
Como pueden ver las instrucciones while (Serial.available() == 0) {}; no permiten hacer nada mas hasta que se llene el registro de datos o buffer de transmisión, de ahi mi deseo de ver el código con la lógica de las IRS
Gracias
String myName; // Declare a String variable to hold your name
int age; // Declare an Int variable to hold your age
float height; // Declare a float variable to hold your height
bool loop_flag = false;
void setup() {
Serial.begin(9600); // turn on Serial Port
}
void loop() {
if (loop_flag == false) {
Serial.println("Please enter your name > "); // Prompt User for input
while (Serial.available() == 0) {} // Wait for user input
myName = Serial.readString(); // Read user input into myName
Serial.println("Hello " + myName); // Print out nicely formatted output.
Serial.println("How old are you? >"); // Prompt User for input
while (Serial.available() == 0);
age = Serial.parseInt(); // Read user input into age
Serial.println("you are " + String(age) + " years old,");
Serial.println("How tall are you? >"); // Prompt User for input
while (Serial.available() == 0);
height = Serial.parseFloat(); // Read user input into height
Serial.println("and you are " + String(height) + " feet tall.");
loop_flag = true;
}
}