Thursday, December 11, 2008

Using SkypeAPI in Processing

When helping a friend (my previous student) on her final project, I tried to use the SkypeAPI for Java in Processing, and finally got it work in windows XP using Processing 1.0 (Finally ... well I didn't know they released the 1.0 version until last week).

Platform and system specifics:
OS- Windows XP
Processing version- Processing 1.0 (Without Java)
Sun JDK  (NOT JRE!) version- 1.6 rev 11
Skype API for Java- Latest code in tar ball [link]
Skype ver 2.0 or above

Installation steps:
1) Do the usual setup for Processing and JDK, expand the tarball to a new folder.
2) In the sketch folder (in Processing version 1.0 only!), create the following file structure

-- libraries
    -- skype
        -- library
            |-- skype.jar (copy from folder Skype->release)
            |-- swt.jar (copy from Skype->lib->window)
            |-- winp.jar (copy from Skype->lib->window)
            |--libskype.jnilib (copy from Skype->res
  
3) Copy the file skype.dll to c:/windows/system32
4) Start Processing, now you should see an option  for importing skype library in import->libraries
5) Start Skype, test the following code in skype






import com.skype.connector.windows.*;
import com.skype.connector.test.*;
import com.skype.connector.*;
import com.skype.connector.linux.*;
import com.skype.*;
import com.skype.connector.osx.*;
import com.skype.connector.win32.*;

void setup(){
try{
Skype.call("+8521878200");
}catch (Exception e){
e.printStackTrace();
}
}

void draw(){
}

Thursday, December 4, 2008

Using AT commands + serial port to control mobile phone from processing

import processing.serial.*;

Serial mobilePort;

void setup(){
println(Serial.list());
mobilePort=new Serial(this, Serial.list()[9], 9600);
size(400, 400);
}

void draw(){
// Expand array size to the number of bytes you expect
byte[] inBuffer = new byte[7];
while (mobilePort.available() > 0) {
inBuffer = mobilePort.readBytes();
mobilePort.readBytes(inBuffer);
if (inBuffer != null) {
String myString = new String(inBuffer);
println(myString);
}
}

}

void mousePressed(){
//make phone calls
//mobilePort.write("ATD+1878200;");
// mobilePort.write("\n\r");

//Anser phone call
mobilePort.write("ATA;");
mobilePort.write("\n\r");
}

Hacked serproxy

There's a problem with the serproxy program for connecting ports number over 10. Based on the instructions in the arduino forum, I've recompiled the serproxy that overcome this problem.

You can download it from here

Wednesday, December 3, 2008

Asterisk + GSM phone as modem

http://ubuntuforums.org/showthread.php?t=166617&highlight=nokia+modem

Using ubuntu + wvdial + asterisk for sms!

Monday, December 1, 2008

Calibration for Sharp GP2Y0A700K IR range finder

A simple applet showing data for calibrating the Sharp GP2Y0A700K

Base on some calibration data, I wrote this applet to show the relationship between voltage reading and range of the GP2Y0A700K IR sensor [link]

A simple screenCap