I'm writing some C code to get the message from arduino, and the port i'm using is tty.usbmodem1411 which works well to burn the code to arduino board. However, while writing the C code
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
int main(){
int fd = open("/dev/tty.usbmodem1411", O_RDWR);
printf("open\n");
This snap of code can be compiled but while running, even the "open" cannot be displayed. The program is stuck on the open line.
I use command chmod 777 and chown and chgrp to change the permission of the file, but it still doesn't work. And also I cannot use command
cat /dev/tty.usbmodem1411
it just blocked and nothing happened. I have checked online and changed the port to cu.usbmodem1411 which seems the same.
Anyone has some ideas? Thank you.