GMU:Devices of Perception/Sebastian Kaye: Difference between revisions

From Medien Wiki
mNo edit summary
mNo edit summary
Line 153: Line 153:


Soldering the Protosheild:
Soldering the Protosheild:
[[File:shield_make.jpg]]
[[File:shield_make.jpg]]
[[File:Shield_Blank.jpg]]
[[File:Shield_Blank.jpg]]
[[File:Shield_top.jpg]]
[[File:Shield_top.jpg]]
[[File:Example.jpg]]
[[File:Shield_Side.jpg]]
[[File:Example.jpg]]
[[File:Shield_Fin.jpg]]
[[File:Example.jpg]]


Images of the general set-up while coding the breathing interaction:
Images of the general set-up while coding the breathing interaction:
[[File:Example.jpg]]
[[File:Example.jpg]]
[[File:Example.jpg]]


Some Code:
[[File:Coding_1.jpg]]
[[File:Coding_2.jpg]]
[[File:Coding_3.jpg]]
 
Below: The Code for controlling the motor's speed and direction, via the 'breathing sensor.
The Magnet sensor outputs a range of values, and here it basically operates in place of a Potentiometer.
 
int dirPin = 7;
int stepPin = 8;
long stepsToDo;
long stepTime;
int dir;
 
long target;
long curPos;
void setup() {
  Serial.begin(9600);
  pinMode(dirPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
}
void loop(){
  target = analogRead(A2) * 20 ;     
  stepsToDo = target - curPos;
  if (stepsToDo < 0) {
    digitalWrite(dirPin,LOW);
    dir = -1;
  }
  else {
    digitalWrite(dirPin,HIGH);
    dir =  1;
  }
  delayMicroseconds(stepTime + 10); //10 as minimum step Time
if (stepsToDo != 0) {
    curPos = curPos + dir;
    stepTime = 300000 / abs(stepsToDo);
    digitalWrite(stepPin,!digitalRead(stepPin));
  }
}
 
 
Here is a short video of the First Functioning moment. I am using a Potentiometer to control the Umbrella. Later this will be replaced by the Breathing Sensor.
 
Breathing Sensor Version 1:
[[File:Breathing_sensor_v1.jpg]]