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 :: Python If ... Else 
Python :: how to measure how much your of cpu your program is using in python 
Python :: divide list into equal parts python 
Python :: random forest 
Python :: tkinter change ttk button color 
Python :: django class based views listview 
Python :: python official documentation 
Python :: how to download chatterbot 
Python :: python tuple methods 
Python :: python len 
Python :: python permission denied 
Python :: np.pad 
Python :: min max python 
Python :: how to read a excel file in python 
Python :: positive and negative number in python 
Python :: show columns with nan pandas 
Python :: arithmetic operators in python 
Python :: reference variable python 
Python :: how to find gcd of two numbers in python 
Python :: RSA with python 
Python :: how to update image in django 
Python :: tkinter filedialog filename 
Python :: parce que in english 
Python :: python check if variable has value 
Python :: add Elements to Python list Using insert() method 
Python :: python include file 
Python :: na in python 
Python :: python suppress print output from function 
Python :: how to find the shortest word in a list python 
Python :: how to select number by twos in a list python next to each 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =