Interactive architectural component
This project examines architectural components and integrated physical computing technology. The piece is both digitally designed and fabricated, as well as manually worked and constructed. The form has a plywood solid base, to enclose the circuitry and microcontroller. There is an acrylic LED holster, and an acrylic tube to encapsulate the light. As a viewer approaches the object, an ultrasonic sensor picks up the distance from a viewer to the object, and adjusts the lights to the distance, becoming brighter as a person gets closer. When there is no presence within the range of the sensor, the object enters a ‘sleep state’ and breathes dim light.
int configPin = 13;
const int pwPin = 7;
int pin1 = 3;
int pin2 = 5;
int pin3 = 6;
int pin4 = 9;
int pin5 = 10;
int activePin = 3;
const int arraySize = 7;
int rangevalue[arraySize];
boolean awake;
int delayTime = 50;
int brightness = 50;
int sleepBrightness = 10;
int sleepDelay = 65;
long inches;
long pulse;
int modE;
void setup() {
Serial.begin(9600);
delay(500);
pinMode(configPin,OUTPUT);
}
void loop()
{
readSonar();
if(awake){
lights();
}
else{
sleep();
}
delay(delayTime);
}
void readSonar(){
pinMode(pwPin, INPUT);
for(int i = 0; i = 1 && inches = 19 && inches = 37 && inches = 61 && inches <= 86){
activePin = 9;
awake = true;
}
else{
activePin = 99;
awake = false;
Serial.println(“Sleeping!”);
}
}
void lights(){
analogWrite(pin1, brightness);
analogWrite(pin2, brightness);
analogWrite(pin3, brightness);
analogWrite(pin4, brightness);
analogWrite(pin5, brightness);
// delay(sleepDelay);
}
void sleep(){
for(int i = 0; i 0; i–){
analogWrite(pin1, i);
analogWrite(pin2, i);
analogWrite(pin3, i);
analogWrite(pin4, i);
analogWrite(pin5, i);
delay(sleepDelay);
}
}
void printArray(int *a, int n) {
// for (int i = 0; i < n; i++)
// {
// Serial.print(a[i], DEC);
// Serial.print(‘ ‘);
// }
// Serial.println();
}
//Sorting function
// sort function (Author: Bill Gentles, Nov. 12, 2010)
void isort(int *a, int n){
// *a is an array pointer function
for (int i = 1; i = 0) && (j < a[k]); k–)
{
a[k + 1] = a[k];
}
a[k + 1] = j;
}
}
//Mode function, returning the mode or median.
int mode(int *x,int n){
int i = 0;
int count = 0;
int maxCount = 0;
int mode = 0;
int bimodal;
int prevCount = 0;
while(iprevCount&count>maxCount){
mode=x[i];
maxCount=count;
bimodal=0;
}
if(count==0){
i++;
}
if(count==maxCount){//If the dataset has 2 or more modes.
bimodal=1;
}
if(mode==0||bimodal==1){//Return the median if there is no mode.
mode=x[(n/2)];
}
// mode = mode/2;
return mode;
}















