I used availableForWrite() function as below in my code. When I compile it for nano 33 IoT, everything is OK and compiles perfectly. However, when I change the board to nano 33 BLE, I end up with two scenarios: 1. using Arduino IDE as compiler > gives no error but the board doesn't after programming. 2. using the web-based compiler in Arduino website > give the following error:

error: 'class Arduino::USBSerial' has no member named 'availableForWrite'; did you mean 'available'?"

my code:

TimePassed= millis()-NoreplyTime;

         TimePassed= millis()-NoreplyTime;
         if (TimePassed>1000){
         return false;  

even simply having:

while (!Serial.availableForWrite());

generates error ONLY for nano 33 BLE board!


  • "but the board doesn't after programming" What doesn't it? You need to describe further. "web-based compiler in Arduino website" which compiler site with which settings? Maybe the used core in that site does not implement that method
    – chrisl
    Apr 2, 2020 at 20:12
  • Sorry! I needed to clarify further. After programming nano 33 BLE it seems the CPU can't perform that command line and can't establish a serial connection. Surprisingly there is no problem when I program nano 33 IOT with the same code and it runs it perfectly. It sounds to me that the serial library does not include "Serial.availableForWrite()" command for BLE boards.
    – Afshin
    Apr 3, 2020 at 3:37

1 Answer 1


The new Arduino cores use a common API maintained in a separate repository. This was copied from AVR core long time ago and doesn't contain some function added later to other cores. The function Stream.availableForWrite was added to Arduino API repository 5 months ago.

For the Arduino Mbed core they created a branch in the Arduino API repository to move the Arduino core in C++ namespace 'arduino'. But this was before availableForWrite was added. So the API version used in Mbed core doesn't have the function.

I reported it as issue. Even if they add the function to API I doubt they add an implementation of it to Serial.

  • Thanks for the explanation. I am new to programming and have no idea how to help to fix this but in the meantime, I just removed it from my code,and trying to make sure always I have space to receive the data! I have a question, may sound silly, the link you provided for the repository provides installation instructions, should I install it or Arduino IDE did it itself?
    – Afshin
    Apr 3, 2020 at 18:53
  • @Afshin, the Arduino API is part of the boards package you installed for the Nano 33 BLE
    – Juraj
    Apr 3, 2020 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.