Serial debugging - Threading

When using threads, it's highly recommended that you use instead of Serial.print statements. The Log class is thread-safe, but Serial is not. In order to use Serial safely you need to surround all serial calls with a lock.

You also should not mix both Log and Serial debugging logs.

See USB serial debugging and Logging in the Device OS API reference for more information.