osx - Swift 3 ORSSerialPort read from arduino -


so i'm trying read arduino output orsserialport lib. if use example code, of lib, named orsserialportdemo, works. thing mis in demo how used serialportdemocontroller.swift in there viewcontroller.

i created standard project, has viewcontroller.swift. bridge header imports done, references compile. rather using gui select usb-port , baud rate, set them in code.

something this:

var serial: serialportdemocontroller? serial = serialportdemocontroller() serial.path = "dev/cu.usbserial-a6006hps" serial.baudrate = 9600 serial.open() 

then al need read port. should work, function: func serialport(_ serialport: orsserialport, didreceive data: data)? in functio this:

if let string = nsstring(data: data, encoding: string.encoding.utf8.rawvalue)  {     print(string) } 

i have looked around, nothing seems work. if point me in right direction great.

thanks!


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -