From f8ee33d800e00d9e570c65203ec1ba09b9dd492c Mon Sep 17 00:00:00 2001 From: Starter Date: Sat, 6 Feb 2021 00:46:38 +0800 Subject: [PATCH] Handy sendString method --- pyfirmata/pyfirmata.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pyfirmata/pyfirmata.py b/pyfirmata/pyfirmata.py index 0963cea7..0464a552 100755 --- a/pyfirmata/pyfirmata.py +++ b/pyfirmata/pyfirmata.py @@ -256,6 +256,15 @@ def send_sysex(self, sysex_cmd, data): msg.append(END_SYSEX) self.sp.write(msg) + def send_string(self, string: str): + """ + Sends a ASCII-compartible string. + + :param 'string': str + The string to send + """ + self.send_sysex(0x71, str_to_two_byte_iter(data)) + def bytes_available(self): return self.sp.inWaiting()