CONTROLLING 3 NEOPIXEL RINGS FROM ONE ARDUINO
Moderators: adafruit_support_bill, adafruit

CONTROLLING 3 NEOPIXEL RINGS FROM ONE ARDUINO

by slurry bowl on Mon Apr 07, 2014 12:21 am

I currently utilize one pot and map it in increments of 40 to control the color pattern of a NeoPixel ring 24.

It works great and Im attempting to add two more pots and two more 24LED rings.

Here is my current code for one ring:

Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_NeoPixel.h>

#define PIN 6

Adafruit_NeoPixel strip = Adafruit_NeoPixel(24, PIN, NEO_GRB + NEO_KHZ800);

int potpin = 0;
int potval = 0;

void setup() {
 
  Serial.begin(9600);

  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
  potval = analogRead(potpin);
    Serial.println(potval);

  if ( potval <=40 ) {

//red_half
strip.setPixelColor(0, 255, 0, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 255, 0, 0);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 255, 0, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255, 0, 0);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 255, 0, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 255, 0, 0);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 255, 0, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 255, 0, 0);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 255, 0, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255, 0, 0);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 255, 0, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 255, 0, 0);//22
strip.setPixelColor(23, 0, 0, 0);//23

strip.show();

}   

else if ( potval <= 80){
//red_full
strip.setPixelColor(0, 255, 0, 0);//0
strip.setPixelColor(1, 255, 0, 0);//1
strip.setPixelColor(2, 255, 0, 0);//2
strip.setPixelColor(3, 255, 0, 0);//3
strip.setPixelColor(4, 255, 0, 0);//4
strip.setPixelColor(5, 255, 0, 0);//5
strip.setPixelColor(6, 255, 0, 0);//6
strip.setPixelColor(7, 255, 0, 0);//7
strip.setPixelColor(8, 255, 0, 0);//8
strip.setPixelColor(9, 255, 0, 0);//9
strip.setPixelColor(10, 255, 0, 0);//10
strip.setPixelColor(11, 255, 0, 0);//11
strip.setPixelColor(12, 255, 0, 0);//12
strip.setPixelColor(13, 255, 0, 0);//13
strip.setPixelColor(14, 255, 0, 0);//14
strip.setPixelColor(15, 255, 0, 0);//15
strip.setPixelColor(16, 255, 0, 0);//16
strip.setPixelColor(17, 255, 0, 0);//17
strip.setPixelColor(18, 255, 0, 0);//18
strip.setPixelColor(19, 255, 0, 0);//19
strip.setPixelColor(20, 255, 0, 0);//20
strip.setPixelColor(21, 255, 0, 0);//21
strip.setPixelColor(22, 255, 0, 0);//22
strip.setPixelColor(23, 255, 0, 0);//23
 
strip.show();

}

else if ( potval <= 120) {
//blue_half 
strip.setPixelColor(0, 0, 0,255 );//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 0, 0, 255);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 0, 255);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 0, 0, 255);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 0, 255);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 0, 0, 255);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0, 0, 255);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 0, 0, 255);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 0, 255);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 0, 0, 255);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 0, 255);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 0, 0, 255);//22
strip.setPixelColor(23, 0, 0, 0);//23

strip.show();

}

 else if ( potval <= 160)
 {
//blue_full   
strip.setPixelColor(0, 0, 0,255 );//0
strip.setPixelColor(1, 0, 0,255);//1
strip.setPixelColor(2, 0, 0, 255);//2
strip.setPixelColor(3,0, 0,255);//3
strip.setPixelColor(4, 0, 0, 255);//4
strip.setPixelColor(5,0, 0,255);//5
strip.setPixelColor(6, 0, 0, 255);//6
strip.setPixelColor(7, 0, 0,255);//7
strip.setPixelColor(8, 0, 0, 255);//8
strip.setPixelColor(9, 0, 0,255);//9
strip.setPixelColor(10, 0, 0, 255);//10
strip.setPixelColor(11, 0, 0,255);//11
strip.setPixelColor(12, 0, 0, 255);//12
strip.setPixelColor(13, 0, 0,255);//13
strip.setPixelColor(14, 0, 0, 255);//14
strip.setPixelColor(15, 0, 0,255);//15
strip.setPixelColor(16, 0, 0, 255);//16
strip.setPixelColor(17, 0, 0,255);//17
strip.setPixelColor(18, 0, 0, 255);//18
strip.setPixelColor(19, 0, 0,255);//19
strip.setPixelColor(20, 0, 0, 255);//20
strip.setPixelColor(21, 0, 0,255);//21
strip.setPixelColor(22, 0, 0, 255);//22
strip.setPixelColor(23, 0, 0, 255);//23

strip.show();

}
   
   else if ( potval <= 200){
//green_half   
strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 0, 255, 0);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 255, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 0, 255, 0);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 0, 255, 0);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0, 255, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 0, 255, 0);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 255, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 0, 255, 0);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 255, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 0, 255, 0);//22
strip.setPixelColor(23, 0, 0, 0);//23

strip.show();

}
 
 else if ( potval <= 240){
//green_full
strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 0, 255, 0);//1
strip.setPixelColor(2, 0, 255, 0);//2
strip.setPixelColor(3, 0, 255, 0);//3
strip.setPixelColor(4, 0, 255, 0);//4
strip.setPixelColor(5, 0, 255, 0);//5
strip.setPixelColor(6, 0, 255, 0);//6
strip.setPixelColor(7, 0, 255, 0);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 0, 255, 0);//9
strip.setPixelColor(10, 0, 255, 0);//10
strip.setPixelColor(11, 0, 255, 0);//11
strip.setPixelColor(12, 0, 255, 0);//12
strip.setPixelColor(13, 0, 255, 0);//13
strip.setPixelColor(14, 0, 255, 0);//14
strip.setPixelColor(15, 0, 255, 0);//15
strip.setPixelColor(16, 0, 255, 0);//16
strip.setPixelColor(17, 0, 255, 0);//17
strip.setPixelColor(18, 0, 255, 0);//18
strip.setPixelColor(19, 0, 255, 0);//19
strip.setPixelColor(20, 0, 255, 0);//20
strip.setPixelColor(21, 0, 255, 0);//21
strip.setPixelColor(22, 0, 255, 0);//22
strip.setPixelColor(23, 0, 255, 0);//23

strip.show();

}

else if ( potval <= 300)
{
//green/blue_half
strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 0, 0, 255);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 255, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 0, 0, 255);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 0, 0, 255);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0, 255, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 0, 0, 255);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 255, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 0, 0, 255);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 255, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 0, 0, 255);//22
strip.setPixelColor(23, 0, 0, 0);//23 

strip.show();

}

else if ( potval <= 340){
//green/blue_full
strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 0,0, 255);//1
strip.setPixelColor(2, 0, 255, 0);//2
strip.setPixelColor(3, 0, 0, 255);//3
strip.setPixelColor(4, 0, 255, 0);//4
strip.setPixelColor(5, 0, 0, 255);//5
strip.setPixelColor(6, 0, 255, 0);//6
strip.setPixelColor(7, 0, 0, 255);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 0, 0, 255);//9
strip.setPixelColor(10, 0, 255, 0);//10
strip.setPixelColor(11, 0, 0, 255);//11
strip.setPixelColor(12, 0, 255, 0);//12
strip.setPixelColor(13, 0, 0, 255);//13
strip.setPixelColor(14, 0, 255, 0);//14
strip.setPixelColor(15, 0, 0, 255);//15
strip.setPixelColor(16, 0, 255, 0);//16
strip.setPixelColor(17, 0, 0, 255);//17
strip.setPixelColor(18, 0, 255, 0);//18
strip.setPixelColor(19, 0, 0, 255);//19
strip.setPixelColor(20, 0, 255, 0);//20
strip.setPixelColor(21, 0, 0, 255);//21
strip.setPixelColor(22, 0, 255, 0);//22
strip.setPixelColor(23, 0, 0, 255);//23

strip.show();

}

else if ( potval <= 380)
{
//green/red_half
strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 255, 0, 0);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 255, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255,0, 0);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 255, 0, 0);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0,255, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 255, 0, 0);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 255, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255, 0, 0);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 255, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 255, 0, 0);//22
strip.setPixelColor(23, 0, 0, 0);//23 


strip.show();

}

else if ( potval <= 420){
//green/red_full
strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 255, 0, 0);//1
strip.setPixelColor(2, 0, 255, 0);//2
strip.setPixelColor(3, 255, 0, 0);//3
strip.setPixelColor(4, 0, 255, 0);//4
strip.setPixelColor(5, 255, 0, 0);//5
strip.setPixelColor(6, 0, 255, 0);//6
strip.setPixelColor(7, 255, 0, 0);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 255, 0, 0);//9
strip.setPixelColor(10, 0, 255, 0);//10
strip.setPixelColor(11, 255, 0, 0);//11
strip.setPixelColor(12, 0, 255, 0);//12
strip.setPixelColor(13, 255, 0, 0);//13
strip.setPixelColor(14, 0, 255, 0);//14
strip.setPixelColor(15, 255, 0, 0);//15
strip.setPixelColor(16, 0, 255, 0);//16
strip.setPixelColor(17, 255, 0, 0);//17
strip.setPixelColor(18, 0, 255, 0);//18
strip.setPixelColor(19, 255, 0, 0);//19
strip.setPixelColor(20, 0, 255, 0);//20
strip.setPixelColor(21, 255, 0, 0);//21
strip.setPixelColor(22, 0, 255, 0);//22
strip.setPixelColor(23, 255, 0, 0);//23

strip.show();

}

else if ( potval <= 460){
//green/magneta_half
 strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 255, 0, 255);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 255, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255,0, 255);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 255, 0, 255);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0,255, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 255, 0, 255);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 255, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255, 0, 255);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 255, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 255, 0, 255);//22
strip.setPixelColor(23, 0, 0, 0);//23   

strip.show();

}

else if ( potval <= 500){
//green/magenta_full
strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 255, 0, 255);//1
strip.setPixelColor(2, 0, 255, 0);//2
strip.setPixelColor(3, 255, 0, 255);//3
strip.setPixelColor(4, 0, 255, 0);//4
strip.setPixelColor(5, 255, 0, 255);//5
strip.setPixelColor(6, 0, 255, 0);//6
strip.setPixelColor(7, 255, 0, 255);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 255, 0, 255);//9
strip.setPixelColor(10, 0, 255, 0);//10
strip.setPixelColor(11, 255, 0, 255);//11
strip.setPixelColor(12, 0, 255, 0);//12
strip.setPixelColor(13, 255, 0, 255);//13
strip.setPixelColor(14, 0, 255, 0);//14
strip.setPixelColor(15, 255, 0, 255);//15
strip.setPixelColor(16, 0, 255, 0);//16
strip.setPixelColor(17, 255, 0, 255);//17
strip.setPixelColor(18, 0, 255, 0);//18
strip.setPixelColor(19, 255, 0, 255);//19
strip.setPixelColor(20, 0, 255, 0);//20
strip.setPixelColor(21, 255, 0, 255);//21
strip.setPixelColor(22, 0, 255, 0);//22
strip.setPixelColor(23, 255, 0, 255);//23

strip.show();

}

else if ( potval <= 540){
//green/magenta_quarter
strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 0, 0, 0);//2
strip.setPixelColor(3, 255, 0, 255);//3
strip.setPixelColor(4, 0, 0, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 0, 255, 0);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 0, 0);//8
strip.setPixelColor(9, 255, 0, 255);//9
strip.setPixelColor(10, 0, 0, 0);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0, 255, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 0, 0, 0);//14
strip.setPixelColor(15, 255, 0, 255);//15
strip.setPixelColor(16, 0, 0, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 0, 255, 0);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 0, 0);//20
strip.setPixelColor(21, 255, 0, 255);//21
strip.setPixelColor(22, 0, 0, 0);//22
strip.setPixelColor(23, 0, 0, 0);//23

strip.show();

}

else if ( potval <= 600){
//blue/magenta_half
strip.setPixelColor(0, 0, 0, 255);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 255, 0, 255);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 0, 255);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255,0, 255);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 0, 255);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 255, 0, 255);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0, 0, 255);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 255, 0, 255);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 0, 255);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255, 0, 255);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 0, 255);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 255, 0, 255);//22
strip.setPixelColor(23, 0, 0, 0);//23   
 


strip.show();

}

else if ( potval <= 640){
//blue/magenta_full
strip.setPixelColor(0, 0, 0, 255);//0
strip.setPixelColor(1, 255, 0, 255);//1
strip.setPixelColor(2, 0, 0,255);//2
strip.setPixelColor(3, 255, 0, 255);//3
strip.setPixelColor(4, 0, 0, 255);//4
strip.setPixelColor(5, 255, 0, 255);//5
strip.setPixelColor(6, 0, 0, 255);//6
strip.setPixelColor(7, 255, 0, 255);//7
strip.setPixelColor(8, 0, 0, 255);//8
strip.setPixelColor(9, 255, 0, 255);//9
strip.setPixelColor(10, 0, 0, 255);//10
strip.setPixelColor(11, 255, 0, 255);//11
strip.setPixelColor(12, 0, 0, 255);//12
strip.setPixelColor(13, 255, 0, 255);//13
strip.setPixelColor(14, 0, 0, 255);//14
strip.setPixelColor(15, 255, 0, 255);//15
strip.setPixelColor(16, 0, 0, 255);//16
strip.setPixelColor(17, 255, 0, 255);//17
strip.setPixelColor(18, 0,0, 255);//18
strip.setPixelColor(19, 255, 0, 255);//19
strip.setPixelColor(20, 0, 0, 255);//20
strip.setPixelColor(21, 255, 0, 255);//21
strip.setPixelColor(22, 0, 0, 255);//22
strip.setPixelColor(23, 255, 0, 255);//23


strip.show();

}

else if ( potval <= 700){
//red/magenta_half
strip.setPixelColor(0, 255, 0, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 255, 0, 255);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 255, 0, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255,0, 255);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 255, 0, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 255, 0, 255);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 255, 0, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 255, 0, 255);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 255, 0, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255, 0, 255);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 255, 0, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 255, 0, 255);//22
strip.setPixelColor(23, 0, 0, 0);//23   
   

strip.show();

}

else if ( potval >740){
//red/blue_half
strip.setPixelColor(0, 255, 0, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 0, 255,0);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 0, 255);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255, 0, 0);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 0, 0, 255);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 255, 0, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 0, 255, 0);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 0, 255);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255,0, 0);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 255, 0, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 0, 255, 0);//22
strip.setPixelColor(23,0, 0, 0);//23

strip.show();

}

else if ( potval <= 780){
//red/green/blue_full
strip.setPixelColor(0, 255, 0, 0);
strip.setPixelColor(1, 0, 255, 0);
strip.setPixelColor(2, 0, 0,255);
strip.setPixelColor(3, 255, 0, 0);
strip.setPixelColor(4, 0, 255, 0);
strip.setPixelColor(5, 0, 0, 255);
strip.setPixelColor(6, 255, 0, 0);
strip.setPixelColor(7, 0, 255, 0);
strip.setPixelColor(8, 0, 0, 255);
strip.setPixelColor(9, 255, 0, 0);
strip.setPixelColor(10,0 , 255, 0);
strip.setPixelColor(11, 0, 0, 255);
strip.setPixelColor(12, 255, 0, 0);
strip.setPixelColor(13, 0, 255, 0);
strip.setPixelColor(14, 0, 0, 255);
strip.setPixelColor(15, 255, 0, 0);
strip.setPixelColor(16, 0, 255, 0);
strip.setPixelColor(17, 255, 0, 0);
strip.setPixelColor(18, 0, 255, 0);
strip.setPixelColor(19, 0, 0, 255);
strip.setPixelColor(20, 255, 0, 0);
strip.setPixelColor(21, 0, 255, 0);
strip.setPixelColor(22, 0, 0, 255);
strip.setPixelColor(23, 255, 0, 0);
 

strip.show();

}





}

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
    }
    strip.show();
    delay(20);
  }
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}
 

What would be the easiest way to bring in two more pots for a total of 3 (ANALOG IN 1,2,3)
 and Data outs (1,2,3)

Any advice appreciated.

BTW.....New forum and site look great. VERY CLEANNNNN





 






What would be the easiest way to bring in two more pots for a total of 3 (ANALOG IN 1,2,3)
and Data outs (1,2,3)

Any advice appreciated.

BTW.....New forum and site look great. VERY CLEANNNNN
slurry bowl
 
Posts: 122
Joined: Sun Nov 11, 2012 6:37 pm

Re: CONTROLLING 3 NEOPIXEL RINGS FROM ONE ARDUINO

by adafruit_support_bill on Mon Apr 07, 2014 6:47 am

What would be the easiest way to bring in two more pots for a total of 3 (ANALOG IN 1,2,3)
and Data outs (1,2,3)

That all depends on what you want the extra pots and rings to do. I'd probably start by trying to simplify what you have there. It is quite repetitive, and if there is one thing computers are good at, it is simplifying repetitive tasks. For example:

Code: Select all | TOGGLE FULL SIZE
  if ( potval <=40 ) {

//red_half
strip.setPixelColor(0, 255, 0, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 255, 0, 0);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 255, 0, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255, 0, 0);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 255, 0, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 255, 0, 0);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 255, 0, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 255, 0, 0);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 255, 0, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255, 0, 0);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 255, 0, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 255, 0, 0);//22
strip.setPixelColor(23, 0, 0, 0);//23

strip.show();

}   


could be replaced with a 'for loop' to reduce that to:
Code: Select all | TOGGLE FULL SIZE
  if ( potval <=40 ) {

//red_half
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 255, 0, 0);//0
strip.setPixelColor(i+1, 0, 0, 0);//1
strip.show();

}   


http://arduino.cc/en/Reference/for
And if you were to turn that into a function, you could call it with different colors to replace all the other 'half-on' cases in your code.
User avatar
adafruit_support_bill
 
Posts: 30120
Joined: Sat Feb 07, 2009 10:11 am

Re: CONTROLLING 3 NEOPIXEL RINGS FROM ONE ARDUINO

by slurry bowl on Mon Apr 07, 2014 9:34 pm

Thanks for the insight.

I took your advice and replaced all my clean 50/50 ring splits with your for loop. Thanks

Here is that code:
Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_NeoPixel.h>

#define PIN 6

Adafruit_NeoPixel strip = Adafruit_NeoPixel(24, PIN, NEO_GRB + NEO_KHZ800);

