// // Serial-Test 01.10.2025 // void setup() { Serial.begin(19200); delay(1000); Serial.println("Test serielle Übertragung"); } bool rxStart = 0; bool data = 1; int contBytes = 0; int bufferMax = 0; int serData = 0; int count = 0; int bytes = 0; long timeout = 0; long baud = 0; unsigned long startMicros = 0; unsigned long contMicros = 0; unsigned long totalMicros = 0; unsigned long duration = 0; void loop() { while (Serial.available() || timeout) { if (!rxStart) { startMicros = micros(); } if (Serial.available()) { timeout = 10000; } byte y = Serial.available(); if (y > bufferMax) { bufferMax = y; } if (!y) { data = 0; } // Puffer leer if (data) { // Speichere die kontinuierlich eingetroffene Bytes, bis Puffer zum ersten Mal leer contMicros = micros(); contBytes++; } if (timeout) { timeout--; } rxStart = 1; serData = Serial.read(); if (serData >= 0) { count++; bytes++; } if (bytes == 20) { Serial.print("+"); delay(5); bytes = 0; } } if (rxStart) { totalMicros = micros(); Serial.println(); Serial.print("Buffer: "); Serial.print(bufferMax); Serial.print(" Total Bytes: "); Serial.print(count); Serial.print(" Total Duration(ms): "); duration = totalMicros - startMicros; Serial.print(duration / 1000); Serial.print(" Continued Bytes : "); Serial.print(contBytes); Serial.print(" Duration(µs): "); duration = contMicros - startMicros; Serial.print(duration); //Serial.print( 10000 / (duration / contBytes) ); count = 0; baud = 0; rxStart = 0; data = 1; contBytes = 0; Serial.println(); } }