Go Down

Topic: Processing and teensy arduino problem (Read 2 times) previous topic - next topic



My rx led light
I work on this problem this week end and a find this:

if i modify the line if (Serial.available()>=4)  by this line if (Serial.available()) on arduino program, my strip led light but i have only white colour (with less variations of smooth colours)
The processing little window show me the dominant colour on the screen

Have you a idea to resolve this problem ? (perhaps to many informations arrive in same time on teensy)

thanks for next answers


I don't understand some of your Processing code:
Code: [Select]
float r=0;
float g=0;
float b=0;

r = r+(int)(255&(pixel>>16)); //add up reds
g = g+(int)(255&(pixel>>8)); //add up greens
b = b+(int)(255&(pixel)); //add up blues

r=r/(684*464); //average red (remember that I skipped ever alternate pixel)
g=g/(684*464); //average green
b=b/(684*464); //average blue

port.write((byte)(r)); //write red value
port.write((byte)(g)); //write green value
port.write((byte)(b)); //write blue value

You are reading integer data, and storing it in floats. Then, you are performing integer arithmetic on floats. Why floats?

There is nothing on the Arduino side to echo what you received. Why not?

There is nothing in the Processing code to collect any replies from the Arduino, and show them. Why not?


thanks for this answer, but these questions are too difficult for me. Im a noob on programmation and i can't explain you the details of the program
I just take exemple on a web site in order to make ambilight. this link

If you want to modify the code ?

thanks for next answers


This untested but, if you add the bottom 3 lines you should see the results of r, g, b on the processing black monitor.

Code: [Select]
port.write((byte)(r)); //write red value
port.write((byte)(g)); //write green value
port.write((byte)(b)); //write blue value

//add next  lines
println((byte)(r)); //print on bottom of processing screen



i have numbers in black window of processing when i run these 3 lines but only with this line in arduino IDE:

but my strip led light in wrong colour, only white with glitter

arduino IDE doesn't like "if(serial.available()>=4);

my port is ok because i see my strip led light.I have usb serial (abstact.....) on windows pheripheral manager. I choose good port on arduino IDE and usb type "Serial".

do you have an other idea?

thanks fot next answer

Go Up