int potpin = 0;
int potval = 0;

void setup() {
 
  Serial.begin(9600);

  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
    potval = analogRead(potpin);
    Serial.println(potval);

    if ( potval <=40 ) {

//red_half
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 255, 0, 0);//0
strip.setPixelColor(i+1, 0, 0, 0);//1
strip.show();

}   

strip.show();

}   

else if ( potval <= 80){
//red_full
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 255, 0, 0);//0
strip.setPixelColor(i+1, 255, 0, 0);//1
strip.show();

}   
 
strip.show();

}

else if ( potval <= 120) {
//blue_half 
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 0, 0, 255);//0
strip.setPixelColor(i+1, 0, 0, 0);//1
strip.show();

}   

strip.show();

}

 else if ( potval <= 160)
 {
//blue_full   
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 0, 0, 255);//0
strip.setPixelColor(i+1, 0, 0, 255);//1
strip.show();

}   

strip.show();

}
   
   else if ( potval <= 200){
//green_half   
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 0, 255, 0);//0
strip.setPixelColor(i+1, 0, 0, 0);//1
strip.show();

}   

strip.show();

}
 
 else if ( potval <= 240){
//green_full
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 0, 255, 0);//0
strip.setPixelColor(i+1, 0, 255, 0);//1
strip.show();

}   

strip.show();

}

else if ( potval <= 300)
{
//green/blue_half
strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 0, 0, 255);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 255, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 0, 0, 255);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 0, 0, 255);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0, 255, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 0, 0, 255);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 255, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 0, 0, 255);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 255, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 0, 0, 255);//22
strip.setPixelColor(23, 0, 0, 0);//23 

strip.show();

}

else if ( potval <= 340){
//green/blue_full
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 255, 0, 0);//0
strip.setPixelColor(i+1, 0, 255, 0);//1
strip.show();

}   

strip.show();

}

else if ( potval <= 380)
{
//green/red_half
strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 255, 0, 0);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 255, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255,0, 0);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 255, 0, 0);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0,255, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 255, 0, 0);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 255, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255, 0, 0);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 255, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 255, 0, 0);//22
strip.setPixelColor(23, 0, 0, 0);//23 


strip.show();

}

else if ( potval <= 420){
//green/red_full
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 0, 255, 0);//0
strip.setPixelColor(i+1, 255, 0, 0);//1
strip.show();

}   

strip.show();

}

else if ( potval <= 460){
//green/magneta_half
 strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 255, 0, 255);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 255, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255,0, 255);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 255, 0, 255);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0,255, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 255, 0, 255);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 255, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255, 0, 255);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 255, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 255, 0, 255);//22
strip.setPixelColor(23, 0, 0, 0);//23   

strip.show();

}

else if ( potval <= 500){
//green/magenta_full
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 0, 255, 0);//0
strip.setPixelColor(i+1, 255, 0, 255);//1
strip.show();

}   

strip.show();

}

else if ( potval <= 540){
//green/magenta_quarter
strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 0, 0, 0);//2
strip.setPixelColor(3, 255, 0, 255);//3
strip.setPixelColor(4, 0, 0, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 0, 255, 0);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 0, 0);//8
strip.setPixelColor(9, 255, 0, 255);//9
strip.setPixelColor(10, 0, 0, 0);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0, 255, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 0, 0, 0);//14
strip.setPixelColor(15, 255, 0, 255);//15
strip.setPixelColor(16, 0, 0, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 0, 255, 0);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 0, 0);//20
strip.setPixelColor(21, 255, 0, 255);//21
strip.setPixelColor(22, 0, 0, 0);//22
strip.setPixelColor(23, 0, 0, 0);//23

strip.show();

}

else if ( potval <= 600){
//blue/magenta_half
strip.setPixelColor(0, 0, 0, 255);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 255, 0, 255);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 0, 255);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255,0, 255);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 0, 255);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 255, 0, 255);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0, 0, 255);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 255, 0, 255);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 0, 255);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255, 0, 255);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 0, 255);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 255, 0, 255);//22
strip.setPixelColor(23, 0, 0, 0);//23   
 


strip.show();

}

else if ( potval <= 640){
//blue/magenta_full
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 0, 0, 255);//0
strip.setPixelColor(i+1, 255, 0, 255);//1
strip.show();



strip.show();

}
}
else if ( potval <= 700) {
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 255, 0, 255);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 255, 0, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255,0, 255);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 255, 0, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 255, 0, 255);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 255, 0, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 255, 0, 255);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 255, 0, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255, 0, 255);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 255, 0, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 255, 0, 255);//22
strip.setPixelColor(23, 0, 0, 0);//23   
   

strip.show();

}

else if ( potval >740){
//red/blue_half
strip.setPixelColor(0, 255, 0, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 0, 255,0);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 0, 255);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255, 0, 0);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 0, 0, 255);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 255, 0, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 0, 255, 0);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 0, 255);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255,0, 0);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 255, 0, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 0, 255, 0);//22
strip.setPixelColor(23,0, 0, 0);//23

strip.show();

}

else if ( potval <= 780){
//red/green/blue_full
strip.setPixelColor(0, 255, 0, 0);
strip.setPixelColor(1, 0, 255, 0);
strip.setPixelColor(2, 0, 0,255);
strip.setPixelColor(3, 255, 0, 0);
strip.setPixelColor(4, 0, 255, 0);
strip.setPixelColor(5, 0, 0, 255);
strip.setPixelColor(6, 255, 0, 0);
strip.setPixelColor(7, 0, 255, 0);
strip.setPixelColor(8, 0, 0, 255);
strip.setPixelColor(9, 255, 0, 0);
strip.setPixelColor(10,0 , 255, 0);
strip.setPixelColor(11, 0, 0, 255);
strip.setPixelColor(12, 255, 0, 0);
strip.setPixelColor(13, 0, 255, 0);
strip.setPixelColor(14, 0, 0, 255);
strip.setPixelColor(15, 255, 0, 0);
strip.setPixelColor(16, 0, 255, 0);
strip.setPixelColor(17, 255, 0, 0);
strip.setPixelColor(18, 0, 255, 0);
strip.setPixelColor(19, 0, 0, 255);
strip.setPixelColor(20, 255, 0, 0);
strip.setPixelColor(21, 0, 255, 0);
strip.setPixelColor(22, 0, 0, 255);
strip.setPixelColor(23, 255, 0, 0);
 

strip.show();

}





}

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
    }
    strip.show();
    delay(20);
  }
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}
 






 



I researched how to write a function. Say I was to write a function called: green/magenta_full

would it look like this:

Code: Select all | TOGGLE FULL SIZE
void green/magenta ( potval <= 500)
{

for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 0, 255, 0);//0
strip.setPixelColor(i+1, 255, 0, 255);//1
strip.show();



I would place this below void loop and within void loop I can simply call

Code: Select all | TOGGLE FULL SIZE
strip.setPixelColor(magenta)


??

Also...
To answer your question.

The other two pots and rings I want to perform exactly the same as the first original pot, except send the data out a different pin so in total I would control 3 separate rings from 3 pins (1,2,3) with each getting their assignments from 3 separate pots(1,2,3) .

THANKS
slurry bowl
 
Posts: 122
Joined: Sun Nov 11, 2012 6:37 pm

Re: CONTROLLING 3 NEOPIXEL RINGS FROM ONE ARDUINO

by adafruit_support_bill on Tue Apr 08, 2014 6:06 am

Your function syntax is not right:

Code: Select all | TOGGLE FULL SIZE
void green/magenta ( potval <= 500)  //<--- This is not a valid function declaration.
{

for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 0, 255, 0);//0
strip.setPixelColor(i+1, 255, 0, 255);//1
strip.show();
                               //<---------------- And you are missing two closing braces "}".  The braces MUST be balanced.  For every "{" there must be a "}"



Something like this should work.
Code: Select all | TOGGLE FULL SIZE
void green_magenta()
{
   for (int i = 0; i < 24; i += 2)
   {
      strip.setPixelColor(i, 0, 255, 0);//0
      strip.setPixelColor(i+1, 255, 0, 255);//1
      strip.show();
   }
}
User avatar
adafruit_support_bill
 
Posts: 30120
Joined: Sat Feb 07, 2009 10:11 am

Re: CONTROLLING 3 NEOPIXEL RINGS FROM ONE ARDUINO

by slurry bowl on Thu Apr 10, 2014 12:31 am

Ah, I see. Thank You.
As I understand it, when I declare a function below the void loop, I am providing a means to simplify my code.....so in this case

every time I state:
Code: Select all | TOGGLE FULL SIZE
strip.setPixelColor(green_magenta);


It will look to my declared function and use that information.

With this in mind. What must I do to control 3 rings from three potentiometers, all referencing the same color patterns/functions?

I assume I must declare the three strips, maybe by doing this?:


Code: Select all | TOGGLE FULL SIZE
#define PIN 1
#define PIN 2
#define PIN 3

Adafruit_NeoPixel strip = Adafruit_NeoPixel_1(24, PIN 1, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip = Adafruit_NeoPixel_2(24, PIN 2, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip = Adafruit_NeoPixel_3(24, PIN 3, NEO_GRB + NEO_KHZ800);


any advice greatly appreciated.
Last edited by adafruit_support_bill on Thu Apr 10, 2014 5:39 am, edited 1 time in total.
Reason: fixed code tags
slurry bowl
 
Posts: 122
Joined: Sun Nov 11, 2012 6:37 pm

Re: CONTROLLING 3 NEOPIXEL RINGS FROM ONE ARDUINO

by adafruit_support_bill on Thu Apr 10, 2014 7:21 am

I assume I must declare the three strips, maybe by doing this?:

Yes. That looks right.

The other two pots and rings I want to perform exactly the same as the first original pot, except send the data out a different pin so in total I would control 3 separate rings from 3 pins (1,2,3) with each getting their assignments from 3 separate pots(1,2,3) .

So replicate your code, substituting Adafruit_NeoPixel_1, Adafruit_NeoPixel_2 or Adafruit_NeoPixel_3 and the Pot1, Pot2 and Pot3 readings as appropriate.

(That is why I suggested consolidating your code into functions first. In addition to saving memory, it makes it a lot easier to replicate and change things when there are fewer lines of code.)
User avatar
adafruit_support_bill
 
Posts: 30120
Joined: Sat Feb 07, 2009 10:11 am

Re: CONTROLLING 3 NEOPIXEL RINGS FROM ONE ARDUINO

by slurry bowl on Sat Apr 12, 2014 12:25 am

IMG_3671.JPG
IMG_3671.JPG (592.02 KiB) Viewed 394 times
Thanks Bill,

I appreciate your giving me heads up regarding functions as an efficient way to write my code.

Before I delve into writing too many functions, I need to wrap my head around what parts of the setup I need to tweak so that 3 individual rings are acknowledged and addressable. As well as 3 pot pins and 3 pot variables.

I have tried a variety of arrangements and keep getting error messages reporting.....expected primary-expression before '(' token. Or something similar.

This code is my best attempt to write a setup for 3 addressable rings and Im just missing something....any input or advice is VERY appreciated.

Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_NeoPixel.h>

#define PIN_1
#define PIN_2
#define PIN_3

Adafruit_NeoPixel strip_1 = Adafruit_NeoPixel(24, PIN_1, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip_2 = Adafruit_NeoPixel(24, PIN_2, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip_3 = Adafruit_NeoPixel(24, PIN_3, NEO_GRB + NEO_KHZ800);

int potpin_1 = 0;
int potpin_2 = 0;
int potpin_3 = 0;

int potval_1 = 0;
int potval_2 = 0;
int potval_3 = 0;


void setup() {
 
  Serial.begin(9600);

  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
    potval_1 = analogRead(potpin_1);
    potval_2 = analogRead(potpin_2);
    potval_3 = analogRead(potpin_3);

    Serial.println(potval);

    if ( potval_1 <=40 ) {

//red_half
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 255, 0, 0);//0
strip.setPixelColor(i+1, 0, 0, 0);//1
strip.show();

}   

strip.show();

}   

else if ( potval <= 80){
//red_full
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 255, 0, 0);//0
strip.setPixelColor(i+1, 255, 0, 0);//1
strip.show();

}   
 
strip.show();

}

else if ( potval <= 120) {
//blue_half 
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 0, 0, 255);//0
strip.setPixelColor(i+1, 0, 0, 0);//1
strip.show();

}   

strip.show();

}

 else if ( potval <= 160)
 {
//blue_full   
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 0, 0, 255);//0
strip.setPixelColor(i+1, 0, 0, 255);//1
strip.show();

}   

strip.show();

}
   
   else if ( potval <= 200){
//green_half   
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 0, 255, 0);//0
strip.setPixelColor(i+1, 0, 0, 0);//1
strip.show();

}   

strip.show();

}
 
 else if ( potval <= 240){
//green_full
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 0, 255, 0);//0
strip.setPixelColor(i+1, 0, 255, 0);//1
strip.show();

}   

strip.show();

}

else if ( potval <= 300)
{
//green/blue_half
strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 0, 0, 255);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 255, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 0, 0, 255);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 0, 0, 255);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0, 255, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 0, 0, 255);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 255, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 0, 0, 255);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 255, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 0, 0, 255);//22
strip.setPixelColor(23, 0, 0, 0);//23 

strip.show();

}

else if ( potval <= 340){
//green/blue_full
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 255, 0, 0);//0
strip.setPixelColor(i+1, 0, 255, 0);//1
strip.show();

}   

strip.show();

}

else if ( potval <= 380)
{
//green/red_half
strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 255, 0, 0);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 255, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255,0, 0);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 255, 0, 0);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0,255, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 255, 0, 0);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 255, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255, 0, 0);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 255, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 255, 0, 0);//22
strip.setPixelColor(23, 0, 0, 0);//23 


strip.show();

}

else if ( potval <= 420){
//green/red_full
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 0, 255, 0);//0
strip.setPixelColor(i+1, 255, 0, 0);//1
strip.show();

}   

strip.show();

}

else if ( potval <= 460){
//green/magneta_half
 strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 255, 0, 255);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 255, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255,0, 255);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 255, 0, 255);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0,255, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 255, 0, 255);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 255, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255, 0, 255);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 255, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 255, 0, 255);//22
strip.setPixelColor(23, 0, 0, 0);//23   

strip.show();

}

else if ( potval <= 500){
//green/magenta_full
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 0, 255, 0);//0
strip.setPixelColor(i+1, 255, 0, 255);//1
strip.show();

}   

strip.show();

}

else if ( potval <= 540){
//green/magenta_quarter
strip.setPixelColor(0, 0, 255, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 0, 0, 0);//2
strip.setPixelColor(3, 255, 0, 255);//3
strip.setPixelColor(4, 0, 0, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 0, 255, 0);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 0, 0);//8
strip.setPixelColor(9, 255, 0, 255);//9
strip.setPixelColor(10, 0, 0, 0);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0, 255, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 0, 0, 0);//14
strip.setPixelColor(15, 255, 0, 255);//15
strip.setPixelColor(16, 0, 0, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 0, 255, 0);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 0, 0);//20
strip.setPixelColor(21, 255, 0, 255);//21
strip.setPixelColor(22, 0, 0, 0);//22
strip.setPixelColor(23, 0, 0, 0);//23

strip.show();

}

else if ( potval <= 600){
//blue/magenta_half
strip.setPixelColor(0, 0, 0, 255);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 255, 0, 255);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 0, 255);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255,0, 255);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 0, 255);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 255, 0, 255);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 0, 0, 255);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 255, 0, 255);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 0, 255);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255, 0, 255);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 0, 0, 255);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 255, 0, 255);//22
strip.setPixelColor(23, 0, 0, 0);//23   
 


strip.show();

}

else if ( potval <= 640){
//blue/magenta_full
for (int i = 0; i < 24; i += 2)
{
strip.setPixelColor(i, 0, 0, 255);//0
strip.setPixelColor(i+1, 255, 0, 255);//1
strip.show();



strip.show();

}
}
else if ( potval <= 700) {
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 255, 0, 255);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 255, 0, 0);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255,0, 255);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 255, 0, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 255, 0, 255);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 255, 0, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 255, 0, 255);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 255, 0, 0);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255, 0, 255);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 255, 0, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 255, 0, 255);//22
strip.setPixelColor(23, 0, 0, 0);//23   
   

strip.show();

}

else if ( potval >740){
//red/blue_half
strip.setPixelColor(0, 255, 0, 0);//0
strip.setPixelColor(1, 0, 0, 0);//1
strip.setPixelColor(2, 0, 255,0);//2
strip.setPixelColor(3, 0, 0, 0);//3
strip.setPixelColor(4, 0, 0, 255);//4
strip.setPixelColor(5, 0, 0, 0);//5
strip.setPixelColor(6, 255, 0, 0);//6
strip.setPixelColor(7, 0, 0, 0);//7
strip.setPixelColor(8, 0, 255, 0);//8
strip.setPixelColor(9, 0, 0, 0);//9
strip.setPixelColor(10, 0, 0, 255);//10
strip.setPixelColor(11, 0, 0, 0);//11
strip.setPixelColor(12, 255, 0, 0);//12
strip.setPixelColor(13, 0, 0, 0);//13
strip.setPixelColor(14, 0, 255, 0);//14
strip.setPixelColor(15, 0, 0, 0);//15
strip.setPixelColor(16, 0, 0, 255);//16
strip.setPixelColor(17, 0, 0, 0);//17
strip.setPixelColor(18, 255,0, 0);//18
strip.setPixelColor(19, 0, 0, 0);//19
strip.setPixelColor(20, 255, 0, 0);//20
strip.setPixelColor(21, 0, 0, 0);//21
strip.setPixelColor(22, 0, 255, 0);//22
strip.setPixelColor(23,0, 0, 0);//23

strip.show();

}

else if ( potval <= 780){
//red/green/blue_full
strip.setPixelColor(0, 255, 0, 0);
strip.setPixelColor(1, 0, 255, 0);
strip.setPixelColor(2, 0, 0,255);
strip.setPixelColor(3, 255, 0, 0);
strip.setPixelColor(4, 0, 255, 0);
strip.setPixelColor(5, 0, 0, 255);
strip.setPixelColor(6, 255, 0, 0);
strip.setPixelColor(7, 0, 255, 0);
strip.setPixelColor(8, 0, 0, 255);
strip.setPixelColor(9, 255, 0, 0);
strip.setPixelColor(10,0 , 255, 0);
strip.setPixelColor(11, 0, 0, 255);
strip.setPixelColor(12, 255, 0, 0);
strip.setPixelColor(13, 0, 255, 0);
strip.setPixelColor(14, 0, 0, 255);
strip.setPixelColor(15, 255, 0, 0);
strip.setPixelColor(16, 0, 255, 0);
strip.setPixelColor(17, 255, 0, 0);
strip.setPixelColor(18, 0, 255, 0);
strip.setPixelColor(19, 0, 0, 255);
strip.setPixelColor(20, 255, 0, 0);
strip.setPixelColor(21, 0, 255, 0);
strip.setPixelColor(22, 0, 0, 255);
strip.setPixelColor(23, 255, 0, 0);
 

strip.show();

}





}

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
    }
    strip.show();
    delay(20);
  }
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}
 






 





Here is a picture of the project
slurry bowl
 
Posts: 122
Joined: Sun Nov 11, 2012 6:37 pm

Re: CONTROLLING 3 NEOPIXEL RINGS FROM ONE ARDUINO

by adafruit_support_bill on Sat Apr 12, 2014 6:49 am

You have defined these three strips:
Code: Select all | TOGGLE FULL SIZE
Adafruit_NeoPixel strip_1 = Adafruit_NeoPixel(24, PIN_1, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip_2 = Adafruit_NeoPixel(24, PIN_2, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip_3 = Adafruit_NeoPixel(24, PIN_3, NEO_GRB + NEO_KHZ800);


Their names are "strip_1", "strip_2" and "strip_3". So that is how you have to reference them in your code.

There is no strip named "strip", so this line is an error:
Code: Select all | TOGGLE FULL SIZE
strip.setPixelColor(i, 255, 0, 0);//0


You have to specify one of the strips that you defined above, as in:
Code: Select all | TOGGLE FULL SIZE
strip_1.setPixelColor(i, 255, 0, 0);//0
User avatar
adafruit_support_bill
 
Posts: 30120
Joined: Sat Feb 07, 2009 10:11 am

Re: CONTROLLING 3 NEOPIXEL RINGS FROM ONE ARDUINO

by slurry bowl on Sun Apr 13, 2014 8:39 pm

Thanks, Bill, VERY MUCH APPRECIATED>

I have revised my code and I am still getting an error message.

expected primary-expression before '(' token.

Here is the revised code, I am acknowledging three strips but only trying to write to one for simplicity. Thanks so much.

Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_NeoPixel.h>

#define PIN_1
#define PIN_2
#define PIN_3

Adafruit_NeoPixel strip_1 = Adafruit_NeoPixel(24, PIN_1, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip_2 = Adafruit_NeoPixel(24, PIN_2, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip_3 = Adafruit_NeoPixel(24, PIN_3, NEO_GRB + NEO_KHZ800);

int potpin_1 = 0;
int potpin_2 = 0;
int potpin_3 = 0;

int potval_1 = 0;
int potval_2 = 0;
int potval_3 = 0;


void setup() {
 
  Serial.begin(9600);

  strip_1.begin();
  strip_2.begin();
  strip_3.begin();

  strip_1.show();
  strip_2.show();
  strip_3.show();
 
}

void loop() {
   
    potval_1 = analogRead(potpin_1);
    potval_2 = analogRead(potpin_2);
    potval_3 = analogRead(potpin_3);

    Serial.println(potval);

    if ( potval_1 <=40 ) {

      strip_1.setPixelColor(red_half); }
   


     else if ( potval_1 <= 80){
     
      strip_1.setPixelColor(red_half); }

     

     else if ( potval_1 <= 120) {
     
      strip_1.setPixelColor(blue_half); }

     
     else if ( potval_1 <= 160){
     
      strip_1.setPixelColor(blue_full); }

   
   
     else if ( potval <= 200){
     
      strip_1.setPixelColor(green_half); }

 
     else if ( potval <= 240){

      strip_1.setPixelColor(green_full); }


     else if ( potval <= 300){

          //green/blue_half
          strip_1.setPixelColor(0, 0, 255, 0);//0
          strip_1.setPixelColor(1, 0, 0, 0);//1
          strip_1.setPixelColor(2, 0, 0, 255);//2
          strip_1.setPixelColor(3, 0, 0, 0);//3
          strip_1.setPixelColor(4, 0, 255, 0);//4
          strip_1.setPixelColor(5, 0, 0, 0);//5
          strip_1.setPixelColor(6, 0, 0, 255);//6
          strip_1.setPixelColor(7, 0, 0, 0);//7
          strip_1.setPixelColor(8, 0, 255, 0);//8
          strip_1.setPixelColor(9, 0, 0, 0);//9
          strip_1.setPixelColor(10, 0, 0, 255);//10
          strip_1.setPixelColor(11, 0, 0, 0);//11
          strip_1.setPixelColor(12, 0, 255, 0);//12
          strip_1.setPixelColor(13, 0, 0, 0);//13
          strip_1.setPixelColor(14, 0, 0, 255);//14
          strip_1.setPixelColor(15, 0, 0, 0);//15
          strip_1.setPixelColor(16, 0, 255, 0);//16
          strip_1.setPixelColor(17, 0, 0, 0);//17
          strip_1.setPixelColor(18, 0, 0, 255);//18
          strip_1.setPixelColor(19, 0, 0, 0);//19
          strip_1.setPixelColor(20, 0, 255, 0);//20
          strip_1.setPixelColor(21, 0, 0, 0);//21
          strip_1.setPixelColor(22, 0, 0, 255);//22
          strip_1.setPixelColor(23, 0, 0, 0);//23 

          strip_1.show();}
     


      else if ( potval <= 340){
     
        strip_1.setPixelColor(green_blue); }

     
      else if ( potval <= 380){
 
       //green_red_half
      strip_1.setPixelColor(0, 0, 255, 0);//0
      strip_1.setPixelColor(1, 0, 0, 0);//1
      strip_1.setPixelColor(2, 255, 0, 0);//2
      strip_1.setPixelColor(3, 0, 0, 0);//3
      strip_1.setPixelColor(4, 0, 255, 0);//4
      strip_1.setPixelColor(5, 0, 0, 0);//5
      strip_1.setPixelColor(6, 255,0, 0);//6
      strip_1.setPixelColor(7, 0, 0, 0);//7
      strip_1.setPixelColor(8, 0, 255, 0);//8
      strip_1.setPixelColor(9, 0, 0, 0);//9
      strip_1.setPixelColor(10, 255, 0, 0);//10
      strip_1.setPixelColor(11, 0, 0, 0);//11
      strip_1.setPixelColor(12, 0,255, 0);//12
      strip_1.setPixelColor(13, 0, 0, 0);//13
      strip_1.setPixelColor(14, 255, 0, 0);//14
      strip_1.setPixelColor(15, 0, 0, 0);//15
      strip_1.setPixelColor(16, 0, 255, 0);//16
      strip_1.setPixelColor(17, 0, 0, 0);//17
      strip_1.setPixelColor(18, 255, 0, 0);//18
      strip_1.setPixelColor(19, 0, 0, 0);//19
      strip_1.setPixelColor(20, 0, 255, 0);//20
      strip_1.setPixelColor(21, 0, 0, 0);//21
      strip_1.setPixelColor(22, 255, 0, 0);//22
      strip_1.setPixelColor(23, 0, 0, 0);//23 
 
      strip_1.show();}
 
 

    else if ( potval <= 420){
      strip_1.setPixelColor(green_red); }
     
    else if ( potval <= 460){
       //green/magneta_half
      strip_1.setPixelColor(0, 0, 255, 0);//0
      strip_1.setPixelColor(1, 0, 0, 0);//1
      strip_1.setPixelColor(2, 255, 0, 255);//2
      strip_1.setPixelColor(3, 0, 0, 0);//3
      strip_1.setPixelColor(4, 0, 255, 0);//4
      strip_1.setPixelColor(5, 0, 0, 0);//5
      strip_1.setPixelColor(6, 255,0, 255);//6
      strip_1.setPixelColor(7, 0, 0, 0);//7
      strip_1.setPixelColor(8, 0, 255, 0);//8
      strip_1.setPixelColor(9, 0, 0, 0);//9
      strip_1.setPixelColor(10, 255, 0, 255);//10
      strip_1.setPixelColor(11, 0, 0, 0);//11
      strip_1.setPixelColor(12, 0,255, 0);//12
      strip_1.setPixelColor(13, 0, 0, 0);//13
      strip_1.setPixelColor(14, 255, 0, 255);//14
      strip_1.setPixelColor(15, 0, 0, 0);//15
      strip_1.setPixelColor(16, 0, 255, 0);//16
      strip_1.setPixelColor(17, 0, 0, 0);//17
      strip_1.setPixelColor(18, 255, 0, 255);//18
      strip_1.setPixelColor(19, 0, 0, 0);//19
      strip_1.setPixelColor(20, 0, 255, 0);//20
      strip_1.setPixelColor(21, 0, 0, 0);//21
      strip_1.setPixelColor(22, 255, 0, 255);//22
      strip_1.setPixelColor(23, 0, 0, 0);//23   

      strip_1.show();}



       else if ( potval <= 500){
        strip_1.setPixelColor(green_magenta_full); }



        else if ( potval <= 540){
            //green_magenta_weak
            strip_1.setPixelColor(0, 0, 255, 0);//0
            strip_1.setPixelColor(1, 0, 0, 0);//1
            strip_1.setPixelColor(2, 0, 0, 0);//2
            strip_1.setPixelColor(3, 155, 0, 155);//3
            strip_1.setPixelColor(4, 0, 0, 0);//4
            strip_1.setPixelColor(5, 0, 0, 0);//5
            strip_1.setPixelColor(6, 0, 255, 0);//6
            strip_1.setPixelColor(7, 0, 0, 0);//7
            strip_1.setPixelColor(8, 0, 0, 0);//8
            strip_1.setPixelColor(9, 155, 0, 155);//9
            strip_1.setPixelColor(10, 0, 0, 0);//10
            strip_1.setPixelColor(11, 0, 0, 0);//11
            strip_1.setPixelColor(12, 0, 255, 0);//12
            strip_1.setPixelColor(13, 0, 0, 0);//13
            strip_1.setPixelColor(14, 0, 0, 0);//14
            strip_1.setPixelColor(15, 155, 0, 155);//15
            strip_1.setPixelColor(16, 0, 0, 0);//16
            strip_1.setPixelColor(17, 0, 0, 0);//17
            strip_1.setPixelColor(18, 0, 255, 0);//18
            strip_1.setPixelColor(19, 0, 0, 0);//19
            strip_1.setPixelColor(20, 0, 0, 0);//20
            strip_1.setPixelColor(21, 155, 0, 155);//21
            strip_1.setPixelColor(22, 0, 0, 0);//22
            strip_1.setPixelColor(23, 0, 0, 0);//23
           
            strip_1.show();}
           
     

            else if ( potval <= 600){
                //blue/magenta_half
                strip_1.setPixelColor(0, 0, 0, 255);//0
                strip_1.setPixelColor(1, 0, 0, 0);//1
                strip_1.setPixelColor(2, 255, 0, 255);//2
                strip_1.setPixelColor(3, 0, 0, 0);//3
                strip_1.setPixelColor(4, 0, 0, 255);//4
                strip_1.setPixelColor(5, 0, 0, 0);//5
                strip_1.setPixelColor(6, 255,0, 255);//6
                strip_1.setPixelColor(7, 0, 0, 0);//7
                strip_1.setPixelColor(8, 0, 0, 255);//8
                strip_1.setPixelColor(9, 0, 0, 0);//9
                strip_1.setPixelColor(10, 255, 0, 255);//10
                strip_1.setPixelColor(11, 0, 0, 0);//11
                strip_1.setPixelColor(12, 0, 0, 255);//12
                strip_1.setPixelColor(13, 0, 0, 0);//13
                strip_1.setPixelColor(14, 255, 0, 255);//14
                strip_1.setPixelColor(15, 0, 0, 0);//15
                strip_1.setPixelColor(16, 0, 0, 255);//16
                strip_1.setPixelColor(17, 0, 0, 0);//17
                strip_1.setPixelColor(18, 255, 0, 255);//18
                strip_1.setPixelColor(19, 0, 0, 0);//19
                strip_1.setPixelColor(20, 0, 0, 255);//20
                strip_1.setPixelColor(21, 0, 0, 0);//21
                strip_1.setPixelColor(22, 255, 0, 255);//22
                strip_1.setPixelColor(23, 0, 0, 0);//23   
                strip_1.show();}
       
       

        else if ( potval <= 640){
              strip_1.setPixelColor(blue_magenta_full); }


        else if ( potval <= 700) {
            //red_magenta_half
            strip_1.setPixelColor(1, 0, 0, 0);//1
            strip_1.setPixelColor(2, 255, 0, 255);//2
            strip_1.setPixelColor(3, 0, 0, 0);//3
            strip_1.setPixelColor(4, 255, 0, 0);//4
            strip_1.setPixelColor(5, 0, 0, 0);//5
            strip_1.setPixelColor(6, 255,0, 255);//6
            strip_1.setPixelColor(7, 0, 0, 0);//7
            strip_1.setPixelColor(8, 255, 0, 0);//8
            strip_1.setPixelColor(9, 0, 0, 0);//9
            strip_1.setPixelColor(10, 255, 0, 255);//10
            strip_1.setPixelColor(11, 0, 0, 0);//11
            strip_1.setPixelColor(12, 255, 0, 0);//12
            strip_1.setPixelColor(13, 0, 0, 0);//13
            strip_1.setPixelColor(14, 255, 0, 255);//14
            strip_1.setPixelColor(15, 0, 0, 0);//15
            strip_1.setPixelColor(16, 255, 0, 0);//16
            strip_1.setPixelColor(17, 0, 0, 0);//17
            strip_1.setPixelColor(18, 255, 0, 255);//18
            strip_1.setPixelColor(19, 0, 0, 0);//19
            strip_1.setPixelColor(20, 255, 0, 0);//20
            strip_1.setPixelColor(21, 0, 0, 0);//21
            strip_1.setPixelColor(22, 255, 0, 255);//22
            strip_1.setPixelColor(23, 0, 0, 0);//23   
            strip_1.show}




         else if ( potval >740){
            //red/blue_half
            strip_1.setPixelColor(0, 255, 0, 0);//0
            strip_1.setPixelColor(1, 0, 0, 0);//1
            strip_1.setPixelColor(2, 0, 255,0);//2
            strip_1.setPixelColor(3, 0, 0, 0);//3
            strip_1.setPixelColor(4, 0, 0, 255);//4
            strip_1.setPixelColor(5, 0, 0, 0);//5
            strip_1.setPixelColor(6, 255, 0, 0);//6
            strip_1.setPixelColor(7, 0, 0, 0);//7
            strip_1.setPixelColor(8, 0, 255, 0);//8
            strip_1.setPixelColor(9, 0, 0, 0);//9
            strip_1.setPixelColor(10, 0, 0, 255);//10
            strip_1.setPixelColor(11, 0, 0, 0);//11
            strip_1.setPixelColor(12, 255, 0, 0);//12
            strip_1.setPixelColor(13, 0, 0, 0);//13
            strip_1.setPixelColor(14, 0, 255, 0);//14
            strip_1.setPixelColor(15, 0, 0, 0);//15
            strip_1.setPixelColor(16, 0, 0, 255);//16
            strip_1.setPixelColor(17, 0, 0, 0);//17
            strip_1.setPixelColor(18, 255,0, 0);//18
            strip_1.setPixelColor(19, 0, 0, 0);//19
            strip_1.setPixelColor(20, 255, 0, 0);//20
            strip_1.setPixelColor(21, 0, 0, 0);//21
            strip_1.setPixelColor(22, 0, 255, 0);//22
            strip_1.setPixelColor(23,0, 0, 0);//23
           
            strip_1.show();}
           
           

          else if ( potval <= 780){
              //red/green/blue_full
              strip_1.setPixelColor(0, 255, 0, 0);
              strip_1.setPixelColor(1, 0, 255, 0);
              strip_1.setPixelColor(2, 0, 0,255);
              strip_1.setPixelColor(3, 255, 0, 0);
              strip_1.setPixelColor(4, 0, 255, 0);
              strip_1.setPixelColor(5, 0, 0, 255);
              strip_1.setPixelColor(6, 255, 0, 0);
              strip_1.setPixelColor(7, 0, 255, 0);
              strip_1.setPixelColor(8, 0, 0, 255);
              strip_1.setPixelColor(9, 255, 0, 0);
              strip_1.setPixelColor(10,0 , 255, 0);
              strip_1.setPixelColor(11, 0, 0, 255);
              strip_1.setPixelColor(12, 255, 0, 0);
              strip_1.setPixelColor(13, 0, 255, 0);
              strip_1.setPixelColor(14, 0, 0, 255);
              strip_1.setPixelColor(15, 255, 0, 0);
              strip_1.setPixelColor(16, 0, 255, 0);
              strip_1.setPixelColor(17, 255, 0, 0);
              strip_1.setPixelColor(18, 0, 255, 0);
              strip_1.setPixelColor(19, 0, 0, 255);
              strip_1.setPixelColor(20, 255, 0, 0);
              strip_1.setPixelColor(21, 0, 255, 0);
              strip_1.setPixelColor(22, 0, 0, 255);
              strip_1.setPixelColor(23, 255, 0, 0);
               
              strip_1.show();}
   

void red_half(){
    for (int i = 0; i < 24; i += 2)}
      strip.setPixelColor(i, 255, 0, 0);//0
      strip.setPixelColor(i+1, 0, 0, 0);//1
      strip.show();
      }
      }

void red_full(){
      for (int i = 0; i < 24; i += 2)}
      strip.setPixelColor(i, 255, 0, 0);//0
      strip.setPixelColor(i+1, 255, 0, 0);//1
      strip.show();
      }
      }
     
void blue_half(){
      for (int i = 0; i < 24; i += 2)}
      strip.setPixelColor(i, 0, 0, 255);//0
      strip.setPixelColor(i+1, 0, 0, 0);//1
      strip.show();
      }
      }
     
void blue_full(){
      for (int i = 0; i < 24; i += 2)}
      strip.setPixelColor(i, 0, 0, 255);//0
      strip.setPixelColor(i+1, 0, 0, 255);//1
      strip.show();
      }
      }
     
