Subscribe:

Ads 468x60px

Wednesday, November 21, 2012

How to open and close a process from a python script

Hi guys

     I am giving some idea about  how we can start and stop a process using a python script. This will be useful when we need to start a process that is outside the script

I am running two python scripts. One is master script, this script will start the slave script. Slave script will execute continuously upto 5 sec and it will terminated by the master script

Master script

 #!/usr/bin/python  
 import time  
 import subprocess  
 #starting process python while.py  
 proc = subprocess.Popen(["python","while.py"],shell=False)  
 #5 sec delay  
 time.sleep(5)  
 #killing process  
 subprocess.call(["kill","-9","%d" % proc.pid])  
 #waiting for killing  
 proc.wait()  
 print 'poll = ',proc.poll()  


Slave script


 #!/usr/bin/python  
 while 1:  
      print "hello"  


Output
--------

It will print hello upto 5 seconds after that it will stop and show this message







Sunday, November 4, 2012

Controlling Android Phones using Python and Linux

Hi all

  I am giving a brief tutorial on how to control android phone using python over wifi using PC.

Prerequisites on android phone

1)Wifi ADB Application: It is a tool for doing android debugging over wifi. Here is my previous tutorial about Wifi ADB


Prerequisites on PC

1)Ubuntu 12.04 


Procedure

1)Start wifi adb using above tutorial
2)Start a private server using SL4A.


Thursday, November 1, 2012

New Arduino DUE

Hi all

   There is a newcomer in the arduino board series. It's arduino due. The main feature of this board is, it comes with an ARM based controller.


Technical Specification


Microcontroller                                           AT91SAM3X8E
Operating Voltage                                           3.3V
Input Voltage (recommended)                           7-12V
Input Voltage (limits)                                   6-20V
Digital I/O Pins                                           54 (of which 12 provide PWM output)
Analog Input Pins                                           12
Analog Outputs Pins                                   2 (DAC)
Total DC Output Current on all I/O lines           130 mA
DC Current for 3.3V Pin                                   800 mA
DC Current for 5V Pin                                   800 mA
Flash Memory                                                   512 KB 
SRAM                                                           96 KB (two banks: 64KB and 32KB)
Clock Speed                                                   84 MHz