Computer Withdrawal Simulator 0.1

I already finished the construction of the wristbands to but everything on its place.
It looks like this now:

The programming of the ArduinoBT and Processing is still a challenge. I use processing to send signals in specific time intervals to the Arduino via bluetooth so that the Arduino knows if i´m sitting in front of the computer and if not. The problem is, that the Arduino sometimes uses a different serialport to connect to the computer, so the processing cant connect to the Arduino and Arduino don´t get signals. The other problem is, when i´m out of the bluetoothrange, processing crashes. I solved this problem with an applescript which restarts the processing program several times.
If someone have a solution for these problems please let me know.

Next steps:
Improve the programs.
Test it on my body.

Advertisements

2 responses to “Computer Withdrawal Simulator 0.1

  1. One possibility would be to use some kind of pattern matching in the names of the available bluetooth devices. Processing might be able to do this, I am sure Python can. Since you know approximately what the name will look like you should be able to find a suitable example using pattern matching / regular expressions.

  2. I found a solution to let processing take always the right port. I just compare the stringnames of the available ports with the name of the arduino port.
    Maybe thats nothing special, but for me as a programming beginner its essential. So if someone have the same problem anytime, here is the code:

    import processing.serial.*;

    Serial port;
    String portName;
    String[] liste;
    String arduinoport = “/dev/tty.ARDUINOBT-BluetoothSeri-1”;

    void setup(){
    liste = Serial.list();
    for(int i=0;i<liste.length;i++){
    println(liste[i]);
    if(liste[i].equals(arduinoport) == true){
    portName = liste[i];
    port = new Serial(this, portName, 115200);
    }
    }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s