![]() ![]() ![]() ![]() readline() #Read from Serial Port print 'You sent: ' bytes #Print What is Read from Port #Ctrl C to Close Python Window write(temp) #Writes to the SerialPort while 1 : bytes = ser. portstr #Function Ends Here #Call the Serial Initilization Function, Main Program Starts from here init_serial() temp = raw_input( 'Type what you want to send, hit enter: \r\n ' ) ser. open() #Opens SerialPort # print port open or closed if ser. port = COMNUM - 1 #COM Port Name Start from 0 #ser.port = '/dev/ttyUSB0' #If Using Linux #Specify the TimeOut in seconds, so that SerialPort #Doesn't hangs ser. global ser #Must be declared in Each Function ser = serial. Import serial #Can be Downloaded from this Link #Global Variables ser = 0 #Function to Initialize the Serial Port def init_serial (): COMNUM = 1 #Enter Your COM Port Number Here. Using third-party tools, such as Py2exe or Py installer, Python code can be packaged into stand-alone executable programs for some of the most popular operating systems, so Python-based software can be distributed to, and used on, those environments with no need to install a Python interpreter. Python interpreters are available for many operating systems, allowing Python code to run on a wide variety of systems. It features a dynamic type system and automatic memory management and has a large and comprehensive standard library. Python supports multiple programming paradigms, including object-oriented,imperative and functional programming or procedural styles. Python is a widely used high-level, general-purpose, interpreted, dynamic programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than possible in languages such as C or Java. The language provides constructs intended to enable clear programs on both a small and large scale. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |