GMU:Nach der Natur/Ideen und Konzepte der Teilnehmer/vegancipation: Difference between revisions

From Medien Wiki
No edit summary
Line 74: Line 74:
File:nachnatur_lauraj_veganci12.jpg
File:nachnatur_lauraj_veganci12.jpg
</gallery>
</gallery>
Lights for optimal plant growth were separated in a 2x 12 hour rhythm. First 12 hours was steady light. Another 12 hours the light only turned on once in every 5 minutes - right in the moment a photo was taken. So the plant got a period of nearly complete darkness to retire from growing.
Implemented with Arduino, Processing, a radio switch, a radio transmitter and ControlMyNikon.
Processing Code:
<quote>
import processing.serial.*;
int colour = 0;
boolean sign = false;
Serial port;
void setup(){
//println(Serial.list());
String portName = Serial.list()[0];
port = new Serial(this, portName, 57600);
}
void draw()
{
  fill(colour);
  rect(25,25,50,50);
}
  /*if (hour() < 12) { 
    port.write('H');
    delay(3000);
    port.write('L'); 
    delay(297000);
  }
  if (hour() >= 12) {
    port.write('H');
    delay(1000);
  }*/
//CONTROL BY MOUSE
void mousePressed() {
colour = 200;
port.write('H');
}
void mouseReleased() {
colour = 70;
port.write('L');
}
</quote>
Adruino Code:
<quote>
#include <RCSwitch.h>
int incomingByte;
//int ledPin = 13;
RCSwitch mySwitch = RCSwitch();
void setup()
{
  Serial.begin(57600);
  mySwitch.enableTransmit(10);
}
void loop()
{
  if (Serial.available() > 0)
  {
    incomingByte = Serial.read();
    if (incomingByte == 'H')
    {
      Serial.println("on");
      //digitalWrite(ledPin, HIGH);
      mySwitch.switchOn("01110", 2);
    }
    if (incomingByte == 'L')
    {
      //digitalWrite(ledPin, LOW);
      Serial.println("off");
      mySwitch.switchOff("01110", 2);
    }
  }
}
</quote>