Created
December 15, 2017 21:11
-
-
Save NT7S/5845fa7cce75a3e8c68db91f7823d03b to your computer and use it in GitHub Desktop.
Empyrean/Arduino Zero USB-UART Flow Control
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
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