Serial communication testing — Arduino Nano simulation

for the UART Communication testing Intergerning Testing

An interactive Arduino Nano circuit simulation you can run free in your browser on Velxio, by mark30805740.

Sketch code

#include <string.h>

void setup() {
  // Start the hardware serial communication at 9600 baud
  Serial.begin(9600);
  while (!Serial);
  Serial.println("Type a massage and Enter");
}
int n = 0;

void loop() {
  // Check if there is incoming data from Board 1
  if (Serial.available() > 0) {
    char c = Serial.peek();

    if (isDigit(c) || c == '.' || c == '-') {
      float m = Serial.parseFloat();
      Serial.print(m, 2);
      Serial.println();
    } else {
      Serial.read();
    }
  }
}

More projects by mark30805740