Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
The intersection of art and technology has opened up new avenues for creative expression, enabling artists to incorporate interactive and dynamic elements into their works. Arduino, a versatile and user-friendly microcontroller platform, has become a popular tool for artists looking to blend technology with their artistic endeavors. This article will explore how Arduino can be used to create an interactive art installation, highlighting its importance and providing a step-by-step guide to building a project.
Projeto: In this project, we will create an interactive light sculpture that responds to the viewer's proximity. The sculpture will consist of an array of LEDs that change color and intensity based on the distance of a person from the artwork. The objectives of this project are to demonstrate how technology can enhance artistic expression and to provide a practical example of using Arduino for interactive art installations.
Lista de componentes:
Exemplos: Below is the Arduino code for the interactive light sculpture. The code uses an ultrasonic sensor to measure the distance of the viewer and adjusts the color and brightness of the LEDs accordingly.
// Include necessary libraries
#include <Adafruit_NeoPixel.h>
// Define pin for the ultrasonic sensor
const int trigPin = 9;
const int echoPin = 10;
// Define pin for the RGB LEDs
#define LED_PIN 6
#define NUM_LEDS 10
// Create an instance of the Adafruit_NeoPixel class
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
// Initialize serial communication
Serial.begin(9600);
// Initialize ultrasonic sensor pins
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
// Initialize the LED strip
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
// Measure distance using the ultrasonic sensor
long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration / 2) / 29.1;
// Map distance to LED brightness and color
int brightness = map(distance, 0, 100, 255, 0);
int red = map(distance, 0, 100, 255, 0);
int green = map(distance, 0, 100, 0, 255);
int blue = map(distance, 0, 100, 0, 0);
// Set LED colors
for (int i = 0; i < NUM_LEDS; i++) {
strip.setPixelColor(i, strip.Color(red, green, blue));
}
strip.setBrightness(brightness);
strip.show();
// Print distance to the serial monitor
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
// Delay before the next loop
delay(100);
}
In this code:
setup
function, we initialize serial communication, sensor pins, and the LED strip.loop
function, we measure the distance using the ultrasonic sensor and map the distance to LED brightness and color.strip.setPixelColor
function sets the color of each LED based on the mapped values.strip.show
function updates the LEDs to display the new colors and brightness.This project demonstrates a simple yet powerful way to integrate technology into art, creating an interactive experience for viewers.