I have recently bought an arduino to use with PD and I am reletively new to both!
So im struggling with the code for the arduino and how to connect it with PD.
Is anyone able to help?
This is what I am tring to do.
I want and infrared beam to be set up using the arduino so that when the beam is constant and intact there is no signal going to PD however when the beam is broken I want it to trigger a bang in PD setting off the patch I have designed. The patch when triggered plays a series of midi notes in reason. After a delay that I have set at 10 seconds (this can be changed) the patch turns itself off.
SO I want the patch to play the music even though the beam reconnects and then stop after the set time ready for the next time it is broken.
Alternativly i want the beam to reconnect at a set amount of time (say 10 seconds) so that it cant be triggered again untill after the music stops.
Is there anyone doing something similar that can help me out with the arduino code. I dont really understand it properly yet.
This is how far I have got with the arduino code but im not sure if it is right or what I have to do to get the signal to PD.
int ledPin = 13;
int IRpin = 2;
char Patch[] = //i am stuck at this point
void setup()
{
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
pinMode(IRpin, INPUT);
}
void loop()
{
if(digitalRead(IRpin))
{
digitalWrite(ledPin, HIGH);
Serial.print(Patch);
}
else
digitalWrite(ledpin, LOW);
}
Thanks in advance
Tim