Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Python communication with serial port

        serialString = ""                           # Used to hold data coming over UART


while(1):

    # Wait until there is data waiting in the serial buffer
    if(serialPort.in_waiting > 0):

        # Read data out of the buffer until a carraige return / new line is found
        serialString = serialPort.readline()

        # Print the contents of the serial data
        print(serialString.decode('Ascii'))

        # Tell the device connected over the serial port that we recevied the data!
        # The b at the beginning is used to indicate bytes!
        serialPort.write(b"Thank you for sending data 
")
    
Comment

PREVIOUS NEXT
Code Example
Python :: pytesseract.image_to 
Python :: how to mention someone discord.py 
Python :: pyplot.plot 
Python :: str in python 
Python :: selenium 
Python :: round down number python 
Python :: boolean python example 
Python :: list len python 
Python :: python docstring use 
Python :: python check if character in string 
Python :: corpus 
Python :: counter method in python 
Python :: convert int to hexadecimal 
Python :: python path absolute 
Python :: how to duplicate a list in python 
Python :: show which columns in dataframe have NA 
Python :: python tokens 
Python :: self.variable 
Python :: fastest way to check odd or even in python 
Python :: iteration over dictionary 
Python :: how to set background color for a button in tkinter 
Python :: axes_style seaborn 
Python :: how to sum only the odd values in python 
Python :: run flask in background 
Python :: python launch prompt 
Python :: Python Tkinter ListBox Widget Syntax 
Python :: django connexion session time 
Python :: python all any example 
Python :: flask set mime type 
Python :: prime numbers 1 to input 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =