Here are the images for the assignment two.

Topics

  • Graphical interface in Pd
  • Physical interface in Arduino
  • Final assignment briefing

Workshop

  • 3D graphics in Pd
  • Translate, rotate, color
  • Animation in Pd
  • Image and video in Pd
  • Keyboard and mouse interaction

Resources

Create a GEM graphics window

Draw a cube with outline

Counter object

Metro object (animation)

Auto-rotation patch

Communication port

Arduino patch for switch

int SW = 8;

void setup()
{
  pinMode(SW, INPUT);
  Serial.begin(9600);
}

void loop()
{
  byte value = digitalRead(SW);
  Serial.write(1-value);
  delay(50);
 }

Physical switch interface

GEM display window

Analog input patch

GEM window output

Potentiometer code

int POT = 5;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  int value1 = analogRead(POT);
  byte value2 = map(value1, 0, 1023, 0, 255);
  Serial.write(value2);
  delay(50);
}

Assignment 2 briefing

Topics

  • Kinetic sculpture
  • Magnetic force
  • Motor
  • Solenoid

Workshop

  • DC motor
  • Servo motor

Reference

 
DC motor experiment
 


 
Arduino with solenoid
 

 

 
Codes

#include <Servo.h>

Servo motor;

void setup()
{
  motor.attach(9);
}

void loop()
{
  for (int pos=0; pos<180; pos++)
  {
    motor.write(pos);
    delay(15);
  }
  for (int pos=180; pos>=1; pos--)
  {
    motor.write(pos);
    delay(15);
  }
}

 

#include <Servo.h>

Servo motor;

void setup()
{
  Serial.begin(9600);
  motor.attach(9);
}

void loop()
{
  if (Serial.available()>0)
  {
    byte x = Serial.read()-48;
    x = constrain(x, 1, 9);
    motor.write(x*18);
  }
  delay(15);
}