Tuesday, 4 December 2012

Research on creating own trigger

In our interactive installation project, button or trigger is necessary . The button or trigger is needed for user to initialize the interactive .  Rather than the existed input and trigger, we are more interest on the custom or hacked trigger. Example  of  methods to create customize  trigger can be:


Keyboard control (events)
Keyboard control or event can be used to trigger some other function other than for normal usage for keyboard. For example, we can make the alphabet 'A' to open a new program and so on.
There are a few ways to do with keyboard control.
- By using Action Script
Using letter keys to control movement (using Keyboard class)
private function keyPressedDown(e:KeyboardEvent):void {

        var key:uint = e.keyCode;
        var step:uint = 5;

        switch(key) {
            case Keyboard.LEFT:
            case Keyboard.A:
                player.x -= step;
                break;
            case Keyboard.RIGHT:
            case Keyboard.D:
                player.x += step;
                break;
            case Keyboard.UP:
            case Keyboard.W:
                player.y -= step;
                break;
            case Keyboard.DOWN:
            case Keyboard.S:
                player.y += step;
                break;


Reference:

- By using Processing
Responding Differently to Different Key Presses
void keyPressed()
{
 
  switch (key) {
    case 'r':
      // do something if the key pressed was 'r'
      break;
    case 'g':
      // do something if the key pressed was 'g'
      break; 
    case 'b':
      // do something if the key pressed was 'b'
      break;     
    default:  
      break;
  }
 
}

Reference:


Software and Trigger Button
By using Arduino microcontroller, it is can be used to trigger the photobooth application and also other stuff.
How it works :
1. The button is pressed
2. An Arduino registers the button press
3. AAC keys listens to the serial port for serial commands.
- AAC keys is a free application which listens for serial commands and emulates mouse and keyboard    events.
4. Wiring the circuit
5. Writing the code (By using Processing)
const int buttonPin = 10; // the number of the pushbutton pin

int buttonState = 0; // variable for reading the pushbutton status

void setup() {

pinMode(buttonPin, INPUT);
Serial.begin(9600); // open the serial port at 9600 bps:
}

void loop(){

buttonState = digitalRead(buttonPin);

if (buttonState == HIGH) {
Serial.println();
}
else {
// nothing
}

}
6. Installing AAC keys

Reference:

No comments:

Post a Comment