Dania González Sanabria: Difference between revisions

From Medien Wiki
mNo edit summary
mNo edit summary
 
(31 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[File:DSC05528 a.jpg|thumb|800x800px|<small>“Y de mortales engaños, Y de sublimes dolores” exhibition “The Plant Plant” Winterwerkschau Bauhaus University Weimar. 2025.</small>]]
[[File:DSC05528 a.jpg|thumb|800x800px|<small>“''Y de mortales engaños, Y de sublimes dolores''”, exhibition “The Plant Plant” Winterwerkschau Bauhaus University Weimar. 2025.</small>]]''<small>'''...'''</small>''


====== <small>''Yo sé de de nombres extraños''</small>======
''<small>'''Yo sé de nombres extraños'''</small>''


======<small>''De las plantas y las flores,''</small> ======
''<small>'''De las plantas y las flores,'''</small>''


======<small>''Y de mortales engaños''</small>======
''<small>'''Y de mortales engaños'''</small>''


======<small>''Y de sublimes dolores.''</small>======
''<small>'''Y de sublimes dolores.'''</small>''
<small>''…''</small>
 
<small>'''''…'''''</small>


<small>''(I know strange names''</small>
<small>''(I know strange names''</small>
Line 17: Line 18:


<small>''And of sublime pains.)''</small>
<small>''And of sublime pains.)''</small>




Line 23: Line 23:
<small>José Martí. “Versos Sencillos”, Fragment.</small>  
<small>José Martí. “Versos Sencillos”, Fragment.</small>  


<small>( José Julián Martí Pérez (Havana, 1853 - Dos Ríos, 1895) was a Cuban politician, diplomat, poet, essayist, journalist and philosopher, founder of the Cuban Revolutionary Party and organizer of the Cuban War of Independence, during which he died in combat. He is considered the initiator of literary modernism in Latin America. He is considered the national hero of the Republic of Cuba, and his ideals of independence and anti-colonialism have been used by the Cuban regime to politically indoctrinate the Cuban people. But these same ideals of nationalism and independence also serve as a guide and inspiration to the opposition that desires a Cuba without repression, a just country and a republic “with everyone and for the good of everyone”).</small>
<small>(José Julián Martí Pérez (Havana, 1853 - Dos Ríos, 1895) was a Cuban politician, diplomat, poet, essayist, journalist and philosopher, founder of the Cuban Revolutionary Party and organizer of the Cuban War of Independence, during which he died in combat. He is considered the initiator of literary modernism in Latin America. He is considered the national hero of the Republic of Cuba, and his ideals of independence and anti-colonialism have been used by the Cuban regime to politically indoctrinate the Cuban people. But these same ideals of nationalism and independence also serve as a guide and inspiration to the opposition that desires a Cuba without repression, a just country and a republic “with everyone and for the good of everyone”).</small>
 
 
 


====== Concept ======
The lemon tree is a resilient plant that bears fruit even when it is dying. 


In this project, the lemon tree is a symbol of the members and generations of my Cuban family, it is an inheritance of sentimental and moral values in it. 


This piece is inspired by my grandfather, Justo Manuel González. The last words he wrote, when he was already losing his faculties, were an autobiography recounting the enormous work he did, mostly linked to the Cuban revolutionary process and its social and economic tasks. Justo, who was a “national vanguard” of the Cuban Revolution, worked with honesty, sacrifice, and faith, to create a good society for his family, his community, and his country. He died in 2021 in Cuba, after several months of being a victim of medical abandonment and negligence since his country became corrupted and neglectful of its people.  
====== '''Concept''' ======
'''The lemon tree is a resilient plant that bears fruit even when it is dying.''' In this project, the lemon tree is a symbol of the members and generations of my Cuban family, it is also an inheritance of sentimental and moral values in it.


He never lived the system and country he dreamed of, even when he worked and fought for it his whole life.
This piece is inspired by my grandfather, Justo Manuel González. The last words he wrote, when he was losing his faculties, were an autobiography recounting the enormous work he did, mostly linked to the Cuban revolutionary process social and economic tasks. Abuelo Justo, who was a “national vanguard” of the Cuban Revolution, worked with honesty, sacrifice, and faith, to create a good society for his family, his community, and his country. He died in 2021 in Cuba after several months of being a victim of medical abandonment and negligence since his country became corrupted and neglectful of its people. He never lived the system and country he dreamed of, even when he worked and fought for it his whole life.  


The death of the old lemon tree also speaks about the Cuban context in general, its history, and its current sociopolitical crisis that generates physical and sentimental ruptures of its most vulnerable families. It has affected especially the humble elderly people who were the working generations who created and supported the revolutionary Cuban process that became corrupted. Now, those persons are the most affected by the crisis, being abandoned by the social system to which they gave their faith and the effort of their lives. The piece is a tribute to them.
The death of the old lemon tree also speaks about the Cuban context, its history, and its current sociopolitical crisis that generates physical and sentimental ruptures of its most vulnerable families. It has affected especially the humble elderly people who were the hardworking generations who created and supported the revolutionary Cuban process that became corrupted. Now, those persons are the most abandoned by the same social system to which they gave their faith and the effort of their lives. This piece is a tribute to them.
[[File:DSC05527 abc.jpg|center|thumb|1080x1080px]]
[[File:DSC05527 abc.jpg|center|thumb|1080x1080px]]


Line 47: Line 42:
I used the branches collected from that tree, making them move when the visitor approached close to them. It was also shown a dried lemon from that tree.
I used the branches collected from that tree, making them move when the visitor approached close to them. It was also shown a dried lemon from that tree.


The archive also shows how my parents in Cuba, after the death of the old lemon tree planted a new lemon tree in their yard, and also show how I, a few years after escaping from Cuba, decided to start planting new lemon trees, as a way of approach to my family and roots despite distance and exile.
The archive also shows how my parents in Cuba, after the death of the old lemon tree, planted a new lemon tree in their yard. It also shows how I, a few years after escaping from Cuba, decided to start planting new lemon trees, as a way of approach to my family and roots despite distance and exile.


I also set up a house-shaped terrarium with the new lemon tree plants.
In the installation, I also set up a house-shaped terrarium with the new lemon tree plants.


[[File:Dania González Sanabria sketch 1.jpg|thumb|1116x1116px|<small>Sketch 1, Lemon tree archive, Dania González Sanabria</small> ]]
[[File:Dania González Sanabria sketch 1.jpg|thumb|1116x1116px|<small>Sketch 1, Lemon tree archive, Dania González Sanabria</small> ]]
Line 74: Line 69:
<u>1rst System:</u>
<u>1rst System:</u>


For the moving branch, it was set a system with an HC-SR04 Ultrasonic Distance Sensor controlling a 15 kg Digital Servo Motor, through an Arduino Nano and a connective board.   
For the <u>moving branch</u>, it was set a system with an HC-SR04 Ultrasonic Distance Sensor controlling a 15 kg Digital Servo Motor, through an Arduino Nano and a connective board.   
 
When the spectator approaches 65 cm of the branches, the servo motor starts to turn from 0 to 18 degrees, making the branches, attached to it, start to move. If the spectator approaches at a closer distance (50 cm), the servo motor turns from 0 to 40 degrees, making the branches move a little bit more. 
 
The Servo Motor received an extra supply of energy from an MB-102 3.3V/5V Power Module plugged into electricity and connected to the board of the 2nd System.


When the spectator approaches 60 cm of the branches, the servo motor starts to turn from 0 to 18 degrees, making the branches, attached to it, start to move. If the spectator approaches at a closer distance (40 cm), the servo motor turns from 0 to 58 degrees, making the branches move a little bit more, and slower. 


The Servo Motor received an extra supply of energy from an MB-102 3.3V/5V Power Module plugged into electricity and connected to the board of the 2nd System.


              
              
Line 105: Line 99:


(The written code is at the end of the page)
(The written code is at the end of the page)




Line 112: Line 108:
<u>2nd System:</u>   
<u>2nd System:</u>   


The terrarium had a humidifier system inside. It was made with a Capacitive Soil Moisture Sensor connected to an Arduino Nano and a connective board. When the soil got drier (over value 400 read by that sensor, whose values are approximately this: wet is < 400, dry is > 400), a 5V Relay Module also connected to the board, activated a 5V Humidifier made with a piezoelectric. When the soil got humid again (under value 400) the humidifier stopped until the soil got dry again. The relay and humidifier received an extra supply of energy from an MB-102 3.3V/5V Power Module plugged into electricity. [[File:Imagen de WhatsApp 2025-02-22 a las 03.09.15 5fec5717.jpg|alt=Sketch 3, Lemon tree archive, Dania González Sanabria|thumb|1095x1095px|<small>Sketch 3, Terrarium,  2nd System, Lemon tree archive, Dania González Sanabria</small>]]
The <u>terrarium</u> had a <u>humidifier system</u> inside. It was made with a Capacitive Soil Moisture Sensor connected to an Arduino Nano and a connective board. When the soil got drier (over value 400 read by that sensor, whose values are approximately this: wet is < 400, dry is > 400), a 5V Relay Module also connected to the board, activated a 5V Humidifier made with a piezoelectric. When the soil got humid again (under value 400) the humidifier stopped until the soil got dry again. The relay and humidifier received an extra supply of energy from an MB-102 3.3V/5V Power Module plugged into electricity. [[File:Imagen de WhatsApp 2025-02-22 a las 03.09.15 5fec5717.jpg|alt=Sketch 3, Lemon tree archive, Dania González Sanabria|thumb|1095x1095px|<small>Sketch 3, Terrarium,  2nd System, Lemon tree archive, Dania González Sanabria</small>]]




Line 141: Line 137:




2nd System  
2nd System


Devices:
Devices:
Line 164: Line 160:
The installation was displayed with a set of mini LED spotlights. Those were connected to a timer that switched the lights on during the daytime and switched the lights off during the nighttime. That created a proper light environment for the tiny lemon trees during the days of the exhibition.
The installation was displayed with a set of mini LED spotlights. Those were connected to a timer that switched the lights on during the daytime and switched the lights off during the nighttime. That created a proper light environment for the tiny lemon trees during the days of the exhibition.


“Y de mortales engaños, Y de sublimes dolores” was displayed in the exhibition of the class “The Plant Plant” during the Winterwerkschau of the Bauhaus University Weimar. Winter Semester 2024 – 2025.
[[File:CD 08765 raw.jpg|thumb|1110x1110px|<small>Photo: Christian Doeller</small>[[File:CD 08618 raw.jpg|alt=Photo: Christian Doeller. “Y de mortales engaños, Y de sublimes dolores”. Dania González Sanabria.“The Plant Plant” exhibition. Winterwerkschau Bauhaus University. 2025.|thumb|1121x1121px|<small>Photo: Christian Doeller</small>|center]]|center]]
[[File:CD 08765 raw.jpg|thumb|1110x1110px|<small>Photo: Christian Doeller</small>[[File:CD 08618 raw.jpg|alt=Photo: Christian Doeller. “Y de mortales engaños, Y de sublimes dolores”. Dania González Sanabria.“The Plant Plant” exhibition. Winterwerkschau Bauhaus University. 2025.|thumb|1121x1121px|<small>Photo: Christian Doeller</small>|center]]|center]]
[[File:CD 08622 raw.jpg|alt=Photo: Christian Doeller. “Y de mortales engaños, Y de sublimes dolores”. Dania González Sanabria.“The Plant Plant” exhibition. Winterwerkschau Bauhaus University. 2025.|thumb|<small>Photo: Christian Doeller</small>|745x745px|center]]
[[File:CD 08622 raw.jpg|alt=Photo: Christian Doeller. “Y de mortales engaños, Y de sublimes dolores”. Dania González Sanabria.“The Plant Plant” exhibition. Winterwerkschau Bauhaus University. 2025.|thumb|<small>Photo: Christian Doeller</small>|745x745px|center]]
Line 183: Line 178:




“''Y de mortales engaños, Y de sublimes dolores''” was displayed in the exhibition of the class “The Plant Plant” during the Winterwerkschau of the Bauhaus University Weimar, Germany. Winter Semester 2024 – 2025.




Line 194: Line 194:
<u>1rts Board:</u>
<u>1rts Board:</u>


For the platformio.ini:
<u>main.cpp:</u>


=====Fort he main.cpp:=====
<small><code>#include <Servo.h></code></small>  
<small><code>#include <Servo.h></code></small>  


<small><code>#define TRIG_PIN 2 // Pin Trig del sensor ultrasónico</code></small>
<small><code>#define TRIG_PIN 2 // Pin Trig ultrasonic sensor</code></small>


<small><code>#define ECHO_PIN 3 // Pin Echo del sensor ultrasónico</code></small>  
<small><code>#define ECHO_PIN 3 // Pin Echo ultrasonic sensor</code></small>  


<small><code>Servo myservo;  </code></small>  
<small><code>Servo myservo;  </code></small>  


<small><code>float ang = 18; // Ángulo base de oscilación</code></small>
<small><code>float ang = 18; // Oscilation basic angle</code></small>


<small><code>int distanciaPersona = 65;  // Primer umbral</code></small>
<small><code>int distanciaPersona = 60;  // first umbral</code></small>


<small><code>int distanciaCercana = 50;  // Segundo umbral</code></small>  
<small><code>int distanciaCercana = 40;  // second umbral</code></small>  


<small><code>void setup() {</code></small>
<small><code>void setup() {</code></small>
Line 231: Line 228:
<small><code>int distance;</code></small>
<small><code>int distance;</code></small>


<small><code>// Enviar pulso ultrasónico</code></small>
<small><code>// send ultrasonic pulse</code></small>


<small><code>digitalWrite(TRIG_PIN, LOW);</code></small>
<small><code>digitalWrite(TRIG_PIN, LOW);</code></small>
Line 243: Line 240:
<small><code>digitalWrite(TRIG_PIN, LOW);</code></small>
<small><code>digitalWrite(TRIG_PIN, LOW);</code></small>


<small><code>// Leer el tiempo de respuesta del eco y calcular distancia</code></small>
<small><code>// Read time of reply of eco and calculate distance</code></small>


<small><code>duration = pulseIn(ECHO_PIN, HIGH);</code></small>
<small><code>duration = pulseIn(ECHO_PIN, HIGH);</code></small>
Line 255: Line 252:
<small><code>Serial.println(" cm");</code></small>
<small><code>Serial.println(" cm");</code></small>


<small><code>// Evento 2: Si la distancia es menor a 30 cm, mayor movimiento</code></small>
<small><code>// Event 2: if distance is less than 30 cm, move</code></small>


<small><code>if (distance < distanciaCercana) {</code></small>
<small><code>if (distance < distanciaCercana) {</code></small>


<small><code>  int maxAngulo = ang + 40;  // Aumenta el rango de oscilación</code></small>
<small><code>  int maxAngulo = ang + 40;  // Increase oscilation range</code></small>  


<small><code>  if (maxAngulo > 180) maxAngulo = 180; // Limita el ángulo a 180°</code></small>
<small><code>  if (maxAngulo > 180) maxAngulo = 180; // Limit angle to 180°</code></small>


<small><code>  for (int pos = 0; pos <= maxAngulo; pos += 1) {</code></small>
<small><code>  for (int pos = 0; pos <= maxAngulo; pos += 1) {</code></small>
Line 281: Line 278:
<small><code>}</code></small>
<small><code>}</code></small>


<small><code>// Evento 1: Si la distancia es menor a 65 cm pero mayor o igual a 30 cm</code></small>
<small><code>// Evento 1: if distancia is less than 60 cm but more or igual 40 cm</code></small>


<small><code>else if (distance < distanciaPersona) {</code></small>
<small><code>else if (distance < distanciaPersona) {</code></small>
Line 303: Line 300:
<small><code>}</code></small>
<small><code>}</code></small>


<small><code>// Si no hay objeto cerca, dejar el servo en 0°</code></small>
<small><code>// if no object, set the servo at 0°</code></small>


<small><code>else {</code></small>
<small><code>else {</code></small>
Line 311: Line 308:
<small><code>}</code></small>
<small><code>}</code></small>


<small><code>delay(500); // Pequeño retraso antes de la siguiente medición</code></small>
<small><code>delay(500); // Tiny delay before next event</code></small>


<small><code>}</code></small>
<small><code>}</code></small>
Line 318: Line 315:


<u>2nd Board:</u>
<u>2nd Board:</u>
<u>main.cpp:</u>
<code><small>#include <Arduino.h></small></code>
<code><small>int relay = 2;</small></code>
<code><small>void setup() {</small></code>
<code><small>  Serial.begin(9600);</small></code>
<code><small>  pinMode(relay, OUTPUT);      </small></code>
<code><small>  //digitalWrite(2,LOW);      </small></code>
<code><small>}</small></code>
<code><small>void loop() {</small></code>
<code><small>  int val;</small></code>
<code><small>  val = analogRead(A0); //CONECT sensor AL Analog 0</small></code>
<code><small>Serial.println(val); //print the value to serial port</small></code>
<code><small>if (val<400)</small></code>
<code><small>{</small></code>
<code><small>  Serial.println("desactivado");</small></code>
<code><small>   digitalWrite(relay,HIGH);</small></code>
<code><small>  } else {</small></code>
<code><small>    Serial.println("activado");</small></code>
<code><small>    digitalWrite(relay,LOW);</small></code>
<code><small>}</small></code> 
<code><small>  delay(500);</small></code>
<code><small>}</small></code>

Latest revision as of 12:55, 24 February 2025

Y de mortales engaños, Y de sublimes dolores”, exhibition “The Plant Plant” Winterwerkschau Bauhaus University Weimar. 2025.

...

Yo sé de nombres extraños

De las plantas y las flores,

Y de mortales engaños

Y de sublimes dolores.

(I know strange names

Of plants and flowers,

And of deadly cheatings

And of sublime pains.)


José Martí. “Versos Sencillos”, Fragment.

(José Julián Martí Pérez (Havana, 1853 - Dos Ríos, 1895) was a Cuban politician, diplomat, poet, essayist, journalist and philosopher, founder of the Cuban Revolutionary Party and organizer of the Cuban War of Independence, during which he died in combat. He is considered the initiator of literary modernism in Latin America. He is considered the national hero of the Republic of Cuba, and his ideals of independence and anti-colonialism have been used by the Cuban regime to politically indoctrinate the Cuban people. But these same ideals of nationalism and independence also serve as a guide and inspiration to the opposition that desires a Cuba without repression, a just country and a republic “with everyone and for the good of everyone”).


Concept

The lemon tree is a resilient plant that bears fruit even when it is dying. In this project, the lemon tree is a symbol of the members and generations of my Cuban family, it is also an inheritance of sentimental and moral values in it.

This piece is inspired by my grandfather, Justo Manuel González. The last words he wrote, when he was losing his faculties, were an autobiography recounting the enormous work he did, mostly linked to the Cuban revolutionary process social and economic tasks. Abuelo Justo, who was a “national vanguard” of the Cuban Revolution, worked with honesty, sacrifice, and faith, to create a good society for his family, his community, and his country. He died in 2021 in Cuba after several months of being a victim of medical abandonment and negligence since his country became corrupted and neglectful of its people. He never lived the system and country he dreamed of, even when he worked and fought for it his whole life.

The death of the old lemon tree also speaks about the Cuban context, its history, and its current sociopolitical crisis that generates physical and sentimental ruptures of its most vulnerable families. It has affected especially the humble elderly people who were the hardworking generations who created and supported the revolutionary Cuban process that became corrupted. Now, those persons are the most abandoned by the same social system to which they gave their faith and the effort of their lives. This piece is a tribute to them.

DSC05527 abc.jpg
Description

The project is an archive of three generations of lemon trees in my family, using photos, writings, sketches, dried branches and fruits, and new plants.

The archive starts with the death of the old lemon tree in my parents’ home in Cuba, depicting its analogy with my grandfather´s death and life. I decided to show a photo of the still-full-of-lemon branch of the dead old tree and also a photo of when that tree completely fell down.

I used the branches collected from that tree, making them move when the visitor approached close to them. It was also shown a dried lemon from that tree.

The archive also shows how my parents in Cuba, after the death of the old lemon tree, planted a new lemon tree in their yard. It also shows how I, a few years after escaping from Cuba, decided to start planting new lemon trees, as a way of approach to my family and roots despite distance and exile.

In the installation, I also set up a house-shaped terrarium with the new lemon tree plants.

Sketch 1, Lemon tree archive, Dania González Sanabria







Embedded systems

In the project, were implemented two systems of sensors and actuators controlled by Arduino boards, and programmed in Visual Studio Code and Arduino programs.

Sketch 2, Lemon tree archive, Dania González Sanabria
Sketch 2, Moving Branches, 1rst system. Lemon tree archive, Dania González Sanabria


1rst System:

For the moving branch, it was set a system with an HC-SR04 Ultrasonic Distance Sensor controlling a 15 kg Digital Servo Motor, through an Arduino Nano and a connective board.

When the spectator approaches 60 cm of the branches, the servo motor starts to turn from 0 to 18 degrees, making the branches, attached to it, start to move. If the spectator approaches at a closer distance (40 cm), the servo motor turns from 0 to 58 degrees, making the branches move a little bit more, and slower.

The Servo Motor received an extra supply of energy from an MB-102 3.3V/5V Power Module plugged into electricity and connected to the board of the 2nd System.



“Y de mortales engaños, Y de sublimes dolores”. Dania González Sanabria.“The Plant Plant” exhibition. Winterwerkschau Bauhaus University. 2025.
1st System board setting


1rst System

Devices:

  • Arduino Nano
  • Connective board
  • HC-SR04 Ultrasonic Distance Sensor
  • Miuzei 15 kg Digital Servo Motor
  • Connection cables



(The written code is at the end of the page)




2nd System:

The terrarium had a humidifier system inside. It was made with a Capacitive Soil Moisture Sensor connected to an Arduino Nano and a connective board. When the soil got drier (over value 400 read by that sensor, whose values are approximately this: wet is < 400, dry is > 400), a 5V Relay Module also connected to the board, activated a 5V Humidifier made with a piezoelectric. When the soil got humid again (under value 400) the humidifier stopped until the soil got dry again. The relay and humidifier received an extra supply of energy from an MB-102 3.3V/5V Power Module plugged into electricity.

Sketch 3, Lemon tree archive, Dania González Sanabria
Sketch 3, Terrarium, 2nd System, Lemon tree archive, Dania González Sanabria












2nd System board setting
Photo: Christian Doeller. “Y de mortales engaños, Y de sublimes dolores”. Dania González Sanabria.“The Plant Plant” exhibition. Winterwerkschau Bauhaus University. 2025.
Photo: Christian Doeller


2nd System

Devices:

  • Arduino Nano
  • Connective board
  • Capacitive Soil Moisture Sensor
  • 5V Relay Module
  • 5V Humidifier made with a piezoelectric
  • MB-102 3.3V/5V Power Module
  • Connection cables


(The written code is at the end of the page)



Exhibition

The installation was displayed with a set of mini LED spotlights. Those were connected to a timer that switched the lights on during the daytime and switched the lights off during the nighttime. That created a proper light environment for the tiny lemon trees during the days of the exhibition.

Photo: Christian Doeller
Photo: Christian Doeller. “Y de mortales engaños, Y de sublimes dolores”. Dania González Sanabria.“The Plant Plant” exhibition. Winterwerkschau Bauhaus University. 2025.
Photo: Christian Doeller
Photo: Christian Doeller. “Y de mortales engaños, Y de sublimes dolores”. Dania González Sanabria.“The Plant Plant” exhibition. Winterwerkschau Bauhaus University. 2025.
Photo: Christian Doeller
Photo: Christian Doeller. “Y de mortales engaños, Y de sublimes dolores”. Dania González Sanabria.“The Plant Plant” exhibition. Winterwerkschau Bauhaus University. 2025.
Photo: Christian Doeller










Y de mortales engaños, Y de sublimes dolores” was displayed in the exhibition of the class “The Plant Plant” during the Winterwerkschau of the Bauhaus University Weimar, Germany. Winter Semester 2024 – 2025.





Code

1rts Board:

main.cpp:

#include <Servo.h>

#define TRIG_PIN 2 // Pin Trig ultrasonic sensor

#define ECHO_PIN 3 // Pin Echo ultrasonic sensor

Servo myservo;  

float ang = 18; // Oscilation basic angle

int distanciaPersona = 60;  // first umbral

int distanciaCercana = 40;  // second umbral

void setup() {

Serial.begin(9600);

pinMode(TRIG_PIN, OUTPUT);

pinMode(ECHO_PIN, INPUT);

myservo.attach(9);

}

void loop() {

long duration;

int distance;

// send ultrasonic pulse

digitalWrite(TRIG_PIN, LOW);

delayMicroseconds(2);

digitalWrite(TRIG_PIN, HIGH);

delayMicroseconds(10);

digitalWrite(TRIG_PIN, LOW);

// Read time of reply of eco and calculate distance

duration = pulseIn(ECHO_PIN, HIGH);

distance = duration * 0.034 / 2;  

Serial.print("Distancia: ");

Serial.print(distance);

Serial.println(" cm");

// Event 2: if distance is less than 30 cm, move

if (distance < distanciaCercana) {

  int maxAngulo = ang + 40;  // Increase oscilation range

  if (maxAngulo > 180) maxAngulo = 180; // Limit angle to 180°

  for (int pos = 0; pos <= maxAngulo; pos += 1) {

    myservo.write(pos);

    delay(15);

  }

  for (int pos = maxAngulo; pos >= 0; pos -= 1) {

    myservo.write(pos);

    delay(15);

  }

}

// Evento 1: if distancia is less than 60 cm but more or igual 40 cm

else if (distance < distanciaPersona) {

  for (int pos = 0; pos <= ang; pos += 1) {

    myservo.write(pos);

    delay(15);

  }

  for (int pos = ang; pos >= 0; pos -= 1) {

    myservo.write(pos);

    delay(15);

  }

}

// if no object, set the servo at 0°

else {

  myservo.write(0);

}

delay(500); // Tiny delay before next event

}


2nd Board:

main.cpp:

#include <Arduino.h>

int relay = 2;

void setup() {

  Serial.begin(9600);

  pinMode(relay, OUTPUT);      

  //digitalWrite(2,LOW);      

}

void loop() {

  int val;

  val = analogRead(A0); //CONECT sensor AL Analog 0

Serial.println(val); //print the value to serial port

if (val<400)

{

  Serial.println("desactivado");

   digitalWrite(relay,HIGH);

  } else {

    Serial.println("activado");

    digitalWrite(relay,LOW);

}

  delay(500);

}