Thursday, February 2, 2023

Stupid AF Pet Trick: The Portrait Has Your Attention

 Hi!


for this project, in my imaginations I thought of a museum with a "mellow" light going on, where by approaching the work, one would activate some sort of spotlight and would light up the works being displayed. 

I chose to work with this color changing lamp because of 1.the  "hue" gives attention to the work. 2.It already switches colors by turning on (so it just looks pretty while I don't need to do complicating stuff).

I used a guinea pig art work as an example below to display how this gallery would operate. By approaching the art, the lamp that is controlled by an ultrasonic motion sensor will light up!



Code: 

const int TRIG_PIN = 7; // Arduino pin connected to Ultrasonic Sensor's TRIG pin
const int ECHO_PIN = 8; // Arduino pin connected to Ultrasonic Sensor's ECHO pin
const int LED_PIN  = 13; // Arduino pin connected to LED's pin
const int DISTANCE_THRESHOLD = 70; // centimeters

// variables will change:
float duration_us, distance_cm;

void setup() {
  Serial.begin (9600);       // initialize serial port
  pinMode(TRIG_PIN, OUTPUT); // set arduino pin to output mode
  pinMode(ECHO_PIN, INPUT);  // set arduino pin to input mode
  pinMode(LED_PIN, OUTPUT);  // set arduino pin to output mode
}

void loop() {
  // generate 10-microsecond pulse to TRIG pin
  digitalWrite(TRIG_PIN, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG_PIN, LOW);

  // measure duration of pulse from ECHO pin
  duration_us = pulseIn(ECHO_PIN, HIGH);
  // calculate the distance
  distance_cm = 0.017 * duration_us;

  if(distance_cm < DISTANCE_THRESHOLD)
    digitalWrite(LED_PIN, HIGH); // turn on device
  else
    digitalWrite(LED_PIN, LOW);  // turn off device

  // print the value to Serial Monitor
  Serial.print("distance: ");
  Serial.print(distance_cm);
  Serial.println(" cm");

  delay(500);
}


No comments:

Post a Comment

Input/Output 2: Touch designer progress demo

  Hi again, This is a little someting something I made Touch Designer progress:  This week, I created a (demo) moving liquid situation on to...