Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Empyrean/Arduino Zero USB-UART Flow Control
uint8_t led = LED_BUILTIN;
void setup() {
SerialUSB.begin(57600);
pinMode(led, OUTPUT);
}
void loop() {
if(SerialUSB.rts()) {
digitalWrite(led, HIGH);
}
else {
digitalWrite(led, LOW);
}
}
@mweyland

This comment has been minimized.

Copy link

commented Dec 15, 2017

$ cat rts.py
import time
import serial

# ttyUSB0.rts : boot0 F030

ser = serial.Serial('/dev/ttyUSB0')
ser.setRTS(True)
time.sleep(10)

@NT7S

This comment has been minimized.

Copy link
Owner Author

commented Dec 15, 2017

#include <sys/ioctl.h>
#include <fcntl.h>
#include <sys/stat.h>

main()
{
    int fd;
    fd = open("/dev/ttyACM0",O_RDWR | O_NOCTTY );

    int RTS_flag;
    RTS_flag = TIOCM_RTS;
    getchar();
    ioctl(fd,TIOCMBIS,&RTS_flag);//Set RTS pin
    getchar();
    ioctl(fd,TIOCMBIC,&RTS_flag);//Clear RTS pin
    close(fd);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.