Hi,
My laptop is connected to Teensy v.3.5 through the only USB port it has. This is the cable: https://www.pjrc.com/store/cable_usb_micro_b.html
I've written a small application that does an echo: The PC writes a text that the Teensy must read and send back to the PC.
I open the port as follows:
I have noticed that for the Teensy to transfer data to the PC, I have to add the following code:
I don't understand why I have to invoke these two writing functions. How should I transfer data from the Teensy to the PC?
Cheers
My laptop is connected to Teensy v.3.5 through the only USB port it has. This is the cable: https://www.pjrc.com/store/cable_usb_micro_b.html
I've written a small application that does an echo: The PC writes a text that the Teensy must read and send back to the PC.
I open the port as follows:
Code:
Serial.begin(SERIAL_BAUD_RATE);
delay(50);
while (!Serial) { /* NOOP */ }
delay(100);
I have noticed that for the Teensy to transfer data to the PC, I have to add the following code:
Code:
size_t bytes_transferred = Serial.print(buffer);
if(usb_serial_write(buffer, bytes_read) == -1) {
digitalWrite(LED_PIN, HIGH);
delay(1000);
digitalWrite(LED_PIN, LOW);
delay(200);
}
I don't understand why I have to invoke these two writing functions. How should I transfer data from the Teensy to the PC?
Cheers