void green_half(){
      for (int i = 0; i < 24; i += 2)}
      strip.setPixelColor(i, 0, 255, 0);//0
      strip.setPixelColor(i+1, 0, 0, 0);//1
      strip.show();
      }
      }
     
void green_full(){
      for (int i = 0; i < 24; i += 2)}
      strip.setPixelColor(i, 0, 255, 0);//0
      strip.setPixelColor(i+1, 0, 0, 0);//1
      strip.show();
      }
      }
     
void green_blue(){
      for (int i = 0; i < 24; i += 2)}
      strip.setPixelColor(i, 0, 255, 0);//0
      strip.setPixelColor(i+1, 0, 0, 255);//1
      strip.show();
      }
      }
     
void blue_magenta_full(){
      for (int i = 0; i < 24; i += 2)}
      strip.setPixelColor(i, 0, 255, 0);//0
      strip.setPixelColor(i+1, 0, 0, 255);//1
      strip.show();
      }
      }
     
     
// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}
 






 



slurry bowl
 
Posts: 122
Joined: Sun Nov 11, 2012 6:37 pm

Re: CONTROLLING 3 NEOPIXEL RINGS FROM ONE ARDUINO

by adafruit_support_bill on Mon Apr 14, 2014 5:59 am

You haven't defined any values for PIN_1, PIN_2 or PIN_3.

I don't know which pins you are using, but they need to be inserted into the #defines.

Code: Select all | TOGGLE FULL SIZE
#define PIN_1 4
#define PIN_2 5
#define PIN_3 6


The next problem you will run into is that "potval" is undefined. You changed how you read the 3 pot pins, but you are still printing "potval".
User avatar
adafruit_support_bill
 
Posts: 30120
Joined: Sat Feb 07, 2009 10:11 am

Re: CONTROLLING 3 NEOPIXEL RINGS FROM ONE ARDUINO

by slurry bowl on Tue Apr 15, 2014 6:41 pm

Hey Bill and community.

I identified my output pins for my strips and added the correct potval designations to serial print to.

I am having issues now with my functions. Every time I verify my code, the first referenced function "red_half" is pulling an error stating:

'red_half' was not declared in this scope.

I tried changing the red_half function to be specific to strip 1 and it still is pulling the same error. It is unclear why. I feel I am close to controlling 3 neopixel rings with 3 potentiometers and GREATLY APPRECIATE ANY HELP. I am working alone here and this community is incredibly helpful.

Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_NeoPixel.h>

#define PIN_1 1
#define PIN_2 2
#define PIN_3 3

Adafruit_NeoPixel strip_1 = Adafruit_NeoPixel(24, PIN_1, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip_2 = Adafruit_NeoPixel(24, PIN_2, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip_3 = Adafruit_NeoPixel(24, PIN_3, NEO_GRB + NEO_KHZ800);

int potpin_1 = 1;
int potpin_2 = 2;
int potpin_3 = 3;

int potval_1 = 0;
int potval_2 = 0;
int potval_3 = 0;


void setup() {
 
  Serial.begin(9600);

  strip_1.begin();
  strip_2.begin();
  strip_3.begin();

  strip_1.show();
  strip_2.show();
  strip_3.show();
 
}

void loop() {
   
    potval_1 = analogRead(potpin_1);
    potval_2 = analogRead(potpin_2);
    potval_3 = analogRead(potpin_3);

    Serial.println(potval_1);
    Serial.println(potval_2);
    Serial.println(potval_3);

    if ( potval_1 <=40 ) {

      strip_1.setPixelColor(red_half); }
   


     else if ( potval_1 <= 80){
     
      strip_1.setPixelColor(red_half); }

     

     else if ( potval_1 <= 120) {
     
      strip_1.setPixelColor(blue_half); }

     
     else if ( potval_1 <= 160){
     
      strip_1.setPixelColor(blue_full); }

   
   
     else if ( potval <= 200){
     
      strip_1.setPixelColor(green_half); }

 
     else if ( potval <= 240){

      strip_1.setPixelColor(green_full); }


     else if ( potval <= 300){

          //green/blue_half
          strip_1.setPixelColor(0, 0, 255, 0);//0
          strip_1.setPixelColor(1, 0, 0, 0);//1
          strip_1.setPixelColor(2, 0, 0, 255);//2
          strip_1.setPixelColor(3, 0, 0, 0);//3
          strip_1.setPixelColor(4, 0, 255, 0);//4
          strip_1.setPixelColor(5, 0, 0, 0);//5
          strip_1.setPixelColor(6, 0, 0, 255);//6
          strip_1.setPixelColor(7, 0, 0, 0);//7
          strip_1.setPixelColor(8, 0, 255, 0);//8
          strip_1.setPixelColor(9, 0, 0, 0);//9
          strip_1.setPixelColor(10, 0, 0, 255);//10
          strip_1.setPixelColor(11, 0, 0, 0);//11
          strip_1.setPixelColor(12, 0, 255, 0);//12
          strip_1.setPixelColor(13, 0, 0, 0);//13
          strip_1.setPixelColor(14, 0, 0, 255);//14
          strip_1.setPixelColor(15, 0, 0, 0);//15
          strip_1.setPixelColor(16, 0, 255, 0);//16
          strip_1.setPixelColor(17, 0, 0, 0);//17
          strip_1.setPixelColor(18, 0, 0, 255);//18
          strip_1.setPixelColor(19, 0, 0, 0);//19
          strip_1.setPixelColor(20, 0, 255, 0);//20
          strip_1.setPixelColor(21, 0, 0, 0);//21
          strip_1.setPixelColor(22, 0, 0, 255);//22
          strip_1.setPixelColor(23, 0, 0, 0);//23 

          strip_1.show();}
     


      else if ( potval <= 340){
     
        strip_1.setPixelColor(green_blue); }

     
      else if ( potval <= 380){
 
       //green_red_half
      strip_1.setPixelColor(0, 0, 255, 0);//0
      strip_1.setPixelColor(1, 0, 0, 0);//1
      strip_1.setPixelColor(2, 255, 0, 0);//2
      strip_1.setPixelColor(3, 0, 0, 0);//3
      strip_1.setPixelColor(4, 0, 255, 0);//4
      strip_1.setPixelColor(5, 0, 0, 0);//5
      strip_1.setPixelColor(6, 255,0, 0);//6
      strip_1.setPixelColor(7, 0, 0, 0);//7
      strip_1.setPixelColor(8, 0, 255, 0);//8
      strip_1.setPixelColor(9, 0, 0, 0);//9
      strip_1.setPixelColor(10, 255, 0, 0);//10
      strip_1.setPixelColor(11, 0, 0, 0);//11
      strip_1.setPixelColor(12, 0,255, 0);//12
      strip_1.setPixelColor(13, 0, 0, 0);//13
      strip_1.setPixelColor(14, 255, 0, 0);//14
      strip_1.setPixelColor(15, 0, 0, 0);//15
      strip_1.setPixelColor(16, 0, 255, 0);//16
      strip_1.setPixelColor(17, 0, 0, 0);//17
      strip_1.setPixelColor(18, 255, 0, 0);//18
      strip_1.setPixelColor(19, 0, 0, 0);//19
      strip_1.setPixelColor(20, 0, 255, 0);//20
      strip_1.setPixelColor(21, 0, 0, 0);//21
      strip_1.setPixelColor(22, 255, 0, 0);//22
      strip_1.setPixelColor(23, 0, 0, 0);//23 
 
      strip_1.show();}
 
 

    else if ( potval <= 420){
      strip_1.setPixelColor(green_red); }
     
    else if ( potval <= 460){
       //green/magneta_half
      strip_1.setPixelColor(0, 0, 255, 0);//0
      strip_1.setPixelColor(1, 0, 0, 0);//1
      strip_1.setPixelColor(2, 255, 0, 255);//2
      strip_1.setPixelColor(3, 0, 0, 0);//3
      strip_1.setPixelColor(4, 0, 255, 0);//4
      strip_1.setPixelColor(5, 0, 0, 0);//5
      strip_1.setPixelColor(6, 255,0, 255);//6
      strip_1.setPixelColor(7, 0, 0, 0);//7
      strip_1.setPixelColor(8, 0, 255, 0);//8
      strip_1.setPixelColor(9, 0, 0, 0);//9
      strip_1.setPixelColor(10, 255, 0, 255);//10
      strip_1.setPixelColor(11, 0, 0, 0);//11
      strip_1.setPixelColor(12, 0,255, 0);//12
      strip_1.setPixelColor(13, 0, 0, 0);//13
      strip_1.setPixelColor(14, 255, 0, 255);//14
      strip_1.setPixelColor(15, 0, 0, 0);//15
      strip_1.setPixelColor(16, 0, 255, 0);//16
      strip_1.setPixelColor(17, 0, 0, 0);//17
      strip_1.setPixelColor(18, 255, 0, 255);//18
      strip_1.setPixelColor(19, 0, 0, 0);//19
      strip_1.setPixelColor(20, 0, 255, 0);//20
      strip_1.setPixelColor(21, 0, 0, 0);//21
      strip_1.setPixelColor(22, 255, 0, 255);//22
      strip_1.setPixelColor(23, 0, 0, 0);//23   

      strip_1.show();}



       else if ( potval <= 500){
        strip_1.setPixelColor(green_magenta_full); }



        else if ( potval <= 540){
            //green_magenta_weak
            strip_1.setPixelColor(0, 0, 255, 0);//0
            strip_1.setPixelColor(1, 0, 0, 0);//1
            strip_1.setPixelColor(2, 0, 0, 0);//2
            strip_1.setPixelColor(3, 155, 0, 155);//3
            strip_1.setPixelColor(4, 0, 0, 0);//4
            strip_1.setPixelColor(5, 0, 0, 0);//5
            strip_1.setPixelColor(6, 0, 255, 0);//6
            strip_1.setPixelColor(7, 0, 0, 0);//7
            strip_1.setPixelColor(8, 0, 0, 0);//8
            strip_1.setPixelColor(9, 155, 0, 155);//9
            strip_1.setPixelColor(10, 0, 0, 0);//10
            strip_1.setPixelColor(11, 0, 0, 0);//11
            strip_1.setPixelColor(12, 0, 255, 0);//12
            strip_1.setPixelColor(13, 0, 0, 0);//13
            strip_1.setPixelColor(14, 0, 0, 0);//14
            strip_1.setPixelColor(15, 155, 0, 155);//15
            strip_1.setPixelColor(16, 0, 0, 0);//16
            strip_1.setPixelColor(17, 0, 0, 0);//17
            strip_1.setPixelColor(18, 0, 255, 0);//18
            strip_1.setPixelColor(19, 0, 0, 0);//19
            strip_1.setPixelColor(20, 0, 0, 0);//20
            strip_1.setPixelColor(21, 155, 0, 155);//21
            strip_1.setPixelColor(22, 0, 0, 0);//22
            strip_1.setPixelColor(23, 0, 0, 0);//23
           
            strip_1.show();}
           
     

            else if ( potval <= 600){
                //blue/magenta_half
                strip_1.setPixelColor(0, 0, 0, 255);//0
                strip_1.setPixelColor(1, 0, 0, 0);//1
                strip_1.setPixelColor(2, 255, 0, 255);//2
                strip_1.setPixelColor(3, 0, 0, 0);//3
                strip_1.setPixelColor(4, 0, 0, 255);//4
                strip_1.setPixelColor(5, 0, 0, 0);//5
                strip_1.setPixelColor(6, 255,0, 255);//6
                strip_1.setPixelColor(7, 0, 0, 0);//7
                strip_1.setPixelColor(8, 0, 0, 255);//8
                strip_1.setPixelColor(9, 0, 0, 0);//9
                strip_1.setPixelColor(10, 255, 0, 255);//10
                strip_1.setPixelColor(11, 0, 0, 0);//11
                strip_1.setPixelColor(12, 0, 0, 255);//12
                strip_1.setPixelColor(13, 0, 0, 0);//13
                strip_1.setPixelColor(14, 255, 0, 255);//14
                strip_1.setPixelColor(15, 0, 0, 0);//15
                strip_1.setPixelColor(16, 0, 0, 255);//16
                strip_1.setPixelColor(17, 0, 0, 0);//17
                strip_1.setPixelColor(18, 255, 0, 255);//18
                strip_1.setPixelColor(19, 0, 0, 0);//19
                strip_1.setPixelColor(20, 0, 0, 255);//20
                strip_1.setPixelColor(21, 0, 0, 0);//21
                strip_1.setPixelColor(22, 255, 0, 255);//22
                strip_1.setPixelColor(23, 0, 0, 0);//23   
                strip_1.show();}
       
       

        else if ( potval <= 640){
              strip_1.setPixelColor(blue_magenta_full); }


        else if ( potval <= 700) {
            //red_magenta_half
            strip_1.setPixelColor(1, 0, 0, 0);//1
            strip_1.setPixelColor(2, 255, 0, 255);//2
            strip_1.setPixelColor(3, 0, 0, 0);//3
            strip_1.setPixelColor(4, 255, 0, 0);//4
            strip_1.setPixelColor(5, 0, 0, 0);//5
            strip_1.setPixelColor(6, 255,0, 255);//6
            strip_1.setPixelColor(7, 0, 0, 0);//7
            strip_1.setPixelColor(8, 255, 0, 0);//8
            strip_1.setPixelColor(9, 0, 0, 0);//9
            strip_1.setPixelColor(10, 255, 0, 255);//10
            strip_1.setPixelColor(11, 0, 0, 0);//11
            strip_1.setPixelColor(12, 255, 0, 0);//12
            strip_1.setPixelColor(13, 0, 0, 0);//13
            strip_1.setPixelColor(14, 255, 0, 255);//14
            strip_1.setPixelColor(15, 0, 0, 0);//15
            strip_1.setPixelColor(16, 255, 0, 0);//16
            strip_1.setPixelColor(17, 0, 0, 0);//17
            strip_1.setPixelColor(18, 255, 0, 255);//18
            strip_1.setPixelColor(19, 0, 0, 0);//19
            strip_1.setPixelColor(20, 255, 0, 0);//20
            strip_1.setPixelColor(21, 0, 0, 0);//21
            strip_1.setPixelColor(22, 255, 0, 255);//22
            strip_1.setPixelColor(23, 0, 0, 0);//23   
            strip_1.show}




         else if ( potval >740){
            //red/blue_half
            strip_1.setPixelColor(0, 255, 0, 0);//0
            strip_1.setPixelColor(1, 0, 0, 0);//1
            strip_1.setPixelColor(2, 0, 255,0);//2
            strip_1.setPixelColor(3, 0, 0, 0);//3
            strip_1.setPixelColor(4, 0, 0, 255);//4
            strip_1.setPixelColor(5, 0, 0, 0);//5
            strip_1.setPixelColor(6, 255, 0, 0);//6
            strip_1.setPixelColor(7, 0, 0, 0);//7
            strip_1.setPixelColor(8, 0, 255, 0);//8
            strip_1.setPixelColor(9, 0, 0, 0);//9
            strip_1.setPixelColor(10, 0, 0, 255);//10
            strip_1.setPixelColor(11, 0, 0, 0);//11
            strip_1.setPixelColor(12, 255, 0, 0);//12
            strip_1.setPixelColor(13, 0, 0, 0);//13
            strip_1.setPixelColor(14, 0, 255, 0);//14
            strip_1.setPixelColor(15, 0, 0, 0);//15
            strip_1.setPixelColor(16, 0, 0, 255);//16
            strip_1.setPixelColor(17, 0, 0, 0);//17
            strip_1.setPixelColor(18, 255,0, 0);//18
            strip_1.setPixelColor(19, 0, 0, 0);//19
            strip_1.setPixelColor(20, 255, 0, 0);//20
            strip_1.setPixelColor(21, 0, 0, 0);//21
            strip_1.setPixelColor(22, 0, 255, 0);//22
            strip_1.setPixelColor(23,0, 0, 0);//23
           
            strip_1.show();}
           
           

          else if ( potval <= 780){
              //red/green/blue_full
              strip_1.setPixelColor(0, 255, 0, 0);
              strip_1.setPixelColor(1, 0, 255, 0);
              strip_1.setPixelColor(2, 0, 0,255);
              strip_1.setPixelColor(3, 255, 0, 0);
              strip_1.setPixelColor(4, 0, 255, 0);
              strip_1.setPixelColor(5, 0, 0, 255);
              strip_1.setPixelColor(6, 255, 0, 0);
              strip_1.setPixelColor(7, 0, 255, 0);
              strip_1.setPixelColor(8, 0, 0, 255);
              strip_1.setPixelColor(9, 255, 0, 0);
              strip_1.setPixelColor(10,0 , 255, 0);
              strip_1.setPixelColor(11, 0, 0, 255);
              strip_1.setPixelColor(12, 255, 0, 0);
              strip_1.setPixelColor(13, 0, 255, 0);
              strip_1.setPixelColor(14, 0, 0, 255);
              strip_1.setPixelColor(15, 255, 0, 0);
              strip_1.setPixelColor(16, 0, 255, 0);
              strip_1.setPixelColor(17, 255, 0, 0);
              strip_1.setPixelColor(18, 0, 255, 0);
              strip_1.setPixelColor(19, 0, 0, 255);
              strip_1.setPixelColor(20, 255, 0, 0);
              strip_1.setPixelColor(21, 0, 255, 0);
              strip_1.setPixelColor(22, 0, 0, 255);
              strip_1.setPixelColor(23, 255, 0, 0);
               
              strip_1.show();}
   

void red_half()
{
    for (int i = 0; i < 24; i += 2)
    {
       strip_1.setPixelColor(i, 255, 0, 0);//0
       strip_1.setPixelColor(i+1, 0, 0, 0);//1
       strip_1.show();
     }
 }

void red_full(){
      for (int i = 0; i < 24; i += 2)}
      strip.setPixelColor(i, 255, 0, 0);//0
      strip.setPixelColor(i+1, 255, 0, 0);//1
      strip.show();
      }
      }
     
void blue_half(){
      for (int i = 0; i < 24; i += 2)}
      strip.setPixelColor(i, 0, 0, 255);//0
      strip.setPixelColor(i+1, 0, 0, 0);//1
      strip.show();
      }
      }
     
void blue_full(){
      for (int i = 0; i < 24; i += 2)}
      strip.setPixelColor(i, 0, 0, 255);//0
      strip.setPixelColor(i+1, 0, 0, 255);//1
      strip.show();
      }
      }
     
