Fab Academy at AS220 Labs

09 interface programming

July 22, 2010 1:10 AM

Processing

by Jenine Bressner

processing tubes.jpg I've been figuring out how to use Processing. It's open- source, so you can download it for free and find tutorials on the Processing website. I created the image above with one of the simple beginning codes, and the images below were created by modifiying that code. A sort of storm processing waves.jpg Undulating waves like unraveled knitting processing color.jpg Then I figured out how to code different colors. processing all the time.jpg I drew this with a mouse

May 12, 2010 1:08 PM

Levitating Elephant

by Noah Bedford

I wrote a small clutter program to change the position of a picture of a Muybridge elephant based on the output of the step response board:
hello.elephant.py
This is the code that runs on the FTDI version of the step response board
elephant-screenshot.png

March 31, 2010 9:07 AM

Using a GUI to Control Processing Output with ControlIP5, Firmata via Serial

by Anna Kaziunas France

I created this simple interface to control turning on and off an LED that is attached to a microcontroller via the serial port on my Mac. I wanted to see if I could get the ControlIP5 (used to create the GUI), Firmata and serial libraries working together before I tried using more complex hardware. I intend to experiment with driving multiple servos and possibly tinkering with bluetooth using the NXT library as an "cheap" way (it's "cheap" because I already own the Mindstorms hardware) to play around with bluetooth without buying additional bluetooth modules.

The Interface: Default / Initial State:

The interface is simple - the Turn On button turns the light on and the Turn Off button turns it off. None_selected.png

The Interface: Button Rollover State:

rollover.png

Here's the Processing code:


/*-------------------------------------------------------------------
 * Fab Academy -- Module 09: Interface Programming
 *--------------------------------------------------------------------
 * Assignment: Write a user interface for an input &/or output 
 * device.
 *--------------------------------------------------------------------
 * Purpose:  This program is a test to get the controlIP5, Firmata, 
 * and serial libraries working together through the serial port.  
 * This program uses a simple button GUI interface to turn on / of an
 * LED.
 *--------------------------------------------------------------------
 * Anna Kaziunas France - 30 March 2010
 * Combined / Modified example code from:
 * controlIP5 buttons example (included the library download)
 *------------------------------------------------------------------*/


import processing.serial.*;
import cc.arduino.*;
import controlP5.*;

ControlP5 controlP5;
// we have to use controlP5.Button here since there
// would be a conflict if we only use Button to declare button b.
controlP5.Button b;
Arduino arduino;

// Variables
int ledPin = 11;
int buttonValue = 0;
int myColor = color(0);

void setup() {
  arduino = new Arduino(this, Arduino.list()[2], 57600);
  arduino.pinMode(ledPin, Arduino.OUTPUT);
  size(640,480);
  smooth();
  frameRate(30);
  controlP5 = new ControlP5(this);
  controlP5.addButton("Turn_On",255,200,80,100,70);
  controlP5.addButton("Turn_Off",0,200,160,100,70);
  println(Arduino.list());
}

void draw()
{
  background(myColor);
  fill(buttonValue);
  rect(20,20,width-40,height-40);
}

public void controlEvent(ControlEvent theEvent) {
  println(theEvent.controller().name());

}

// function buttonA will receive changes from 
// controller with name Turn_On
public void Turn_On(int theValue) {
  println("a button event from Turn_On: "+theValue);
  myColor = theValue;
  arduino.digitalWrite(ledPin, Arduino.HIGH);
}

// function buttonB will receive changes from 
// controller with name Turn_Off
public void Turn_Off(int theValue) {
  println("a button event from Turn_Off: "+theValue);
  myColor = theValue;
  arduino.digitalWrite(ledPin, Arduino.LOW);
}

March 31, 2010 12:35 AM

Pure Data Frequency Modulator

by Elliot Clapp

March 30, 2010 12:45 AM

DIY hobo game controllers

by Shawn Wallace

IMG_0285.jpg

These DIY game controllers are made from pennies and cigar boxes.

IMG_0287.JPG

They are a sample controller for the Fluxly video game, a wizard duel where you have to build your own controller to compete. The interface for the game is implemented in Actionscript and compiled using Adobe's free mxmlc compiler.

March 29, 2010 10:37 AM

My favorite python/GTK reference

by Noah Bedford

Return to front

Older articles