pferrerf-blog
pferrerf-blog
Pablo Ferrer
8 posts
Here is where I will be posting the things we are going to make in ARCH 433. Also it is posted things from INTRO TO ROBOTICS
Don't wanna be here? Send us removal request.
pferrerf-blog · 11 years ago
Video
tumblr
Change the Led delay with a 10K potentiometer.
0 notes
pferrerf-blog · 11 years ago
Video
tumblr
Piezo Buzzer connected to a photocell reading.
Led connected to a photocell too_ activatingspace
CODE
int speakerPin = 11;
int ledPin = 12;
int photocellPin1 = 0;
int photocellPin2 = 1;
  void setup()
{
  pinMode(ledPin,OUTPUT);
}
  void loop()
{
  // SOUND //
  int reading1 = analogRead(photocellPin1);
  int pitch = 200 + reading1 / 4;
  tone(speakerPin, pitch);
     // LIGHT //
 // int brightness = map(reading, 0,1023,0,255);
 //  digitalWrite(ledPin, 255-brightness);
  int reading2 = analogRead(photocellPin2);
  if (reading2 <  825){
     digitalWrite(ledPin, HIGH);
     delay (50);
     digitalWrite(ledPin, LOW);
     delay (50);
     digitalWrite(ledPin, HIGH);
     delay (50);
     digitalWrite(ledPin, LOW);
     delay (50);
                                }
    else {
    digitalWrite (ledPin, LOW);
  }
   }
0 notes
pferrerf-blog · 11 years ago
Video
tumblr
DC motor connected to a potentiometer
Also, connected the 10K potentiomenter to a LED.
Here is the result!
CODE
  int enablePin = 11;