void green_half(){
      for (int i = 0; i < 24; i += 2)}
      strip.setPixelColor(i, 0, 255, 0);//0
      strip.setPixelColor(i+1, 0, 0, 0);//1
      strip.show();
      }
      }
     
void green_full(){
      for (int i = 0; i < 24; i += 2)}
      strip.setPixelColor(i, 0, 255, 0);//0
      strip.setPixelColor(i+1, 0, 0, 0);//1
      strip.show();
      }
      }
     
void green_blue(){
      for (int i = 0; i < 24; i += 2)}
      strip.setPixelColor(i, 0, 255, 0);//0
      strip.setPixelColor(i+1, 0, 0, 255);//1
      strip.show();
      }
      }
     
void blue_magenta_full(){
      for (int i = 0; i < 24; i += 2)}
      strip.setPixelColor(i, 0, 255, 0);//0
      strip.setPixelColor(i+1, 0, 0, 255);//1
      strip.show();
      }
      }
     
     
// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}
 







 



slurry bowl
 
Posts: 122
Joined: Sun Nov 11, 2012 6:37 pm

Re: CONTROLLING 3 NEOPIXEL RINGS FROM ONE ARDUINO

by adafruit_support_bill on Tue Apr 15, 2014 7:34 pm

red_half() is not defined because there are problems in the loop() that comes before it. loop() is not complete because it has unbalanced brackets. You need to have one '}' for every '}'.

Each pair of brackets { } defines a 'block' of code. The function definition is not complete until the last code block is closed.

It is much easier to keep track of these if you indent consistently as below:

Code: Select all | TOGGLE FULL SIZE
void loop()
{
    potval_1 = analogRead(potpin_1);
    potval_2 = analogRead(potpin_2);
    potval_3 = analogRead(potpin_3);

    Serial.println(potval_1);
    Serial.println(potval_2);
    Serial.println(potval_3);

    if ( potval_1 <=40 )
    {
      strip_1.setPixelColor(red_half);
    }

    else if ( potval_1 <= 80)
    {
      strip_1.setPixelColor(red_half);
    }
}
       
User avatar
adafruit_support_bill
 
Posts: 30120
Joined: Sat Feb 07, 2009 10:11 am

Re: CONTROLLING 3 NEOPIXEL RINGS FROM ONE ARDUINO

by slurry bowl on Tue Apr 15, 2014 11:45 pm

Must the { brackets } be indented exactly the same for the whole code?

I went through and attempted to put tape on my screen to keep them at the correct position, but its a challenging formatting situation!

I am unclear where my brackets are not symmetrical and balanced. Perhaps my expectation of when they are required could be leading to this, at any rate my project is kina stuck.......

But IM LEARNING CODING, HOORAY!

{thanks
}

current masterpiece:

Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_NeoPixel.h>

#define PIN_1 1
#define PIN_2 2
#define PIN_3 3

Adafruit_NeoPixel strip_1 = Adafruit_NeoPixel(24, PIN_1, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip_2 = Adafruit_NeoPixel(24, PIN_2, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip_3 = Adafruit_NeoPixel(24, PIN_3, NEO_GRB + NEO_KHZ800);

int potpin_1 = 1;
int potpin_2 = 2;
int potpin_3 = 3;

int potval_1 = 0;
int potval_2 = 0;
int potval_3 = 0;


void setup()
{
 
  Serial.begin(9600);

  strip_1.begin();
  strip_2.begin();
  strip_3.begin();

  strip_1.show();
  strip_2.show();
  strip_3.show();
 
}

void loop()
{
 


   
    potval_1 = analogRead(potpin_1);
    potval_2 = analogRead(potpin_2);
    potval_3 = analogRead(potpin_3);

    Serial.println(potval_1);
    Serial.println(potval_2);
    Serial.println(potval_3);

    if ( potval_1 <=40 )
    {
       strip_1.setPixelColor(red_half);
    }
 
    else if ( potval_1 <= 80)
    {
      strip_1.setPixelColor(red_half);
    }

    else if ( potval_1 <= 120)
    {
      strip_1.setPixelColor(blue_half);
    }

    else if ( potval_1 <= 160)
    {
       strip_1.setPixelColor(blue_full);
    }

    else if ( potval_1 <= 200)
    {
     
      strip_1.setPixelColor(green_half);
    }

     else if ( potval_1 <= 240)
     {

      strip_1.setPixelColor(green_full);
     }

     else if ( potval_1 <= 300)
     
     {

          //green/blue_half
          strip_1.setPixelColor(0, 0, 255, 0);//0
          strip_1.setPixelColor(1, 0, 0, 0);//1
          strip_1.setPixelColor(2, 0, 0, 255);//2
          strip_1.setPixelColor(3, 0, 0, 0);//3
          strip_1.setPixelColor(4, 0, 255, 0);//4
          strip_1.setPixelColor(5, 0, 0, 0);//5
          strip_1.setPixelColor(6, 0, 0, 255);//6
          strip_1.setPixelColor(7, 0, 0, 0);//7
          strip_1.setPixelColor(8, 0, 255, 0);//8
          strip_1.setPixelColor(9, 0, 0, 0);//9
          strip_1.setPixelColor(10, 0, 0, 255);//10
          strip_1.setPixelColor(11, 0, 0, 0);//11
          strip_1.setPixelColor(12, 0, 255, 0);//12
          strip_1.setPixelColor(13, 0, 0, 0);//13
          strip_1.setPixelColor(14, 0, 0, 255);//14
          strip_1.setPixelColor(15, 0, 0, 0);//15
          strip_1.setPixelColor(16, 0, 255, 0);//16
          strip_1.setPixelColor(17, 0, 0, 0);//17
          strip_1.setPixelColor(18, 0, 0, 255);//18
          strip_1.setPixelColor(19, 0, 0, 0);//19
          strip_1.setPixelColor(20, 0, 255, 0);//20
          strip_1.setPixelColor(21, 0, 0, 0);//21
          strip_1.setPixelColor(22, 0, 0, 255);//22
          strip_1.setPixelColor(23, 0, 0, 0);//23 

          strip_1.show();
      }
     


      else if ( potval_1 <= 340)
      {
        strip_1.setPixelColor(green_blue);
      }

      else if ( potval_1 <= 380)
      {
 
          //green_red_half
          strip_1.setPixelColor(0, 0, 255, 0);//0
          strip_1.setPixelColor(1, 0, 0, 0);//1
          strip_1.setPixelColor(2, 255, 0, 0);//2
          strip_1.setPixelColor(3, 0, 0, 0);//3
          strip_1.setPixelColor(4, 0, 255, 0);//4
          strip_1.setPixelColor(5, 0, 0, 0);//5
          strip_1.setPixelColor(6, 255,0, 0);//6
          strip_1.setPixelColor(7, 0, 0, 0);//7
          strip_1.setPixelColor(8, 0, 255, 0);//8
          strip_1.setPixelColor(9, 0, 0, 0);//9
          strip_1.setPixelColor(10, 255, 0, 0);//10
          strip_1.setPixelColor(11, 0, 0, 0);//11
          strip_1.setPixelColor(12, 0,255, 0);//12
          strip_1.setPixelColor(13, 0, 0, 0);//13
          strip_1.setPixelColor(14, 255, 0, 0);//14
          strip_1.setPixelColor(15, 0, 0, 0);//15
          strip_1.setPixelColor(16, 0, 255, 0);//16
          strip_1.setPixelColor(17, 0, 0, 0);//17
          strip_1.setPixelColor(18, 255, 0, 0);//18
          strip_1.setPixelColor(19, 0, 0, 0);//19
          strip_1.setPixelColor(20, 0, 255, 0);//20
          strip_1.setPixelColor(21, 0, 0, 0);//21
          strip_1.setPixelColor(22, 255, 0, 0);//22
          strip_1.setPixelColor(23, 0, 0, 0);//23 
     
          strip_1.show();
      }
 
 

      else if ( potval_1 <= 420)
      {
        strip_1.setPixelColor(green_red);
      }
     
      else if ( potval_1 <= 460)
      {
               //green/magneta_half
              strip_1.setPixelColor(0, 0, 255, 0);//0
              strip_1.setPixelColor(1, 0, 0, 0);//1
              strip_1.setPixelColor(2, 255, 0, 255);//2
              strip_1.setPixelColor(3, 0, 0, 0);//3
              strip_1.setPixelColor(4, 0, 255, 0);//4
              strip_1.setPixelColor(5, 0, 0, 0);//5
              strip_1.setPixelColor(6, 255,0, 255);//6
              strip_1.setPixelColor(7, 0, 0, 0);//7
              strip_1.setPixelColor(8, 0, 255, 0);//8
              strip_1.setPixelColor(9, 0, 0, 0);//9
              strip_1.setPixelColor(10, 255, 0, 255);//10
              strip_1.setPixelColor(11, 0, 0, 0);//11
              strip_1.setPixelColor(12, 0,255, 0);//12
              strip_1.setPixelColor(13, 0, 0, 0);//13
              strip_1.setPixelColor(14, 255, 0, 255);//14
              strip_1.setPixelColor(15, 0, 0, 0);//15
              strip_1.setPixelColor(16, 0, 255, 0);//16
              strip_1.setPixelColor(17, 0, 0, 0);//17
              strip_1.setPixelColor(18, 255, 0, 255);//18
              strip_1.setPixelColor(19, 0, 0, 0);//19
              strip_1.setPixelColor(20, 0, 255, 0);//20
              strip_1.setPixelColor(21, 0, 0, 0);//21
              strip_1.setPixelColor(22, 255, 0, 255);//22
              strip_1.setPixelColor(23, 0, 0, 0);//23   
       
              strip_1.show();
         }
 
 
 
         else if ( potval <= 500)
         {
          strip_1.setPixelColor(green_magenta_full);
         }
 
         else if ( potval <= 540)
         {
              //green_magenta_weak
              strip_1.setPixelColor(0, 0, 255, 0);//0
              strip_1.setPixelColor(1, 0, 0, 0);//1
              strip_1.setPixelColor(2, 0, 0, 0);//2
              strip_1.setPixelColor(3, 155, 0, 155);//3
              strip_1.setPixelColor(4, 0, 0, 0);//4
              strip_1.setPixelColor(5, 0, 0, 0);//5
              strip_1.setPixelColor(6, 0, 255, 0);//6
              strip_1.setPixelColor(7, 0, 0, 0);//7
              strip_1.setPixelColor(8, 0, 0, 0);//8
              strip_1.setPixelColor(9, 155, 0, 155);//9
              strip_1.setPixelColor(10, 0, 0, 0);//10
              strip_1.setPixelColor(11, 0, 0, 0);//11
              strip_1.setPixelColor(12, 0, 255, 0);//12
              strip_1.setPixelColor(13, 0, 0, 0);//13
              strip_1.setPixelColor(14, 0, 0, 0);//14
              strip_1.setPixelColor(15, 155, 0, 155);//15
              strip_1.setPixelColor(16, 0, 0, 0);//16
              strip_1.setPixelColor(17, 0, 0, 0);//17
              strip_1.setPixelColor(18, 0, 255, 0);//18
              strip_1.setPixelColor(19, 0, 0, 0);//19
              strip_1.setPixelColor(20, 0, 0, 0);//20
              strip_1.setPixelColor(21, 155, 0, 155);//21
              strip_1.setPixelColor(22, 0, 0, 0);//22
              strip_1.setPixelColor(23, 0, 0, 0);//23
             
              strip_1.show();
            }
           
     

          else if ( potval <= 600)
          {
                //blue/magenta_half
                strip_1.setPixelColor(0, 0, 0, 255);//0
                strip_1.setPixelColor(1, 0, 0, 0);//1
                strip_1.setPixelColor(2, 255, 0, 255);//2
                strip_1.setPixelColor(3, 0, 0, 0);//3
                strip_1.setPixelColor(4, 0, 0, 255);//4
                strip_1.setPixelColor(5, 0, 0, 0);//5
                strip_1.setPixelColor(6, 255,0, 255);//6
                strip_1.setPixelColor(7, 0, 0, 0);//7
                strip_1.setPixelColor(8, 0, 0, 255);//8
                strip_1.setPixelColor(9, 0, 0, 0);//9
                strip_1.setPixelColor(10, 255, 0, 255);//10
                strip_1.setPixelColor(11, 0, 0, 0);//11
                strip_1.setPixelColor(12, 0, 0, 255);//12
                strip_1.setPixelColor(13, 0, 0, 0);//13
                strip_1.setPixelColor(14, 255, 0, 255);//14
                strip_1.setPixelColor(15, 0, 0, 0);//15
                strip_1.setPixelColor(16, 0, 0, 255);//16
                strip_1.setPixelColor(17, 0, 0, 0);//17
                strip_1.setPixelColor(18, 255, 0, 255);//18
                strip_1.setPixelColor(19, 0, 0, 0);//19
                strip_1.setPixelColor(20, 0, 0, 255);//20
                strip_1.setPixelColor(21, 0, 0, 0);//21
                strip_1.setPixelColor(22, 255, 0, 255);//22
                strip_1.setPixelColor(23, 0, 0, 0);//23   
                strip_1.show();
              }
       
       

        else if ( potval <= 640)
        {
              strip_1.setPixelColor(blue_magenta_full);
        }


        else if ( potval <= 700)
        {
            //red_magenta_half
            strip_1.setPixelColor(1, 0, 0, 0);//1
            strip_1.setPixelColor(2, 255, 0, 255);//2
            strip_1.setPixelColor(3, 0, 0, 0);//3
            strip_1.setPixelColor(4, 255, 0, 0);//4
            strip_1.setPixelColor(5, 0, 0, 0);//5
            strip_1.setPixelColor(6, 255,0, 255);//6
            strip_1.setPixelColor(7, 0, 0, 0);//7
            strip_1.setPixelColor(8, 255, 0, 0);//8
            strip_1.setPixelColor(9, 0, 0, 0);//9
            strip_1.setPixelColor(10, 255, 0, 255);//10
            strip_1.setPixelColor(11, 0, 0, 0);//11
            strip_1.setPixelColor(12, 255, 0, 0);//12
            strip_1.setPixelColor(13, 0, 0, 0);//13
            strip_1.setPixelColor(14, 255, 0, 255);//14
            strip_1.setPixelColor(15, 0, 0, 0);//15
            strip_1.setPixelColor(16, 255, 0, 0);//16
            strip_1.setPixelColor(17, 0, 0, 0);//17
            strip_1.setPixelColor(18, 255, 0, 255);//18
            strip_1.setPixelColor(19, 0, 0, 0);//19
            strip_1.setPixelColor(20, 255, 0, 0);//20
            strip_1.setPixelColor(21, 0, 0, 0);//21
            strip_1.setPixelColor(22, 255, 0, 255);//22
            strip_1.setPixelColor(23, 0, 0, 0);//23   
            strip_1.show
         
        }
       
        else if ( potval >740)
        {
            //red/blue_half
            strip_1.setPixelColor(0, 255, 0, 0);//0
            strip_1.setPixelColor(1, 0, 0, 0);//1
            strip_1.setPixelColor(2, 0, 255,0);//2
            strip_1.setPixelColor(3, 0, 0, 0);//3
            strip_1.setPixelColor(4, 0, 0, 255);//4
            strip_1.setPixelColor(5, 0, 0, 0);//5
            strip_1.setPixelColor(6, 255, 0, 0);//6
            strip_1.setPixelColor(7, 0, 0, 0);//7
            strip_1.setPixelColor(8, 0, 255, 0);//8
            strip_1.setPixelColor(9, 0, 0, 0);//9
            strip_1.setPixelColor(10, 0, 0, 255);//10
            strip_1.setPixelColor(11, 0, 0, 0);//11
            strip_1.setPixelColor(12, 255, 0, 0);//12
            strip_1.setPixelColor(13, 0, 0, 0);//13
            strip_1.setPixelColor(14, 0, 255, 0);//14
            strip_1.setPixelColor(15, 0, 0, 0);//15
            strip_1.setPixelColor(16, 0, 0, 255);//16
            strip_1.setPixelColor(17, 0, 0, 0);//17
            strip_1.setPixelColor(18, 255,0, 0);//18
            strip_1.setPixelColor(19, 0, 0, 0);//19
            strip_1.setPixelColor(20, 255, 0, 0);//20
            strip_1.setPixelColor(21, 0, 0, 0);//21
            strip_1.setPixelColor(22, 0, 255, 0);//22
            strip_1.setPixelColor(23,0, 0, 0);//23
           
            strip_1.show();
          }
           
           
           

          else if ( potval <= 780)
          {
              //red/green/blue_full
              strip_1.setPixelColor(0, 255, 0, 0);
              strip_1.setPixelColor(1, 0, 255, 0);
              strip_1.setPixelColor(2, 0, 0,255);
              strip_1.setPixelColor(3, 255, 0, 0);
              strip_1.setPixelColor(4, 0, 255, 0);
              strip_1.setPixelColor(5, 0, 0, 255);
              strip_1.setPixelColor(6, 255, 0, 0);
              strip_1.setPixelColor(7, 0, 255, 0);
              strip_1.setPixelColor(8, 0, 0, 255);
              strip_1.setPixelColor(9, 255, 0, 0);
              strip_1.setPixelColor(10,0 , 255, 0);
              strip_1.setPixelColor(11, 0, 0, 255);
              strip_1.setPixelColor(12, 255, 0, 0);
              strip_1.setPixelColor(13, 0, 255, 0);
              strip_1.setPixelColor(14, 0, 0, 255);
              strip_1.setPixelColor(15, 255, 0, 0);
              strip_1.setPixelColor(16, 0, 255, 0);
              strip_1.setPixelColor(17, 255, 0, 0);
              strip_1.setPixelColor(18, 0, 255, 0);
              strip_1.setPixelColor(19, 0, 0, 255);
              strip_1.setPixelColor(20, 255, 0, 0);
              strip_1.setPixelColor(21, 0, 255, 0);
              strip_1.setPixelColor(22, 0, 0, 255);
              strip_1.setPixelColor(23, 255, 0, 0);
               
              strip_1.show();
            }

   
}       


              void red_half()
              {
                  for (int i = 0; i < 24; i += 2)
                  {
                     strip_1.setPixelColor(i, 255, 0, 0);//0
                     strip_1.setPixelColor(i+1, 0, 0, 0);//1
                     strip_1.show();
                  }
               }
             
              void red_full()
              {
                   
                for (int i = 0; i < 24; i += 2)
                {
                    strip_1.setPixelColor(i, 255, 0, 0);//0
                    strip_1.setPixelColor(i+1, 255, 0, 0);//1
                    strip_1.show();
                    }
              }
                   
              void blue_half()
              {
                 for (int i = 0; i < 24; i += 2)
                 {
                    strip_1.setPixelColor(i, 0, 0, 255);//0
                    strip_1.setPixelColor(i+1, 0, 0, 0);//1
                    strip_1.show();
                    }
              }
                   
              void blue_full()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_1.setPixelColor(i, 0, 0, 255);//0
                    strip_1.setPixelColor(i+1, 0, 0, 255);//1
                    strip_1.show();
                    }
              }
                   
              void green_half
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_1.setPixelColor(i, 0, 255, 0);//0
                    strip_1.setPixelColor(i+1, 0, 0, 0);//1
                    strip_1.show();
                    }
              }
                   
              void green_full()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_1.setPixelColor(i, 0, 255, 0);//0
                    strip_1.setPixelColor(i+1, 0, 0, 0);//1
                    strip_1.show();
                    }
              }
                   
              void green_blue()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_1.setPixelColor(i, 0, 255, 0);//0
                    strip_1.setPixelColor(i+1, 0, 0, 255);//1
                    strip_1.show();
                    }
              }
                   
              void blue_magenta_full()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_1.setPixelColor(i, 0, 255, 0);//0
                    strip_1.setPixelColor(i+1, 0, 0, 255);//1
                    strip_1.show();
               }
}
     
     









 


slurry bowl
 
Posts: 122
Joined: Sun Nov 11, 2012 6:37 pm

Re: CONTROLLING 3 NEOPIXEL RINGS FROM ONE ARDUINO

by adafruit_support_bill on Wed Apr 16, 2014 5:48 am

The compiler doesn't care about indenting. But it sure makes it a lot easier to see when things are not balanced.

In this line you are calling the setPixel function which expects a pixel number and a color:
Code: Select all | TOGGLE FULL SIZE
strip_1.setPixelColor(red_half);

Instead, you are passing it the name of another function. What you want to do is just call the function:
Code: Select all | TOGGLE FULL SIZE
red_half();
User avatar
adafruit_support_bill
 
Posts: 30120
Joined: Sat Feb 07, 2009 10:11 am

Re: CONTROLLING 3 NEOPIXEL RINGS FROM ONE ARDUINO

by slurry bowl on Thu Apr 17, 2014 7:57 pm

Finally got it working!!

THANKS BILL !!!!!!

I am able to control 3 NeoPixel 24 rings with 3 pots. For me this is huge. Ive learned functions and code organization. While not perfect, here is that working code:

Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_NeoPixel.h>

#define PIN_1 2
#define PIN_2 3
#define PIN_3 4

Adafruit_NeoPixel strip_1 = Adafruit_NeoPixel(24, PIN_1, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip_2 = Adafruit_NeoPixel(24, PIN_2, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip_3 = Adafruit_NeoPixel(24, PIN_3, NEO_GRB + NEO_KHZ800);

int potpin_1 = 1;
int potpin_2 = 2;
int potpin_3 = 3;

int potval_1 = 0;
int potval_2 = 0;
int potval_3 = 0;


void setup()
{
 
  Serial.begin(9600);

  strip_1.begin();
  strip_2.begin();
  strip_3.begin();

  strip_1.show();
  strip_2.show();
  strip_3.show();
 
}

void loop()
{
 
    potval_1 = analogRead(potpin_1);
    potval_2 = analogRead(potpin_2);
    potval_3 = analogRead(potpin_3);

    Serial.println(potval_1);
    Serial.println(potval_2);
    Serial.println(potval_3);

    if ( potval_1 <=40 )
    {
       red_half_1();
    }
 
    else if ( potval_1 <= 80)
    {
      red_full_1();
    }

    else if ( potval_1 <= 120)
    {
      blue_half_1();
    }

    else if ( potval_1 <= 160)
    {
       blue_full_1();
    }

    else if ( potval_1 <= 200)
    {
     
      green_half_1();
    }

     else if ( potval_1 <= 240)
     {

      green_full_1();
     }

     else if ( potval_1 <= 300)
     
     {

          //green/blue_half
          strip_1.setPixelColor(0, 0, 255, 0);//0
          strip_1.setPixelColor(1, 0, 0, 0);//1
          strip_1.setPixelColor(2, 0, 0, 255);//2
          strip_1.setPixelColor(3, 0, 0, 0);//3
          strip_1.setPixelColor(4, 0, 255, 0);//4
          strip_1.setPixelColor(5, 0, 0, 0);//5
          strip_1.setPixelColor(6, 0, 0, 255);//6
          strip_1.setPixelColor(7, 0, 0, 0);//7
          strip_1.setPixelColor(8, 0, 255, 0);//8
          strip_1.setPixelColor(9, 0, 0, 0);//9
          strip_1.setPixelColor(10, 0, 0, 255);//10
          strip_1.setPixelColor(11, 0, 0, 0);//11
          strip_1.setPixelColor(12, 0, 255, 0);//12
          strip_1.setPixelColor(13, 0, 0, 0);//13
          strip_1.setPixelColor(14, 0, 0, 255);//14
          strip_1.setPixelColor(15, 0, 0, 0);//15
          strip_1.setPixelColor(16, 0, 255, 0);//16
          strip_1.setPixelColor(17, 0, 0, 0);//17
          strip_1.setPixelColor(18, 0, 0, 255);//18
          strip_1.setPixelColor(19, 0, 0, 0);//19
          strip_1.setPixelColor(20, 0, 255, 0);//20
          strip_1.setPixelColor(21, 0, 0, 0);//21
          strip_1.setPixelColor(22, 0, 0, 255);//22
          strip_1.setPixelColor(23, 0, 0, 0);//23 

          strip_1.show();
      }
     


      else if ( potval_1 <= 340)
      {
        green_blue_1;
      }

      else if ( potval_1 <= 380)
      {
 
          //green_red_half
          strip_1.setPixelColor(0, 0, 255, 0);//0
          strip_1.setPixelColor(1, 0, 0, 0);//1
          strip_1.setPixelColor(2, 255, 0, 0);//2
          strip_1.setPixelColor(3, 0, 0, 0);//3
          strip_1.setPixelColor(4, 0, 255, 0);//4
          strip_1.setPixelColor(5, 0, 0, 0);//5
          strip_1.setPixelColor(6, 255,0, 0);//6
          strip_1.setPixelColor(7, 0, 0, 0);//7
          strip_1.setPixelColor(8, 0, 255, 0);//8
          strip_1.setPixelColor(9, 0, 0, 0);//9
          strip_1.setPixelColor(10, 255, 0, 0);//10
          strip_1.setPixelColor(11, 0, 0, 0);//11
          strip_1.setPixelColor(12, 0,255, 0);//12
          strip_1.setPixelColor(13, 0, 0, 0);//13
          strip_1.setPixelColor(14, 255, 0, 0);//14
          strip_1.setPixelColor(15, 0, 0, 0);//15
          strip_1.setPixelColor(16, 0, 255, 0);//16
          strip_1.setPixelColor(17, 0, 0, 0);//17
          strip_1.setPixelColor(18, 255, 0, 0);//18
          strip_1.setPixelColor(19, 0, 0, 0);//19
          strip_1.setPixelColor(20, 0, 255, 0);//20
          strip_1.setPixelColor(21, 0, 0, 0);//21
          strip_1.setPixelColor(22, 255, 0, 0);//22
          strip_1.setPixelColor(23, 0, 0, 0);//23 
     
          strip_1.show();
      }
 
 

      else if ( potval_1 <= 420)
      {
       green_red_1();
      }
     
      else if ( potval_1 <= 460)
      {
               //green/magneta_half
              strip_1.setPixelColor(0, 0, 255, 0);//0
              strip_1.setPixelColor(1, 0, 0, 0);//1
              strip_1.setPixelColor(2, 255, 0, 255);//2
              strip_1.setPixelColor(3, 0, 0, 0);//3
              strip_1.setPixelColor(4, 0, 255, 0);//4
              strip_1.setPixelColor(5, 0, 0, 0);//5
              strip_1.setPixelColor(6, 255,0, 255);//6
              strip_1.setPixelColor(7, 0, 0, 0);//7
              strip_1.setPixelColor(8, 0, 255, 0);//8
              strip_1.setPixelColor(9, 0, 0, 0);//9
              strip_1.setPixelColor(10, 255, 0, 255);//10
              strip_1.setPixelColor(11, 0, 0, 0);//11
              strip_1.setPixelColor(12, 0,255, 0);//12
              strip_1.setPixelColor(13, 0, 0, 0);//13
              strip_1.setPixelColor(14, 255, 0, 255);//14
              strip_1.setPixelColor(15, 0, 0, 0);//15
              strip_1.setPixelColor(16, 0, 255, 0);//16
              strip_1.setPixelColor(17, 0, 0, 0);//17
              strip_1.setPixelColor(18, 255, 0, 255);//18
              strip_1.setPixelColor(19, 0, 0, 0);//19
              strip_1.setPixelColor(20, 0, 255, 0);//20
              strip_1.setPixelColor(21, 0, 0, 0);//21
              strip_1.setPixelColor(22, 255, 0, 255);//22
              strip_1.setPixelColor(23, 0, 0, 0);//23   
       
              strip_1.show();
         }
 
 
 
         else if ( potval_1 <= 500)
         {
          green_magenta_full_1();
         }
 
         else if ( potval_1 <= 540)
         {
              //green_magenta_weak
              strip_1.setPixelColor(0, 0, 255, 0);//0
              strip_1.setPixelColor(1, 0, 0, 0);//1
              strip_1.setPixelColor(2, 0, 0, 0);//2
              strip_1.setPixelColor(3, 155, 0, 155);//3
              strip_1.setPixelColor(4, 0, 0, 0);//4
              strip_1.setPixelColor(5, 0, 0, 0);//5
              strip_1.setPixelColor(6, 0, 255, 0);//6
              strip_1.setPixelColor(7, 0, 0, 0);//7
              strip_1.setPixelColor(8, 0, 0, 0);//8
              strip_1.setPixelColor(9, 155, 0, 155);//9
              strip_1.setPixelColor(10, 0, 0, 0);//10
              strip_1.setPixelColor(11, 0, 0, 0);//11
              strip_1.setPixelColor(12, 0, 255, 0);//12
              strip_1.setPixelColor(13, 0, 0, 0);//13
              strip_1.setPixelColor(14, 0, 0, 0);//14
              strip_1.setPixelColor(15, 155, 0, 155);//15
              strip_1.setPixelColor(16, 0, 0, 0);//16
              strip_1.setPixelColor(17, 0, 0, 0);//17
              strip_1.setPixelColor(18, 0, 255, 0);//18
              strip_1.setPixelColor(19, 0, 0, 0);//19
              strip_1.setPixelColor(20, 0, 0, 0);//20
              strip_1.setPixelColor(21, 155, 0, 155);//21
              strip_1.setPixelColor(22, 0, 0, 0);//22
              strip_1.setPixelColor(23, 0, 0, 0);//23
             
              strip_1.show();
          }
           
     

          else if ( potval_1 <= 600)
          {
                //blue/magenta_half
                strip_1.setPixelColor(0, 0, 0, 255);//0
                strip_1.setPixelColor(1, 0, 0, 0);//1
                strip_1.setPixelColor(2, 255, 0, 255);//2
                strip_1.setPixelColor(3, 0, 0, 0);//3
                strip_1.setPixelColor(4, 0, 0, 255);//4
                strip_1.setPixelColor(5, 0, 0, 0);//5
                strip_1.setPixelColor(6, 255,0, 255);//6
                strip_1.setPixelColor(7, 0, 0, 0);//7
                strip_1.setPixelColor(8, 0, 0, 255);//8
                strip_1.setPixelColor(9, 0, 0, 0);//9
                strip_1.setPixelColor(10, 255, 0, 255);//10
                strip_1.setPixelColor(11, 0, 0, 0);//11
                strip_1.setPixelColor(12, 0, 0, 255);//12
                strip_1.setPixelColor(13, 0, 0, 0);//13
                strip_1.setPixelColor(14, 255, 0, 255);//14
                strip_1.setPixelColor(15, 0, 0, 0);//15
                strip_1.setPixelColor(16, 0, 0, 255);//16
                strip_1.setPixelColor(17, 0, 0, 0);//17
                strip_1.setPixelColor(18, 255, 0, 255);//18
                strip_1.setPixelColor(19, 0, 0, 0);//19
                strip_1.setPixelColor(20, 0, 0, 255);//20
                strip_1.setPixelColor(21, 0, 0, 0);//21
                strip_1.setPixelColor(22, 255, 0, 255);//22
                strip_1.setPixelColor(23, 0, 0, 0);//23   
                strip_1.show();
              }
       
       

              else if ( potval_1 <= 640)
              {
                    blue_magenta_full_1();
              }
     
     
              else if ( potval_1 <= 700)
              {
                  //red_magenta_half
                  strip_1.setPixelColor(0, 255, 0, 0);//0
                  strip_1.setPixelColor(1, 0, 0, 0);//1
                  strip_1.setPixelColor(2, 255, 0, 255);//2
                  strip_1.setPixelColor(3, 0, 0, 0);//3
                  strip_1.setPixelColor(4, 255, 0, 0);//4
                  strip_1.setPixelColor(5, 0, 0, 0);//5
                  strip_1.setPixelColor(6, 255,0, 255);//6
                  strip_1.setPixelColor(7, 0, 0, 0);//7
                  strip_1.setPixelColor(8, 255, 0, 0);//8
                  strip_1.setPixelColor(9, 0, 0, 0);//9
                  strip_1.setPixelColor(10, 255, 0, 255);//10
                  strip_1.setPixelColor(11, 0, 0, 0);//11
                  strip_1.setPixelColor(12, 255, 0, 0);//12
                  strip_1.setPixelColor(13, 0, 0, 0);//13
                  strip_1.setPixelColor(14, 255, 0, 255);//14
                  strip_1.setPixelColor(15, 0, 0, 0);//15
                  strip_1.setPixelColor(16, 255, 0, 0);//16
                  strip_1.setPixelColor(17, 0, 0, 0);//17
                  strip_1.setPixelColor(18, 255, 0, 255);//18
                  strip_1.setPixelColor(19, 0, 0, 0);//19
                  strip_1.setPixelColor(20, 255, 0, 0);//20
                  strip_1.setPixelColor(21, 0, 0, 0);//21
                  strip_1.setPixelColor(22, 255, 0, 255);//22
                  strip_1.setPixelColor(23, 0, 0, 0);//23   
                  strip_1.show();
                 
               
                  }
                 
                  else if ( potval_1 >740)
                  {
                      //red/blue_half
                      strip_1.setPixelColor(0, 255, 0, 0);//0
                      strip_1.setPixelColor(1, 0, 0, 0);//1
                      strip_1.setPixelColor(2, 0, 255,0);//2
                      strip_1.setPixelColor(3, 0, 0, 0);//3
                      strip_1.setPixelColor(4, 0, 0, 255);//4
                      strip_1.setPixelColor(5, 0, 0, 0);//5
                      strip_1.setPixelColor(6, 255, 0, 0);//6
                      strip_1.setPixelColor(7, 0, 0, 0);//7
                      strip_1.setPixelColor(8, 0, 255, 0);//8
                      strip_1.setPixelColor(9, 0, 0, 0);//9
                      strip_1.setPixelColor(10, 0, 0, 255);//10
                      strip_1.setPixelColor(11, 0, 0, 0);//11
                      strip_1.setPixelColor(12, 255, 0, 0);//12
                      strip_1.setPixelColor(13, 0, 0, 0);//13
                      strip_1.setPixelColor(14, 0, 255, 0);//14
                      strip_1.setPixelColor(15, 0, 0, 0);//15
                      strip_1.setPixelColor(16, 0, 0, 255);//16
                      strip_1.setPixelColor(17, 0, 0, 0);//17
                      strip_1.setPixelColor(18, 255,0, 0);//18
                      strip_1.setPixelColor(19, 0, 0, 0);//19
                      strip_1.setPixelColor(20, 255, 0, 0);//20
                      strip_1.setPixelColor(21, 0, 0, 0);//21
                      strip_1.setPixelColor(22, 0, 255, 0);//22
                      strip_1.setPixelColor(23,0, 0, 0);//23
                     
                      strip_1.show();
                    }
                     
                     
                     
         
                    else if ( potval_1 <= 780)
                    {
                        //red/green/blue_full
                        strip_1.setPixelColor(0, 255, 0, 0);
                        strip_1.setPixelColor(1, 0, 255, 0);
                        strip_1.setPixelColor(2, 0, 0,255);
                        strip_1.setPixelColor(3, 255, 0, 0);
                        strip_1.setPixelColor(4, 0, 255, 0);
                        strip_1.setPixelColor(5, 0, 0, 255);
                        strip_1.setPixelColor(6, 255, 0, 0);
                        strip_1.setPixelColor(7, 0, 255, 0);
                        strip_1.setPixelColor(8, 0, 0, 255);
                        strip_1.setPixelColor(9, 255, 0, 0);
                        strip_1.setPixelColor(10,0 , 255, 0);
                        strip_1.setPixelColor(11, 0, 0, 255);
                        strip_1.setPixelColor(12, 255, 0, 0);
                        strip_1.setPixelColor(13, 0, 255, 0);
                        strip_1.setPixelColor(14, 0, 0, 255);
                        strip_1.setPixelColor(15, 255, 0, 0);
                        strip_1.setPixelColor(16, 0, 255, 0);
                        strip_1.setPixelColor(17, 255, 0, 0);
                        strip_1.setPixelColor(18, 0, 255, 0);
                        strip_1.setPixelColor(19, 0, 0, 255);
                        strip_1.setPixelColor(20, 255, 0, 0);
                        strip_1.setPixelColor(21, 0, 255, 0);
                        strip_1.setPixelColor(22, 0, 0, 255);
                        strip_1.setPixelColor(23, 255, 0, 0);
                         
                        strip_1.show();
                      }
         
              //2nd strip code
              if ( potval_2 <=40 )
            {
               red_half_2();
            }
         
            else if ( potval_2 <= 80)
            {
              red_full_2();
            }
       
            else if ( potval_2 <= 120)
            {
              blue_half_2();
            }
       
            else if ( potval_2 <= 160)
            {
               blue_full_2();
            }
       
            else if ( potval_2 <= 200)
            {
             
              green_half_2();
            }
       
             else if ( potval_2 <= 240)
             {
       
              green_full_2();
             }
       
             else if ( potval_2 <= 300)
             
             {
       
                  //green/blue_half
                  strip_2.setPixelColor(0, 0, 255, 0);//0
                  strip_2.setPixelColor(1, 0, 0, 0);//1
                  strip_2.setPixelColor(2, 0, 0, 255);//2
                  strip_2.setPixelColor(3, 0, 0, 0);//3
                  strip_2.setPixelColor(4, 0, 255, 0);//4
                  strip_2.setPixelColor(5, 0, 0, 0);//5
                  strip_2.setPixelColor(6, 0, 0, 255);//6
                  strip_2.setPixelColor(7, 0, 0, 0);//7
                  strip_2.setPixelColor(8, 0, 255, 0);//8
                  strip_2.setPixelColor(9, 0, 0, 0);//9
                  strip_2.setPixelColor(10, 0, 0, 255);//10
                  strip_2.setPixelColor(11, 0, 0, 0);//11
                  strip_2.setPixelColor(12, 0, 255, 0);//12
                  strip_2.setPixelColor(13, 0, 0, 0);//13
                  strip_2.setPixelColor(14, 0, 0, 255);//14
                  strip_2.setPixelColor(15, 0, 0, 0);//15
                  strip_2.setPixelColor(16, 0, 255, 0);//16
                  strip_2.setPixelColor(17, 0, 0, 0);//17
                  strip_2.setPixelColor(18, 0, 0, 255);//18
                  strip_2.setPixelColor(19, 0, 0, 0);//19
                  strip_2.setPixelColor(20, 0, 255, 0);//20
                  strip_2.setPixelColor(21, 0, 0, 0);//21
                  strip_2.setPixelColor(22, 0, 0, 255);//22
                  strip_2.setPixelColor(23, 0, 0, 0);//23 
       
                  strip_2.show();
              }
             
       
       
              else if ( potval_2 <= 340)
              {
                green_blue_2;
              }
       
              else if ( potval_2 <= 380)
              {
         
                  //green_red_half
                  strip_2.setPixelColor(0, 0, 255, 0);//0
                  strip_2.setPixelColor(1, 0, 0, 0);//1
                  strip_2.setPixelColor(2, 255, 0, 0);//2
                  strip_2.setPixelColor(3, 0, 0, 0);//3
                  strip_2.setPixelColor(4, 0, 255, 0);//4
                  strip_2.setPixelColor(5, 0, 0, 0);//5
                  strip_2.setPixelColor(6, 255,0, 0);//6
                  strip_2.setPixelColor(7, 0, 0, 0);//7
                  strip_2.setPixelColor(8, 0, 255, 0);//8
                  strip_2.setPixelColor(9, 0, 0, 0);//9
                  strip_2.setPixelColor(10, 255, 0, 0);//10
                  strip_2.setPixelColor(11, 0, 0, 0);//11
                  strip_2.setPixelColor(12, 0,255, 0);//12
                  strip_2.setPixelColor(13, 0, 0, 0);//13
                  strip_2.setPixelColor(14, 255, 0, 0);//14
                  strip_2.setPixelColor(15, 0, 0, 0);//15
                  strip_2.setPixelColor(16, 0, 255, 0);//16
                  strip_2.setPixelColor(17, 0, 0, 0);//17
                  strip_2.setPixelColor(18, 255, 0, 0);//18
                  strip_2.setPixelColor(19, 0, 0, 0);//19
                  strip_2.setPixelColor(20, 0, 255, 0);//20
                  strip_2.setPixelColor(21, 0, 0, 0);//21
                  strip_2.setPixelColor(22, 255, 0, 0);//22
                  strip_2.setPixelColor(23, 0, 0, 0);//23 
             
                  strip_2.show();
              }
         
         
       
              else if ( potval_2 <= 420)
              {
               green_red_2();
              }
             
              else if ( potval_2 <= 460)
              {
                       //green/magneta_half
                      strip_2.setPixelColor(0, 0, 255, 0);//0
                      strip_2.setPixelColor(1, 0, 0, 0);//1
                      strip_2.setPixelColor(2, 255, 0, 255);//2
                      strip_2.setPixelColor(3, 0, 0, 0);//3
                      strip_2.setPixelColor(4, 0, 255, 0);//4
                      strip_2.setPixelColor(5, 0, 0, 0);//5
                      strip_2.setPixelColor(6, 255,0, 255);//6
                      strip_2.setPixelColor(7, 0, 0, 0);//7
                      strip_2.setPixelColor(8, 0, 255, 0);//8
                      strip_2.setPixelColor(9, 0, 0, 0);//9
                      strip_2.setPixelColor(10, 255, 0, 255);//10
                      strip_2.setPixelColor(11, 0, 0, 0);//11
                      strip_2.setPixelColor(12, 0,255, 0);//12
                      strip_2.setPixelColor(13, 0, 0, 0);//13
                      strip_2.setPixelColor(14, 255, 0, 255);//14
                      strip_2.setPixelColor(15, 0, 0, 0);//15
                      strip_2.setPixelColor(16, 0, 255, 0);//16
                      strip_2.setPixelColor(17, 0, 0, 0);//17
                      strip_2.setPixelColor(18, 255, 0, 255);//18
                      strip_2.setPixelColor(19, 0, 0, 0);//19
                      strip_2.setPixelColor(20, 0, 255, 0);//20
                      strip_2.setPixelColor(21, 0, 0, 0);//21
                      strip_2.setPixelColor(22, 255, 0, 255);//22
                      strip_2.setPixelColor(23, 0, 0, 0);//23   
               
                      strip_2.show();
                 }
         
         
         
                 else if ( potval_2 <= 500)
                 {
                  green_magenta_full_2();
                 }
         
                 else if ( potval_2 <= 540)
                 {
                      //green_magenta_weak
                      strip_2.setPixelColor(0, 0, 255, 0);//0
                      strip_2.setPixelColor(1, 0, 0, 0);//1
                      strip_2.setPixelColor(2, 0, 0, 0);//2
                      strip_2.setPixelColor(3, 155, 0, 155);//3
                      strip_2.setPixelColor(4, 0, 0, 0);//4
                      strip_2.setPixelColor(5, 0, 0, 0);//5
                      strip_2.setPixelColor(6, 0, 255, 0);//6
                      strip_2.setPixelColor(7, 0, 0, 0);//7
                      strip_2.setPixelColor(8, 0, 0, 0);//8
                      strip_2.setPixelColor(9, 155, 0, 155);//9
                      strip_2.setPixelColor(10, 0, 0, 0);//10
                      strip_2.setPixelColor(11, 0, 0, 0);//11
                      strip_2.setPixelColor(12, 0, 255, 0);//12
                      strip_2.setPixelColor(13, 0, 0, 0);//13
                      strip_2.setPixelColor(14, 0, 0, 0);//14
                      strip_2.setPixelColor(15, 155, 0, 155);//15
                      strip_2.setPixelColor(16, 0, 0, 0);//16
                      strip_2.setPixelColor(17, 0, 0, 0);//17
                      strip_2.setPixelColor(18, 0, 255, 0);//18
                      strip_2.setPixelColor(19, 0, 0, 0);//19
                      strip_2.setPixelColor(20, 0, 0, 0);//20
                      strip_2.setPixelColor(21, 155, 0, 155);//21
                      strip_2.setPixelColor(22, 0, 0, 0);//22
                      strip_2.setPixelColor(23, 0, 0, 0);//23
                     
                      strip_2.show();
                  }
                   
             
       
                  else if ( potval_2 <= 600)
                  {
                        //blue/magenta_half
                        strip_2.setPixelColor(0, 0, 0, 255);//0
                        strip_2.setPixelColor(1, 0, 0, 0);//1
                        strip_2.setPixelColor(2, 255, 0, 255);//2
                        strip_2.setPixelColor(3, 0, 0, 0);//3
                        strip_2.setPixelColor(4, 0, 0, 255);//4
                        strip_2.setPixelColor(5, 0, 0, 0);//5
                        strip_2.setPixelColor(6, 255,0, 255);//6
                        strip_2.setPixelColor(7, 0, 0, 0);//7
                        strip_2.setPixelColor(8, 0, 0, 255);//8
                        strip_2.setPixelColor(9, 0, 0, 0);//9
                        strip_2.setPixelColor(10, 255, 0, 255);//10
                        strip_2.setPixelColor(11, 0, 0, 0);//11
                        strip_2.setPixelColor(12, 0, 0, 255);//12
                        strip_2.setPixelColor(13, 0, 0, 0);//13
                        strip_2.setPixelColor(14, 255, 0, 255);//14
                        strip_2.setPixelColor(15, 0, 0, 0);//15
                        strip_2.setPixelColor(16, 0, 0, 255);//16
                        strip_2.setPixelColor(17, 0, 0, 0);//17
                        strip_2.setPixelColor(18, 255, 0, 255);//18
                        strip_2.setPixelColor(19, 0, 0, 0);//19
                        strip_2.setPixelColor(20, 0, 0, 255);//20
                        strip_2.setPixelColor(21, 0, 0, 0);//21
                        strip_2.setPixelColor(22, 255, 0, 255);//22
                        strip_2.setPixelColor(23, 0, 0, 0);//23   
                        strip_2.show();
                      }
               
               
       
                      else if ( potval_2 <= 640)
                      {
                            blue_magenta_full_2();
                      }
             
             
                      else if ( potval_2 <= 700)
                      {
                          //red_magenta_half
                          strip_2.setPixelColor(0, 255, 0, 0);//0
                          strip_2.setPixelColor(1, 0, 0, 0);//1
                          strip_2.setPixelColor(2, 255, 0, 255);//2
                          strip_2.setPixelColor(3, 0, 0, 0);//3
                          strip_2.setPixelColor(4, 255, 0, 0);//4
                          strip_2.setPixelColor(5, 0, 0, 0);//5
                          strip_2.setPixelColor(6, 255,0, 255);//6
                          strip_2.setPixelColor(7, 0, 0, 0);//7
                          strip_2.setPixelColor(8, 255, 0, 0);//8
                          strip_2.setPixelColor(9, 0, 0, 0);//9
                          strip_2.setPixelColor(10, 255, 0, 255);//10
                          strip_2.setPixelColor(11, 0, 0, 0);//11
                          strip_2.setPixelColor(12, 255, 0, 0);//12
                          strip_2.setPixelColor(13, 0, 0, 0);//13
                          strip_2.setPixelColor(14, 255, 0, 255);//14
                          strip_2.setPixelColor(15, 0, 0, 0);//15
                          strip_2.setPixelColor(16, 255, 0, 0);//16
                          strip_2.setPixelColor(17, 0, 0, 0);//17
                          strip_2.setPixelColor(18, 255, 0, 255);//18
                          strip_2.setPixelColor(19, 0, 0, 0);//19
                          strip_2.setPixelColor(20, 255, 0, 0);//20
                          strip_2.setPixelColor(21, 0, 0, 0);//21
                          strip_2.setPixelColor(22, 255, 0, 255);//22
                          strip_2.setPixelColor(23, 0, 0, 0);//23   
                          strip_2.show();
                         
                       
                          }
                         
                          else if ( potval_2 >740)
                          {
                              //red/blue_half
                              strip_2.setPixelColor(0, 255, 0, 0);//0
                              strip_2.setPixelColor(1, 0, 0, 0);//1
                              strip_2.setPixelColor(2, 0, 255,0);//2
                              strip_2.setPixelColor(3, 0, 0, 0);//3
                              strip_2.setPixelColor(4, 0, 0, 255);//4
                              strip_2.setPixelColor(5, 0, 0, 0);//5
                              strip_2.setPixelColor(6, 255, 0, 0);//6
                              strip_2.setPixelColor(7, 0, 0, 0);//7
                              strip_2.setPixelColor(8, 0, 255, 0);//8
                              strip_2.setPixelColor(9, 0, 0, 0);//9
                              strip_2.setPixelColor(10, 0, 0, 255);//10
                              strip_2.setPixelColor(11, 0, 0, 0);//11
                              strip_2.setPixelColor(12, 255, 0, 0);//12
                              strip_2.setPixelColor(13, 0, 0, 0);//13
                              strip_2.setPixelColor(14, 0, 255, 0);//14
                              strip_2.setPixelColor(15, 0, 0, 0);//15
                              strip_2.setPixelColor(16, 0, 0, 255);//16
                              strip_2.setPixelColor(17, 0, 0, 0);//17
                              strip_2.setPixelColor(18, 255,0, 0);//18
                              strip_2.setPixelColor(19, 0, 0, 0);//19
                              strip_2.setPixelColor(20, 255, 0, 0);//20
                              strip_2.setPixelColor(21, 0, 0, 0);//21
                              strip_2.setPixelColor(22, 0, 255, 0);//22
                              strip_2.setPixelColor(23,0, 0, 0);//23
                             
                              strip_2.show();
                            }
                             
                             
                             
                 
                            else if ( potval_2 <= 780)
                            {
                                //red/green/blue_full
                                strip_2.setPixelColor(0, 255, 0, 0);
                                strip_2.setPixelColor(1, 0, 255, 0);
                                strip_2.setPixelColor(2, 0, 0,255);
                                strip_2.setPixelColor(3, 255, 0, 0);
                                strip_2.setPixelColor(4, 0, 255, 0);
                                strip_2.setPixelColor(5, 0, 0, 255);
                                strip_2.setPixelColor(6, 255, 0, 0);
                                strip_2.setPixelColor(7, 0, 255, 0);
                                strip_2.setPixelColor(8, 0, 0, 255);
                                strip_2.setPixelColor(9, 255, 0, 0);
                                strip_2.setPixelColor(10,0 , 255, 0);
                                strip_2.setPixelColor(11, 0, 0, 255);
                                strip_2.setPixelColor(12, 255, 0, 0);
                                strip_2.setPixelColor(13, 0, 255, 0);
                                strip_2.setPixelColor(14, 0, 0, 255);
                                strip_2.setPixelColor(15, 255, 0, 0);
                                strip_2.setPixelColor(16, 0, 255, 0);
                                strip_2.setPixelColor(17, 255, 0, 0);
                                strip_2.setPixelColor(18, 0, 255, 0);
                                strip_2.setPixelColor(19, 0, 0, 255);
                                strip_2.setPixelColor(20, 255, 0, 0);
                                strip_2.setPixelColor(21, 0, 255, 0);
                                strip_2.setPixelColor(22, 0, 0, 255);
                                strip_2.setPixelColor(23, 255, 0, 0);
                                 
                                strip_2.show();
                              }
           
              // 3rd strip code
             
                 if ( potval_3 <=40 )
            {
               red_half_3();
            }
         
            else if ( potval_3 <= 80)
            {
              red_full_3();
            }
       
            else if ( potval_3 <= 120)
            {
              blue_half_3();
            }
       
            else if ( potval_3 <= 160)
            {
               blue_full_3();
            }
       
            else if ( potval_3 <= 200)
            {
             
              green_half_3();
            }
       
             else if ( potval_3 <= 240)
             {
       
              green_full_3();
             }
       
             else if ( potval_3 <= 300)
             
             {
       
                  //green/blue_half
                  strip_3.setPixelColor(0, 0, 255, 0);//0
                  strip_3.setPixelColor(1, 0, 0, 0);//1
                  strip_3.setPixelColor(2, 0, 0, 255);//2
                  strip_3.setPixelColor(3, 0, 0, 0);//3
                  strip_3.setPixelColor(4, 0, 255, 0);//4
                  strip_3.setPixelColor(5, 0, 0, 0);//5
                  strip_3.setPixelColor(6, 0, 0, 255);//6
                  strip_3.setPixelColor(7, 0, 0, 0);//7
                  strip_3.setPixelColor(8, 0, 255, 0);//8
                  strip_3.setPixelColor(9, 0, 0, 0);//9
                  strip_3.setPixelColor(10, 0, 0, 255);//10
                  strip_3.setPixelColor(11, 0, 0, 0);//11
                  strip_3.setPixelColor(12, 0, 255, 0);//12
                  strip_3.setPixelColor(13, 0, 0, 0);//13
                  strip_3.setPixelColor(14, 0, 0, 255);//14
                  strip_3.setPixelColor(15, 0, 0, 0);//15
                  strip_3.setPixelColor(16, 0, 255, 0);//16
                  strip_3.setPixelColor(17, 0, 0, 0);//17
                  strip_3.setPixelColor(18, 0, 0, 255);//18
                  strip_3.setPixelColor(19, 0, 0, 0);//19
                  strip_3.setPixelColor(20, 0, 255, 0);//20
                  strip_3.setPixelColor(21, 0, 0, 0);//21
                  strip_3.setPixelColor(22, 0, 0, 255);//22
                  strip_3.setPixelColor(23, 0, 0, 0);//23 
       
                  strip_3.show();
              }
             
       
       
              else if ( potval_3 <= 340)
              {
                green_blue_3;
              }
       
              else if ( potval_3 <= 380)
              {
         
                  //green_red_half
                  strip_3.setPixelColor(0, 0, 255, 0);//0
                  strip_3.setPixelColor(1, 0, 0, 0);//1
                  strip_3.setPixelColor(2, 255, 0, 0);//2
                  strip_3.setPixelColor(3, 0, 0, 0);//3
                  strip_3.setPixelColor(4, 0, 255, 0);//4
                  strip_3.setPixelColor(5, 0, 0, 0);//5
                  strip_3.setPixelColor(6, 255,0, 0);//6
                  strip_3.setPixelColor(7, 0, 0, 0);//7
                  strip_3.setPixelColor(8, 0, 255, 0);//8
                  strip_3.setPixelColor(9, 0, 0, 0);//9
                  strip_3.setPixelColor(10, 255, 0, 0);//10
                  strip_3.setPixelColor(11, 0, 0, 0);//11
                  strip_3.setPixelColor(12, 0,255, 0);//12
                  strip_3.setPixelColor(13, 0, 0, 0);//13
                  strip_3.setPixelColor(14, 255, 0, 0);//14
                  strip_3.setPixelColor(15, 0, 0, 0);//15
                  strip_3.setPixelColor(16, 0, 255, 0);//16
                  strip_3.setPixelColor(17, 0, 0, 0);//17
                  strip_3.setPixelColor(18, 255, 0, 0);//18
                  strip_3.setPixelColor(19, 0, 0, 0);//19
                  strip_3.setPixelColor(20, 0, 255, 0);//20
                  strip_3.setPixelColor(21, 0, 0, 0);//21
                  strip_3.setPixelColor(22, 255, 0, 0);//22
                  strip_3.setPixelColor(23, 0, 0, 0);//23 
             
                  strip_3.show();
              }
         
         
       
              else if ( potval_3 <= 420)
              {
               green_red_3();
              }
             
              else if ( potval_3 <= 460)
              {
                       //green/magneta_half
                      strip_3.setPixelColor(0, 0, 255, 0);//0
                      strip_3.setPixelColor(1, 0, 0, 0);//1
                      strip_3.setPixelColor(2, 255, 0, 255);//2
                      strip_3.setPixelColor(3, 0, 0, 0);//3
                      strip_3.setPixelColor(4, 0, 255, 0);//4
                      strip_3.setPixelColor(5, 0, 0, 0);//5
                      strip_3.setPixelColor(6, 255,0, 255);//6
                      strip_3.setPixelColor(7, 0, 0, 0);//7
                      strip_3.setPixelColor(8, 0, 255, 0);//8
                      strip_3.setPixelColor(9, 0, 0, 0);//9
                      strip_3.setPixelColor(10, 255, 0, 255);//10
                      strip_3.setPixelColor(11, 0, 0, 0);//11
                      strip_3.setPixelColor(12, 0,255, 0);//12
                      strip_3.setPixelColor(13, 0, 0, 0);//13
                      strip_3.setPixelColor(14, 255, 0, 255);//14
                      strip_3.setPixelColor(15, 0, 0, 0);//15
                      strip_3.setPixelColor(16, 0, 255, 0);//16
                      strip_3.setPixelColor(17, 0, 0, 0);//17
                      strip_3.setPixelColor(18, 255, 0, 255);//18
                      strip_3.setPixelColor(19, 0, 0, 0);//19
                      strip_3.setPixelColor(20, 0, 255, 0);//20
                      strip_3.setPixelColor(21, 0, 0, 0);//21
                      strip_3.setPixelColor(22, 255, 0, 255);//22
                      strip_3.setPixelColor(23, 0, 0, 0);//23   
               
                      strip_3.show();
                 }
         
         
         
                 else if ( potval_3 <= 500)
                 {
                  green_magenta_full_3();
                 }
         
                 else if ( potval_3 <= 540)
                 {
                      //green_magenta_weak
                      strip_3.setPixelColor(0, 0, 255, 0);//0
                      strip_3.setPixelColor(1, 0, 0, 0);//1
                      strip_3.setPixelColor(2, 0, 0, 0);//2
                      strip_3.setPixelColor(3, 155, 0, 155);//3
                      strip_3.setPixelColor(4, 0, 0, 0);//4
                      strip_3.setPixelColor(5, 0, 0, 0);//5
                      strip_3.setPixelColor(6, 0, 255, 0);//6
                      strip_3.setPixelColor(7, 0, 0, 0);//7
                      strip_3.setPixelColor(8, 0, 0, 0);//8
                      strip_3.setPixelColor(9, 155, 0, 155);//9
                      strip_3.setPixelColor(10, 0, 0, 0);//10
                      strip_3.setPixelColor(11, 0, 0, 0);//11
                      strip_3.setPixelColor(12, 0, 255, 0);//12
                      strip_3.setPixelColor(13, 0, 0, 0);//13
                      strip_3.setPixelColor(14, 0, 0, 0);//14
                      strip_3.setPixelColor(15, 155, 0, 155);//15
                      strip_3.setPixelColor(16, 0, 0, 0);//16
                      strip_3.setPixelColor(17, 0, 0, 0);//17
                      strip_3.setPixelColor(18, 0, 255, 0);//18
                      strip_3.setPixelColor(19, 0, 0, 0);//19
                      strip_3.setPixelColor(20, 0, 0, 0);//20
                      strip_3.setPixelColor(21, 155, 0, 155);//21
                      strip_3.setPixelColor(22, 0, 0, 0);//22
                      strip_3.setPixelColor(23, 0, 0, 0);//23
                     
                      strip_3.show();
                  }
                   
             
       
                  else if ( potval_3 <= 600)
                  {
                        //blue/magenta_half
                        strip_3.setPixelColor(0, 0, 0, 255);//0
                        strip_3.setPixelColor(1, 0, 0, 0);//1
                        strip_3.setPixelColor(2, 255, 0, 255);//2
                        strip_3.setPixelColor(3, 0, 0, 0);//3
                        strip_3.setPixelColor(4, 0, 0, 255);//4
                        strip_3.setPixelColor(5, 0, 0, 0);//5
                        strip_3.setPixelColor(6, 255,0, 255);//6
                        strip_3.setPixelColor(7, 0, 0, 0);//7
                        strip_3.setPixelColor(8, 0, 0, 255);//8
                        strip_3.setPixelColor(9, 0, 0, 0);//9
                        strip_3.setPixelColor(10, 255, 0, 255);//10
                        strip_3.setPixelColor(11, 0, 0, 0);//11
                        strip_3.setPixelColor(12, 0, 0, 255);//12
                        strip_3.setPixelColor(13, 0, 0, 0);//13
                        strip_3.setPixelColor(14, 255, 0, 255);//14
                        strip_3.setPixelColor(15, 0, 0, 0);//15
                        strip_3.setPixelColor(16, 0, 0, 255);//16
                        strip_3.setPixelColor(17, 0, 0, 0);//17
                        strip_3.setPixelColor(18, 255, 0, 255);//18
                        strip_3.setPixelColor(19, 0, 0, 0);//19
                        strip_3.setPixelColor(20, 0, 0, 255);//20
                        strip_3.setPixelColor(21, 0, 0, 0);//21
                        strip_3.setPixelColor(22, 255, 0, 255);//22
                        strip_3.setPixelColor(23, 0, 0, 0);//23   
                        strip_3.show();
                      }
               
               
       
                      else if ( potval_3 <= 640)
                      {
                            blue_magenta_full_3();
                      }
             
             
                      else if ( potval_3 <= 700)
                      {
                          //red_magenta_half
                          strip_3.setPixelColor(0, 255, 0, 0);//0
                          strip_3.setPixelColor(1, 0, 0, 0);//1
                          strip_3.setPixelColor(2, 255, 0, 255);//2
                          strip_3.setPixelColor(3, 0, 0, 0);//3
                          strip_3.setPixelColor(4, 255, 0, 0);//4
                          strip_3.setPixelColor(5, 0, 0, 0);//5
                          strip_3.setPixelColor(6, 255,0, 255);//6
                          strip_3.setPixelColor(7, 0, 0, 0);//7
                          strip_3.setPixelColor(8, 255, 0, 0);//8
                          strip_3.setPixelColor(9, 0, 0, 0);//9
                          strip_3.setPixelColor(10, 255, 0, 255);//10
                          strip_3.setPixelColor(11, 0, 0, 0);//11
                          strip_3.setPixelColor(12, 255, 0, 0);//12
                          strip_3.setPixelColor(13, 0, 0, 0);//13
                          strip_3.setPixelColor(14, 255, 0, 255);//14
                          strip_3.setPixelColor(15, 0, 0, 0);//15
                          strip_3.setPixelColor(16, 255, 0, 0);//16
                          strip_3.setPixelColor(17, 0, 0, 0);//17
                          strip_3.setPixelColor(18, 255, 0, 255);//18
                          strip_3.setPixelColor(19, 0, 0, 0);//19
                          strip_3.setPixelColor(20, 255, 0, 0);//20
                          strip_3.setPixelColor(21, 0, 0, 0);//21
                          strip_3.setPixelColor(22, 255, 0, 255);//22
                          strip_3.setPixelColor(23, 0, 0, 0);//23   
                          strip_3.show();
                         
                       
                          }
                         
                          else if ( potval_3 >740)
                          {
                              //red/blue_half
                              strip_3.setPixelColor(0, 255, 0, 0);//0
                              strip_3.setPixelColor(1, 0, 0, 0);//1
                              strip_3.setPixelColor(2, 0, 255,0);//2
                              strip_3.setPixelColor(3, 0, 0, 0);//3
                              strip_3.setPixelColor(4, 0, 0, 255);//4
                              strip_3.setPixelColor(5, 0, 0, 0);//5
                              strip_3.setPixelColor(6, 255, 0, 0);//6
                              strip_3.setPixelColor(7, 0, 0, 0);//7
                              strip_3.setPixelColor(8, 0, 255, 0);//8
                              strip_3.setPixelColor(9, 0, 0, 0);//9
                              strip_3.setPixelColor(10, 0, 0, 255);//10
                              strip_3.setPixelColor(11, 0, 0, 0);//11
                              strip_3.setPixelColor(12, 255, 0, 0);//12
                              strip_3.setPixelColor(13, 0, 0, 0);//13
                              strip_3.setPixelColor(14, 0, 255, 0);//14
                              strip_3.setPixelColor(15, 0, 0, 0);//15
                              strip_3.setPixelColor(16, 0, 0, 255);//16
                              strip_3.setPixelColor(17, 0, 0, 0);//17
                              strip_3.setPixelColor(18, 255,0, 0);//18
                              strip_3.setPixelColor(19, 0, 0, 0);//19
                              strip_3.setPixelColor(20, 255, 0, 0);//20
                              strip_3.setPixelColor(21, 0, 0, 0);//21
                              strip_3.setPixelColor(22, 0, 255, 0);//22
                              strip_3.setPixelColor(23,0, 0, 0);//23
                             
                              strip_3.show();
                            }
                             
                             
                             
                 
                            else if ( potval_3 <= 780)
                            {
                                //red/green/blue_full
                                strip_3.setPixelColor(0, 255, 0, 0);
                                strip_3.setPixelColor(1, 0, 255, 0);
                                strip_3.setPixelColor(2, 0, 0,255);
                                strip_3.setPixelColor(3, 255, 0, 0);
                                strip_3.setPixelColor(4, 0, 255, 0);
                                strip_3.setPixelColor(5, 0, 0, 255);
                                strip_3.setPixelColor(6, 255, 0, 0);
                                strip_3.setPixelColor(7, 0, 255, 0);
                                strip_3.setPixelColor(8, 0, 0, 255);
                                strip_3.setPixelColor(9, 255, 0, 0);
                                strip_3.setPixelColor(10,0 , 255, 0);
                                strip_3.setPixelColor(11, 0, 0, 255);
                                strip_3.setPixelColor(12, 255, 0, 0);
                                strip_3.setPixelColor(13, 0, 255, 0);
                                strip_3.setPixelColor(14, 0, 0, 255);
                                strip_3.setPixelColor(15, 255, 0, 0);
                                strip_3.setPixelColor(16, 0, 255, 0);
                                strip_3.setPixelColor(17, 255, 0, 0);
                                strip_3.setPixelColor(18, 0, 255, 0);
                                strip_3.setPixelColor(19, 0, 0, 255);
                                strip_3.setPixelColor(20, 255, 0, 0);
                                strip_3.setPixelColor(21, 0, 255, 0);
                                strip_3.setPixelColor(22, 0, 0, 255);
                                strip_3.setPixelColor(23, 255, 0, 0);
                                 
                                strip_3.show();
                              }
           
             
    }       


              void red_half_1()
              {
                  for (int i = 0; i < 24; i += 2)
                  {
                     strip_1.setPixelColor(i, 255, 0, 0);//0
                     strip_1.setPixelColor(i+1, 0, 0, 0);//1
                     strip_1.show();
                  }
               }
             
              void red_full_1()
              {
                   
                for (int i = 0; i < 24; i += 2)
                {
                    strip_1.setPixelColor(i, 255, 0, 0);//0
                    strip_1.setPixelColor(i+1, 255, 0, 0);//1
                    strip_1.show();
                    }
              }
                   
              void blue_half_1()
              {
                 for (int i = 0; i < 24; i += 2)
                 {
                    strip_1.setPixelColor(i, 0, 0, 255);//0
                    strip_1.setPixelColor(i+1, 0, 0, 0);//1
                    strip_1.show();
                    }
              }
                   
              void blue_full_1()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_1.setPixelColor(i, 0, 0, 255);//0
                    strip_1.setPixelColor(i+1, 0, 0, 255);//1
                    strip_1.show();
                    }
              }
                   
              void green_half_1()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_1.setPixelColor(i, 0, 255, 0);//0
                    strip_1.setPixelColor(i+1, 0, 0, 0);//1
                    strip_1.show();
                    }
              }
                   
              void green_full_1()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_1.setPixelColor(i, 0, 255, 0);//0
                    strip_1.setPixelColor(i+1, 0, 0, 0);//1
                    strip_1.show();
                    }
              }
                   
              void green_blue_1()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_1.setPixelColor(i, 0, 255, 0);//0
                    strip_1.setPixelColor(i+1, 0, 0, 255);//1
                    strip_1.show();
                    }
              }
                   
              void blue_magenta_full_1()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_1.setPixelColor(i, 0, 255, 0);//0
                    strip_1.setPixelColor(i+1, 0, 0, 255);//1
                    strip_1.show();
               }
              }
               
               void green_red_1 ()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_1.setPixelColor(i, 0, 255, 0);//0
                    strip_1.setPixelColor(i+1, 255, 0, 00);//1
                    strip_1.show();
                    }
              }
             
               void green_magenta_full_1()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_1.setPixelColor(i, 0, 255, 0);//0
                    strip_1.setPixelColor(i+1, 255, 0, 255);//1
                    strip_1.show();
               }
              }

