Hi there...
I'm making a home-made led matrix (3x3). I'm processing i made a little routine that draw nine boxes, when you click on a box this one turns to yellow and i wan't that some led turns on.
I began the arduino program with the example of the physical pixel. But, I don't know how to send from Processing to wiring that i want to certain led or leds to be turn on
any guess??
this are the codes
void draw(){
background(175);
for( int i = 0; i < numLeds; i++)
b[i].dibuja();
for( int i = 0; i < numLeds; i++){
b[i].presionado();
if( b[i].daPres() < 0 ){
b[i].actualiza();
port.write('H');
delay(10);
port.write(i);
}
else{
port.write('L');
delay(10);
port.write(i);
}
}
}
and
void setup(){
for(int i = 0; i < numLeds; i++)
pinMode( ledPin[i] , OUTPUT );
Serial.begin(9600);
}
void loop(){
if(Serial.available() ){
val = Serial.read();
delay(5);
led = Serial.read();
}
if( val == 'H')
digitalWrite( int(ledPin[led]), HIGH );
else
digitalWrite( int(ledPin[led]), LOW );
delay(100);
}
thanks