Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| workshop:arduino [2009-06-23 22:38] – equinox | workshop:arduino [2025-11-09 09:25] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 53: | Line 53: | ||
| #include < | #include < | ||
| #include < | #include < | ||
| + | #include < | ||
| #define STATE_OFF 0 | #define STATE_OFF 0 | ||
| Line 68: | Line 69: | ||
| main(int argc, char* argv[]) | main(int argc, char* argv[]) | ||
| { | { | ||
| - | int fd; | ||
| - | const struct timespec sleeptime = {0, 100000000}; // 100ms | ||
| char* device = argc < 2 ? "/ | char* device = argc < 2 ? "/ | ||
| - | + | int fd = open(device, | |
| - | | + | |
| if (fd == 0) { | if (fd == 0) { | ||
| fprintf(stderr, | fprintf(stderr, | ||
| Line 79: | Line 77: | ||
| | | ||
| setDTRState(fd, | setDTRState(fd, | ||
| - | | + | |
| + | select(0, NULL, NULL, NULL, & | ||
| setDTRState(fd, | setDTRState(fd, | ||
| - | | + | sleeptime.tv_sec = 0; |
| + | sleeptime.tv_usec = 100000; | ||
| + | select(0, NULL, NULL, NULL, & | ||
| setDTRState(fd, | setDTRState(fd, | ||
| close(fd); | close(fd); | ||