int in1Pin = 10;
int in2Pin = 9;
int switchPin = 7;
int potPin = 0;
int led = 6;
int Movementsensor = 5;
  void setup()
{
  pinMode(in1Pin, OUTPUT);
  pinMode(in2Pin, OUTPUT);
  pinMode(enablePin, OUTPUT);
  pinMode(switchPin, INPUT_PULLUP);
  pinMode (led, OUTPUT);
  pinMode (Movementsensor,INPUT);
}
void loop(){
     if(digitalRead(Movementsensor) == HIGH){
                int speed = analogRead(potPin) /4;
      boolean reverse = digitalRead(switchPin);
      digitalWrite (led, HIGH);
      delay(255-speed);
      digitalWrite(led,LOW);
      delay(255 - speed);
      setMotor(speed,reverse);
     }
     if(digitalRead(Movementsensor+º) == LOW){       
        int speed = 0;
      boolean reverse = digitalRead(switchPin);
      digitalWrite (led, LOW);
      delay(255-speed);
      digitalWrite(led,LOW);
      delay(255 - speed);
      setMotor(0, reverse);
               }
                  }
     void setMotor(int speed, boolean reverse)
{
  analogWrite(enablePin, speed);
  digitalWrite(in1Pin, ! reverse);
  digitalWrite(in2Pin, reverse);
}
0 notes
pferrerf-blog · 11 years ago
Video
tumblr
FSR LED brightness
0 notes
pferrerf-blog · 11 years ago
Text
Camera control MCHAP exhibition
we have developed one method to contorl 2 cameras in the MCHAP exhibition.
Here are attached some pictures of the "tripode" and the code below.
Tumblr media Tumblr media
#include <Servo.h> //Sensor Variables Servo myServoX0; // create servo object to control a servo Servo myServoY0; Servo myServoX1; Servo myServoY1;
int servoPinX0 = 5; int servoPinY0 = 6; int servoPinX1 = 10; int servoPinY1 = 11;
//Potentiometer Variables int potPinX0 = A0; // analog pin used to connect the potentiometer int potPinY0 = A4; int potPinX1 = A2; int potPinY1 = A3;
int valX0; // variable to read the value from the analog pin int valY0; int valX1; int valY1;
int previousPotX0=0; int previousPotY0=0; int previousPotX1=0; int previousPotY1=0;
int currentPotX0=0; int currentPotY0=0; int currentPotX1=0; int currentPotY1=0;
int servoIdx = 0; int servoMax = 180; int servoMin = 0; boolean pong = true; int incr = 1; int diffThresh = 4;
long inactivityThreshold = 10000; long lastTouch; boolean dirty = false;
void setup() { // initialize serial communications at 9600 bps: Serial.begin(9600); setupServos(); //setupPotentiometers(); }
void loop() { //input readPotentiometers();
//process input data process(); if(millis()<lastTouch+inactivityThreshold) { setMotorsOverride(); } else { setMotorsInactive(); }
}
////////////////////////////////////////////////////////// //SETUP METHODS //////////////////////////////////////// //////////////////////////////////////////////////////////
void setupServos(){ //int servoSpeed=90; myServoX0.attach(servoPinX0); myServoY0.attach(servoPinY0); // attaches the servo on pin 9 to the servo object myServoX1.attach(servoPinX1); myServoY1.attach(servoPinY1); // attaches the servo on pin 9 to the servo object }
void setupPotentiometers(){
}
////////////////////////////////////////////////////////// //Action METHODS //////////////////////////////////////// ////////////////////////////////////////////////////////// void readPotentiometers() { previousPotX0 = currentPotX0; currentPotX0 = analogRead(potPinX0); // reads the value of the potentiometer (value between 0 and 1023) previousPotY0 = currentPotY0; currentPotY0 = analogRead(potPinY0); // reads the value of the potentiometer (value between 0 and 1023) previousPotX1 = currentPotX1; currentPotX1 = analogRead(potPinX1); // reads the value of the potentiometer (value between 0 and 1023) previousPotY1 = currentPotY1; currentPotY1 = analogRead(potPinY1); // reads the value of the potentiometer (value between 0 and 1023) }
void process() { //TODO: compute appropriate variables from incoming data //this function readies the data for control and transmission potsToMotorControlValue(); }
void potsToMotorControlValue() { if (( abs(previousPotX0-currentPotX0)<diffThresh)|| abs(previousPotY0-currentPotY0)<diffThresh|| abs(previousPotX1-currentPotX1)<diffThresh|| abs(previousPotY1-currentPotY1)<diffThresh) { lastTouch=millis(); dirty = true; valX0 = map(currentPotX0, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180) valY0 = map(currentPotY0, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180) valX1 = map(currentPotX1, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180) valY1 = map(currentPotY1, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180) transmitPotentiometers(); } }
void setMotorsInactive() { servoIdx += incr; if(servoIdx>=servoMax || servoIdx<=servoMin) { if(pong) { incr = -incr; } else { servoIdx = 0; } } myServoX0.write(servoIdx);//autopan
}
void setMotorsOverride() { myServoX0.write(valX0); myServoY0.write(valY0); myServoX1.write(valX1); myServoY1.write(valY1); }
////////////////////////////////////////////////////////// //Transmission METHODS //////////////////////////////////////// //////////////////////////////////////////////////////////
void transmitPotentiometers(){
sendpin(potPinY0,"cam1yaw",valX0); sendpin(potPinX0,"cam1pitch",valY0); sendpin(potPinX1,"cam2yaw",valX1); sendpin(potPinY1,"cam2pitch",valY1); }
0 notes
pferrerf-blog · 11 years ago
Text
Code for multiple Photocells
Here is the code that I made for Studio.
You can measure directly the Luxes..
//define pins
String pinsensor1 = "A0"; int sensor1position = 5; String Sensorname1 = "Thomas1";
String pinsensor2 = "A1"; int sensor2position = 10; String Sensorname2 = "Pablo";
String pinsensor3 = "A2"; int sensor3position = 123; String Sensorname3 = "Carlos";
String pinsensor4 = "A3"; int sensor4position = 1234; String Sensorname4 = "Phil";
String pinsensor5 = "A4"; int sensor5position = 12345; String Sensorname5 = "Travis";
int res1 = 10.0; // value of the resistor in the main photocell int res2 = 10.0; int res3 = 10.0; int res4 = 10.0; int res5 = 10.0;
// int [] name = new int [6]; // name [1] = thomas1; // name [2] = thomas2; // name [3] = thomas3; // name [4] = thomas4; // name [5] = thomas5; // name [6] = thomas6;
// define LEDS
void setup () { Serial.begin (9600);
}
void loop(){ int value1 = analogRead(A0); float V1 = value1*0.0048828125; int lux1 = 500/(res1*((5-V1)/ V1)); 
int value2 = analogRead(A1); float V2 = value2*0.0048828125; int lux2 = 500/(res2*((5-V2)/ V2));
int value3 = analogRead(A2); float V3 = value3*0.0048828125; int lux3 = 500/(res3*((5-V3)/ V3));
int value4 = analogRead(A3); float V4 = value4*0.0048828125; int lux4 = 500/(res4*((5-V4)/ V4));
int value5 = analogRead(A4); float V5 = value5*0.0048828125; int lux5 = 500/(res5*((5-V5)/ V5));
 int value6 = analogRead(A5);
Serial.println ("(" + Sensorname1 + "," + pinsensor1 + "," + sensor1position + "," + "luminosity = " + lux1 + " LUX" + "," + millis()+")");
Serial.print ("(" + Sensorname2 + "," + pinsensor2 + "," + sensor2position + "," + "luminosity = " + lux2 + " LUX" + "," + millis()+")");
Serial.print ("(" + Sensorname3 + "," + pinsensor3 + "," + sensor3position + "," + "luminosity = " + lux3 + " LUX" + "," + millis()+")");
Serial.print ("(" + Sensorname4 + "," + pinsensor4 + "," + sensor4position + "," + "luminosity = " + lux4 + " LUX" + "," + millis()+")");
Serial.println ("(" + Sensorname5 + "," + pinsensor5 + "," + sensor5position + "," + "luminosity = " + lux5 + " LUX" + "," + millis()+")");
}
0 notes
pferrerf-blog · 11 years ago
Video
tumblr
Digital Fabrication vs. Architectural Robotics
The Idea of how we can iluminate a space in a diferent ways came to my mind, so I picked my rommate's work for Digital Fabrication and this is the result!  
0 notes
pferrerf-blog · 11 years ago
Video
tumblr
/*
Using a photocell to start the dance, then dance for just 10 times, then stop forever with the function while (1).
*/
int led = 8;
int led2 = 7;
int led3 = 5;
int led4 = 4;
int sensePin = A0;
void setup() {          
     analogReference(DEFAULT);
  pinMode(led, OUTPUT); 
  pinMode(led2, OUTPUT);     
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);   
}
void loop() {
  int val = analogRead(sensePin);
  int sensorValue = analogRead(A0);
  Serial.println(sensorValue);
  delay(1);  
     if (val < 400)
  {
     for (int x = 0; x < 10; x++)
  {
   digitalWrite(led, HIGH);
   delay(50);
   digitalWrite(led2, HIGH);
  delay(50);               
  digitalWrite(led3, HIGH);
  delay(50);
  digitalWrite(led4, HIGH);
  delay(50); 
  digitalWrite(led, LOW);
  delay(50);
  digitalWrite(led2, LOW);
  delay(50);               
  digitalWrite(led3, LOW);
  delay(50);
  digitalWrite(led4, LOW);
  delay(50); 
     }
  while (1) 
  {}
  }
   }
0 notes