Skip to content

Instantly share code, notes, and snippets.

@NT7S
Created December 15, 2017 21:11
Show Gist options
  • Save NT7S/5845fa7cce75a3e8c68db91f7823d03b to your computer and use it in GitHub Desktop.
Save NT7S/5845fa7cce75a3e8c68db91f7823d03b to your computer and use it in GitHub Desktop.
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);
}
}
@NT7S
Copy link
Author

NT7S 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