orsserialport

Why does ORSSerialPort serialPort:didReceiveData NSData only have single byte?

徘徊边缘 提交于 2020-01-05 13:08:42
问题 From my Arduino, I'm writing multi-byte data to serial with Serial.print("blah"), but in Objective-C, -serialPort:didReceiveData: (provided by ORSSerialPort) only gets this data 1 byte at a time. Occasionally, it'll grab 2 bytes at once, but never all 4. Is this expected? If so, how can I make it receive all 4 bytes at once? Arduino: void loop() { Serial.print("blah"); delay(1000); } Obj-C: - (void)serialPort:(ORSSerialPort *)serialPort didReceiveData:(NSData *)data { NSString *string = [

Creating an object in Swift using the Objective-C factory method gives a compiler error [duplicate]

强颜欢笑 提交于 2019-12-23 16:43:26
问题 This question already has an answer here : Create Swift instance from Objective-C factory method (1 answer) Closed 5 years ago . I'm trying to initiate a serial connection using ORSSerialport , an Objective-C serial library. I have already used it successfully to find all serial ports but am having problems opening a connection. The documentation shows the opening of a port as such: ORSSerialPort *serialPort = [ORSSerialPort serialPortWithPath:@"/dev/cu.KeySerial1"]; I have written the