Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sys/ioctl.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <fcntl.h>
- int main(int argc, char **argv)
- {
- int eingabe = 0;
- int port;
- int i = 0;
- port = open ("/dev/ttyUSB0", O_RDWR);
- if (port == -1)
- {
- printf("Port konnte nicht geoeffnet werden! \n");
- }
- if (eingabe == 0) i |= TIOCM_DTR; // DTR deaktivieren
- ioctl (port, TIOCMBIC, &i);
- ioctl( port, TIOCSBRK, NULL ); // TXD aktivieren
- printf("die LED sollte jetzt leuchten \n");
- printf("geben Sie jetzt ne Zahl ein \n");
- scanf("%d", &eingabe);
- printf("Eingabe ist: %d \n", eingabe);
- ioctl( port, TIOCCBRK, NULL ); //TXD deaktivieren
- close (port);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement