CLUE Serial seems not to work correctly

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
johnsondavies
 
Posts: 51
Joined: Wed Sep 06, 2017 11:24 am

CLUE Serial seems not to work correctly

Post by johnsondavies »

Printing to the serial port on CLUE holds up the output for some reason. Here's a program to demonstrate:

Code: Select all

void setup() {
  Serial.begin(9600);
  while ( !Serial ) delay(10);
  Serial.println("Goodnight moon!");
  for (int i=0; i<10; i++) {
    Serial.println("Wait...");
  }
  delay(5000);
  Serial.println("Hello sun!");
}

void loop() {}
Running this from the Arduino IDE, and then opening the Serial Monitor, should display "Goodnight moon!" and "Wait..." etc, followed by "Hello sun!" after five seconds.

On the CLUE it displays nothing for five seconds, and then displays all the text. It also gives the incorrect result on the Adafruit ItsyBitsy nRF52840.

On all other boards I've tried, such as Grand Central M4, it works correctly.

It's a problem because it makes my Lisp interpreter, uLisp, unusable on these nRF52840 boards.

I'm using Adafruit nRF52 boards file 0.19.0. on Arduino IDE 1.8.9 on a Mac Powerbook.

User avatar
kevinjwalters
 
Posts: 1025
Joined: Sun Oct 01, 2017 3:15 pm

Re: CLUE Serial seems not to work correctly

Post by kevinjwalters »

If you stick a counter inside the while loop how many times is that running on the nRF52840 boards?

User avatar
johnsondavies
 
Posts: 51
Joined: Wed Sep 06, 2017 11:24 am

Re: CLUE Serial seems not to work correctly

Post by johnsondavies »

Code: Select all

void setup() {
  Serial.begin(9600);
  int n = 0;
  while ( !Serial ) { n++; delay(10); }
  Serial.println(n);
}
prints 664.

User avatar
kevinjwalters
 
Posts: 1025
Joined: Sun Oct 01, 2017 3:15 pm

Re: CLUE Serial seems not to work correctly

Post by kevinjwalters »

So all the output does appear, it just appears in one lump?

For experimentation purposes, you could add a Serial.flush() after each println to see what it does.

User avatar
johnsondavies
 
Posts: 51
Joined: Wed Sep 06, 2017 11:24 am

Re: CLUE Serial seems not to work correctly

Post by johnsondavies »

So all the output does appear, it just appears in one lump?
Yes, after five seconds.

Locked
Please be positive and constructive with your questions and comments.

Return to “CLUE Board”