I have a very simple program to test a FIFO class, as follows:
but the Serial port won't initialize reliably. With the code as shown below, it only properly initialized 6 our of 8 trials, as shown in the following printout
The two failures are identified by the two instances of two 'Port open' lines back-to-back
What am I doing wrong here?
TIA,
Frank
Code:
/*
Name: FIFO_Class_Test.ino
Created: 12/28/2019 12:51:15 PM
Author: FRANKNEWXPS15\Frank
*/
#include "FIFO_Class.h"
FIFO myFIFO(64);
void setup()
{
Serial.begin(115200);
unsigned long now = millis();
int idx = 0;
while (!Serial && (millis() - now) < 3000)
{
delay(100);
idx++;
}
//delay(3000);
Serial.printf("Serial port available after %lu mSec with idx = %d\n", millis() - now, idx);
}
void loop()
{
}
but the Serial port won't initialize reliably. With the code as shown below, it only properly initialized 6 our of 8 trials, as shown in the following printout
HTML:
Opening port
Port failed to open
Port open
Serial port available after 1400 mSec with idx = 14
Port open
Serial port available after 1200 mSec with idx = 12
Port open
Serial port available after 2100 mSec with idx = 21
Port open
Port open
Serial port available after 700 mSec with idx = 7
Port open
Serial port available after 1600 mSec with idx = 16
Port open
Port open
Serial port available after 1500 mSec with idx = 15
The two failures are identified by the two instances of two 'Port open' lines back-to-back
What am I doing wrong here?
TIA,
Frank