2 Step 1: Connect to a terminal emulator using a PC.1 Step 0: Note whether your Raspberry Pi has Wireless/Bluetooth capability.Phone.port = 4 #try different ports here, if this doesn't work.
the mobile is connected through the serial port and the code prompts the correct port as well and there is no error in the code but still the message is not being sent. Nokia E-72 is connected to PC via Data Cable. i am also working in python 2.6 and i want to send SMS to a mobile while my cell phone i.e. If you need a graphical interface I strongly encourage you to have a look at the pyGTK project and the Glade interface designer. You will also be able to use the huge amounts of other native apis and additional modules Python has to add all kind of features to you applications!
I consider Python and pySerial one of the simplest and faster ways to develop an application to use a serial connection.
Really important is the serial port configuration: if you configure it incorrectly you probably will end in problems during communications (check the manual of the device you are connecting to get the correct connections parameters).Īlso remember to point the port parameter to the device file you are using (under windows you can simply use COMMX, where X is the COMM instance number 1,2,3,4,etc. This should demonstrate you the power of this solution. Thanks!Īs you can see the code is pretty simple and self documenting. If you use Python 3 and find other issues with the code please leave a comment. As some users commented below the raw_input() function has been removed so you should just use the new Python 3 function input(). NOTE for Python 3 users: The code above has been written for Python 2 and I'm no more able to test RS232 connections with Python 3. # let's wait one second before reading output (let's give device time to answer) # (note that I happend a \r\n carriage return and line feed to the characters - this is requested by my device) Print 'Enter your commands below.\r\nInsert "exit" to leave the application.' # configure the serial connections (the parameters differs on the device you are connecting to) The application is a simple serial terminal which you can use to send commands (and receive output) to a serial connected device. I give you here a simple application which should let you understand how python serial apis are easy to use. Using the pySerial apis is pretty simple: just have a look at the project website to have an idea of the apis it gives you.
Just follow any guide on the web to install Python on your system and then follow the pySerial installation guide. I've been able to install and use them (in both Linux and Windows) without problems at all (while my classmates had lot of problems with java and comm apis.).
Surprisingly I found that Python with the pySerial module is a pretty intelligent solution! The professor here suggested to use Java to implement the applications: unfortunately I found the API comm pretty complex in installation and configuration. for the practical parts of the exams we need to write applications which, using the RS-232 communication channels, controls the movements of the robots. The PC to Controller connection is a serial RS-232 connection. In the practical part of the exam we have to write some applications to operating some didactics robots we have (Rhino XR-4 and SCARA Robots).Įach robot is connected to a Controller (Rhino Mark-4) which can be connected to a PC to send commands to the Controller in order to let the robots do things. Here at ULPGC I'm following a Robotics course.