Hi, thank you for your reply.
I tried your this code and it will exit soon after I run the code.
Below is the error listed:
[notice ] ofSerial: opening /dev/tty.usbmodem411 @ 115200 bps
[ error ] ofSerial: unable to open /dev/tty.usbmodem411
[notice ] ofSerial: opening /dev/tty.usbmodem411 @ 115200 bps
[ error ] ofSerial: unable to open /dev/tty.usbmodem411
[ error ] could not open serial port - listing serial devices
[notice ] ofSerial: [0] = tty.usbmodem1411
[notice ] ofSerial: [1] = cu.usbmodem1411
[notice ] ofSerial: [2] = tty.Bluetooth-Incoming-Port
[notice ] ofSerial: [3] = cu.Bluetooth-Incoming-Port