Friday, July 20, 2012

First love with python


First love with python
A couple of things to do before we could start to write *.py code on a windows machine.

  1. Download python from http://www.python.org/getit/
  2. Install the msi file python-2.7.3.msi
  3. Download pyserial from http://pyserial.sourceforge.net/pyserial.html
  4. Install the exe file pyserial-2.5.win32.exe
  5. More about the pyserial (good stuff to use with ARDUINO) later
After downloading the necessary files to run python, now is code time~
  1. Create a notepad file, rename it to *.py.
  2. Type some simple code, e.g print ‘Hello World’
  3. Start CMD
  4. Set path for using python compiler
  5. enjoy

Sample method to exe py, set path, navigate to the *.py folder, exe.
The “hello world” equivalent .
Install of pySerial. This will be the communication bridge between the arduino and python script.
  1. On the Arduino, create a code that send “Hello world” to computer over serial
  2. On the computer, create a code that detects the intended message and exe some conditional code.

code here~~
Some might ask why python?
Still remember my last experiment using arduino with java over serial?
This is why…….

No comments: