Rebecca Adorno Dávila

| Data Poemas |

Poem written by my brother Felix Adorno, based on the exhibition “Luminaria Onomatopeya”

–auto \Luz t-sql 2017.08.21-FA

use rebeccaDB
declare @human_id int not null,
declare @chord_id int,
declare @strokeStrength_id int,
declare @lightSensitivity_id int,
declare @human_presence bit
set @human_presence = 1
while @human_presence = 1
begin
//selection of minimum and maximum people from table Participants.
select max(human_id) as @human_id
from tblParticipants
//inicializando variable humana
set @human_id = @human_id + 1
insert into tblParticipants(human_id)
values(@human_id)
//resultados temporeros –donde human_id > @Starthuman_id
insert into temp_results(human_id, chord_id, strokeStrength_id, lightSensitivity_id)
values (@human_id, @chord_id, @strokeStrength_id, @lightSensitivity_id)
set @human_presence = (case when @chord_id is not null then 1
else 0
end)
end

//Collected Open Source Data for Luminaria Luminaria Onomatopeya

const int ledPin = 13;      // LED indicador de senal
const int Piezo = A3; //Piezo
const int threshold = 1;  // threshold que decide si el sonido va o no
int sensorReading = 0;      
int ledState = LOW;    
int ListaBlancos []  = {   };
int NivelBlanco;
//int RedLevel, GreenLevel, BlueLevel;
int BlancoActual = 0;
int state = 0;
const int RedPin =    1;  // Pin de Luz Roja
const int GreenPin = 2;  // Pin de Luz Verde
const int BluePin =   3; // Pin de Luz Azul
#define DMX_MAX 128 // max. numero de DMX data packg
uint8_t DMXBuffer[DMX_MAX];
void DMXstart()
{
  // DMX @ 250000 baud serial data
  Serial.begin(25000);
  UCSR0C = (1<<USBS0)|(3<<UCSZ00);
  // inicializa buffer DMX
  for (int n = 0; n < DMX_MAX; n++)
    DMXBuffer[n] = 0;
} // DMXcomienza
void DMXwrite(int channel, uint8_t value)
{
  // parametros para rango
  if (channel < 1) channel = 1;
  if (channel > DMX_MAX) channel = DMX_MAX;
  if (value < 0)   value = 0;
  if (value > 255) value = 255;
  // alamacena valor
  DMXBuffer[channel-1] = value;
} // DMXwrite
void DMXflush()
{
  // enviar break via 0 byte lento
  Serial.begin(125000);
  Serial.write((uint8_t)0);
  // regreso a velocidad DMX: 250000baud
  Serial.begin(250000);
  // write start code
  Serial.write((uint8_t)0);
  // write all the values from the array
  Serial.write(DMXBuffer, sizeof(DMXBuffer));
} // DMXflush
void setup() {
  DMXstart();
  pinMode(ledPin, OUTPUT);
  pinMode(RedPin,   OUTPUT);
  pinMode(GreenPin, OUTPUT);
  pinMode(BluePin,  OUTPUT);
// Serial.begin(9600);      
}
void loop() {
  
  sensorReading = analogRead(Piezo);
  NivelBlanco = ListaBlancos[state];
  if ((sensorReading >= threshold) && (NivelBlanco == BlancoActual)) {
    state += 1;
    ledState = !ledState;
    digitalWrite(ledPin, ledState);
    Serial.println(“cuerda”);
    
    if (state == 6)
      state = 0;
       
  delay(80);
    
  } else {
    if (BlancoActual < NivelBlanco)  BlancoActual++;
    if (BlancoActual > NivelBlanco)  BlancoActual–;
    DMXwrite(1, BlancoActual);
    analogWrite(RedPin, BlancoActual);
    DMXflush();
}
}