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
Post a Comment