fotosel>sinth, photocell2synth

Ey Sevgili,
bir haftadır Arduino ile oynamaktayım.
bir fotoseli AnalogInput'a bağladım,
ordan akan veriyi Pd'ye |comport| objesi ile aktardım.
bu esnada DigitalOutput'a da bi led bağlı; o led de ışığın şiddetiyle ters orantılı olarak parlama değerinde değişiklik arz ediyor efendim.
fotoselden akan veri pd'de çalıştırdığım bir sinus ve kare dalga osilatörünün frekans değerleri olarak alınıyor.

i've been playing with Arduino during recent days.
i used a photocell to control oscillators frequency, in the mean time, the data, that comes from the AnalogInput, controls the led, which is connected to DigitalOutput of the board.

click and watch the action  /  tıkla - seyret 

Arduino code:

*/

int sensorPin = 0;    // select the input pin for the potentiometer
const int ledPin = 9; // select the pin for the LED
int sensorValue = 0;  // variable to store the value coming from the sensor

void setup() {
  // declare the ledPin as an OUTPUT:
  pinMode(ledPin, OUTPUT); 
  Serial.begin(9600);
}

void loop() {
  byte brightness;
  // read the value from the sensor:
  brightness = analogRead(sensorPin);
  analogWrite(ledPin, brightness);
  Serial.write(brightness);
  delay(30); 
}

Pd code

#N canvas 255 511 500 340 10;
#X obj 290 63 comport 2 9600;
#X msg 292 23 close;
#X obj 137 150 osc~;
#X obj 225 167 square~;
#X obj 162 191 *~;
#X obj 166 241 dac~;
#X obj 262 146 line;
#X msg 264 126 \$1 20;
#X msg 340 22 open 2;
#X obj 266 100 / 15.5;
#X connect 0 0 2 0;
#X connect 0 0 9 0;
#X connect 1 0 0 0;
#X connect 2 0 4 0;
#X connect 3 0 4 1;
#X connect 4 0 5 0;
#X connect 4 0 5 1;
#X connect 6 0 3 0;
#X connect 7 0 6 0;
#X connect 8 0 0 0;
#X connect 9 0 7 0;

Comments

Popular Posts