//2nd strip void functions:

void red_half_2()
              {
                  for (int i = 0; i < 24; i += 2)
                  {
                     strip_2.setPixelColor(i, 255, 0, 0);//0
                     strip_2.setPixelColor(i+1, 0, 0, 0);//1
                     strip_2.show();
                  }
               }
             
              void red_full_2()
              {
                   
                for (int i = 0; i < 24; i += 2)
                {
                    strip_2.setPixelColor(i, 255, 0, 0);//0
                    strip_2.setPixelColor(i+1, 255, 0, 0);//1
                    strip_2.show();
                    }
              }
                   
              void blue_half_2()
              {
                 for (int i = 0; i < 24; i += 2)
                 {
                    strip_2.setPixelColor(i, 0, 0, 255);//0
                    strip_2.setPixelColor(i+1, 0, 0, 0);//1
                    strip_2.show();
                    }
              }
                   
              void blue_full_2()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_2.setPixelColor(i, 0, 0, 255);//0
                    strip_2.setPixelColor(i+1, 0, 0, 255);//1
                    strip_2.show();
                    }
              }
                   
              void green_half_2()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_2.setPixelColor(i, 0, 255, 0);//0
                    strip_2.setPixelColor(i+1, 0, 0, 0);//1
                    strip_2.show();
                    }
              }
                   
              void green_full_2()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_2.setPixelColor(i, 0, 255, 0);//0
                    strip_2.setPixelColor(i+1, 0, 0, 0);//1
                    strip_2.show();
                    }
              }
                   
              void green_blue_2()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_2.setPixelColor(i, 0, 255, 0);//0
                    strip_2.setPixelColor(i+1, 0, 0, 255);//1
                    strip_2.show();
                    }
              }
                   
              void blue_magenta_full_2()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_2.setPixelColor(i, 0, 255, 0);//0
                    strip_2.setPixelColor(i+1, 0, 0, 255);//1
                    strip_2.show();
               }
              }
               
               void green_red_2 ()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_2.setPixelColor(i, 0, 255, 0);//0
                    strip_2.setPixelColor(i+1, 255, 0, 00);//1
                    strip_2.show();
                    }
              }
             
               void green_magenta_full_2()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_2.setPixelColor(i, 0, 255, 0);//0
                    strip_2.setPixelColor(i+1, 255, 0, 255);//1
                    strip_2.show();
               }
              }
             
              // 3rd strip void functions
             
              void red_half_3()
              {
                  for (int i = 0; i < 24; i += 2)
                  {
                     strip_3.setPixelColor(i, 255, 0, 0);//0
                     strip_3.setPixelColor(i+1, 0, 0, 0);//1
                     strip_3.show();
                  }
               }
             
              void red_full_3()
              {
                   
                for (int i = 0; i < 24; i += 2)
                {
                    strip_3.setPixelColor(i, 255, 0, 0);//0
                    strip_3.setPixelColor(i+1, 255, 0, 0);//1
                    strip_3.show();
                    }
              }
                   
              void blue_half_3()
              {
                 for (int i = 0; i < 24; i += 2)
                 {
                    strip_3.setPixelColor(i, 0, 0, 255);//0
                    strip_3.setPixelColor(i+1, 0, 0, 0);//1
                    strip_3.show();
                    }
              }
                   
              void blue_full_3()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_3.setPixelColor(i, 0, 0, 255);//0
                    strip_3.setPixelColor(i+1, 0, 0, 255);//1
                    strip_3.show();
                    }
              }
                   
              void green_half_3()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_3.setPixelColor(i, 0, 255, 0);//0
                    strip_3.setPixelColor(i+1, 0, 0, 0);//1
                    strip_3.show();
                    }
              }
                   
              void green_full_3()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_3.setPixelColor(i, 0, 255, 0);//0
                    strip_3.setPixelColor(i+1, 0, 0, 0);//1
                    strip_3.show();
                    }
              }
                   
              void green_blue_3()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_3.setPixelColor(i, 0, 255, 0);//0
                    strip_3.setPixelColor(i+1, 0, 0, 255);//1
                    strip_3.show();
                    }
              }
                   
              void blue_magenta_full_3()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_3.setPixelColor(i, 0, 255, 0);//0
                    strip_3.setPixelColor(i+1, 0, 0, 255);//1
                    strip_3.show();
               }
              }
               
               void green_red_3 ()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_3.setPixelColor(i, 0, 255, 0);//0
                    strip_3.setPixelColor(i+1, 255, 0, 00);//1
                    strip_3.show();
                    }
              }
             
               void green_magenta_full_3()
              {
                    for (int i = 0; i < 24; i += 2)
                    {
                    strip_3.setPixelColor(i, 0, 255, 0);//0
                    strip_3.setPixelColor(i+1, 255, 0, 255);//1
                    strip_3.show();
               }
              }


     
     









 





Now....to continue to evolve the project, Id like to add another potentiometer to control the brightness for ALL 3 of pots....an OVERALL DIMMER.

Is this possible?

So much room to grow!
slurry bowl
 
Posts: 122
Joined: Sun Nov 11, 2012 6:37 pm