Hi there,
just wondered if anyone has been controlling neopixels with pd extended?
I know this is possible with maxmsp amd my arduino, but i'd like to do it in pd.
if anyone can point me in the right direction, greatly appreciated
drew
controlling Neopixels with arduino and pd
Hi there,
just wondered if anyone has been controlling neopixels with pd extended?
I know this is possible with maxmsp amd my arduino, but i'd like to do it in pd.
if anyone can point me in the right direction, greatly appreciated
drew
It depends on what you want to do. Checking the "simple" example from Adafruit (I just googled neopixels and Adafruit showed first, didn't know what neopixels was), I can see that the sketch controls which LED will light up and its RGB values.
If you want to do something like that from Pd, then you should probably send a message to the Arduino of the type:
[print 1l255r100g50b(
where 1 will be the LED (hence the "l" after the value), 255 will be for red, 100 for green and 50 for blue (hence the letters "r", "g", and "b" after each value).
In the Arduino code you can retrieve this the following way. Before the loop() function, set the following three variable:
int red, green, blue;
At the beginning of the loop() function, write the following:
if(Serial.available()){
static int temp_val;
byte in_byte = Serial.read();
if((in_byte >= '0') && (in_byte <= '9'))
temp_val = temp_val * 10 + in_byte - '0';
else if((in_byte >= 'l'){
led = temp_val;
temp_val = 0;
}
else if(in_byte == 'r'){
red = temp_val;
temp_val = 0;
}
else if(in_byte = 'g'){
green = temp_val;
temp_val = 0;
}
else if(in_byte == 'b'){
blue = temp_val;
temp_val = 0;
}
}
Lastly, change line 40 of the "simple" sketch to this:
pixels.setPixelColor(led, pixels.Color(red,green,blue));
this should work, more or less...
@alexandros
thanks! that's great will give it a go and let you know how it goes
Oops! Looks like something went wrong!