Flora Coding

Post test messages here

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
skelhoney
 
Posts: 48
Joined: Fri Jun 14, 2013 3:04 pm

Re: Flora Coding

Post by skelhoney »

I am really sorry to bother you again. can i put that pixel number anywhere in these code lines


Blink(5, (5, 500, Color(255, 255, 255), Color(0,0,0)); // blink white

Fade(10, Color(255, 255, 255)); // fade white

User avatar
skelhoney
 
Posts: 48
Joined: Fri Jun 14, 2013 3:04 pm

Re: Flora Coding

Post by skelhoney »

can you make this code similar to below code

Code: Select all

/*
  Nathan Seidle
  SparkFun Electronics 2011
  
  This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).
  
  Controlling an LED strip with individually controllable RGB LEDs. This stuff is awesome.
  
  The SparkFun (individually controllable) RGB strip contains a bunch of WS2801 ICs. These
  are controlled over a simple data and clock setup. The WS2801 is really cool! Each IC has its
  own internal clock so that it can do all the PWM for that specific LED for you. Each IC
  requires 24 bits of 'greyscale' data. This means you can have 256 levels of red, 256 of blue,
  and 256 levels of green for each RGB LED. REALLY granular.
 
  To control the strip, you clock in data continually. Each IC automatically passes the data onto
  the next IC. Once you pause for more than 500us, each IC 'posts' or begins to output the color data
  you just clocked in. So, clock in (24bits * 32LEDs = ) 768 bits, then pause for 500us. Then
  repeat if you wish to display something new.
  
  This example code will display bright red, green, and blue, then 'trickle' random colors down 
  the LED strip.
  
  You will need to connect 5V/Gnd from the Arduino (USB power seems to be sufficient).
  
  For the data pins, please pay attention to the arrow printed on the strip. You will need to connect to
  the end that is the begining of the arrows (data connection)--->
  
  If you have a 4-pin connection:
  Blue = 5V
  Red = SDI
  Green = CKI
  Black = GND
  
  If you have a split 5-pin connection:
  2-pin Red+Black = 5V/GND
  Green = CKI
  Red = SDI
 */
int x;
int SDI = 2; //Red wire (not the red 5V wire!)
int CKI = 3; //Green wire
int ledPin = 13; //On board LED

#define STRIP_LENGTH 32 //32 LEDs on this strip
long strip_colors[STRIP_LENGTH];

void setup() {
  pinMode(SDI, OUTPUT);
  pinMode(CKI, OUTPUT);
  pinMode(ledPin, OUTPUT);   
  //Clear out the array
  for(int x = 0 ; x < STRIP_LENGTH ; x++)
    strip_colors[x] = 0;
    
  randomSeed(analogRead(0));
  
  //Serial.begin(9600);
  //Serial.println("Hello!");
}


void loop() {
 {
 
   
  strip_colors[0] = 0xFF0000; //Bright Red
  strip_colors[1] = 0xFF0000; //Bright Green
  strip_colors[2] = 0xFF0000; //Bright Blue
  strip_colors[3] = 0xFF0000; //Faint red
  strip_colors[4] = 0xFF0000; //Bright Red
  post_frame(); //Push the current color frame to the strip
  delay(1);
  strip_colors[0] = LOW; //Bright Red
  strip_colors[1] = LOW; //Bright Green
  strip_colors[2] = LOW; //Bright Blue
  strip_colors[3] = LOW; //Faint red
  strip_colors[4] = LOW; //Bright Red
  post_frame(); //Push the current color frame to the strip
  delay(1);



    delay(8000);
    
    delay(9785);
   
  
   // All Colors Change
   //Bright Red
  //Pre-fill the color array with known values


  



{
  {for (x = 0; x < 4; x++) {
    
  //Bright Green
  //Pre-fill the color array with known values
  strip_colors[0] = 0x555555; //Bright Red
  strip_colors[1] = 0x555555; //Bright Green
  strip_colors[2] = 0x555555; //Bright Blue
  strip_colors[3] = 0x555555; //Faint red
  strip_colors[4] = 0x555555; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(60);
  
  strip_colors[0] = LOW; //Bright Red
  strip_colors[1] = LOW; //Bright Green
  strip_colors[2] = LOW; //Bright Blue
  strip_colors[3] = LOW; //Faint red
  strip_colors[4] = LOW; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(60);
  }
   //Bright Blue
  //Pre-fill the color array with known values
  strip_colors[0] = 0x00008B; //Bright Red
  strip_colors[1] = 0x00008B; //Bright Green
  strip_colors[2] = 0x00008B; //Bright Blue
  strip_colors[3] = 0x00008B; //Faint red
  strip_colors[4] = 0x00008B; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(2000);

  
  //Bright Green
  //Pre-fill the color array with known values
  strip_colors[0] = 0x00FF00; //Bright Red
  strip_colors[1] = 0x00FF00; //Bright Green
  strip_colors[2] = 0x00FF00; //Bright Blue
  strip_colors[3] = 0x00FF00; //Faint red
  strip_colors[4] = 0x00FF00; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(2000);

  
  
  
  strip_colors[0] = LOW; //Bright Red
  strip_colors[1] = LOW; //Bright Green
  strip_colors[2] = LOW; //Bright Blue
  strip_colors[3] = LOW; //Faint red
  strip_colors[4] = LOW; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(2553);
 }
   
   {
  {for (x = 0; x < 4; x++) {
    
  //Bright Green
  //Pre-fill the color array with known values
  strip_colors[0] = 0x555555; //Bright Red
  strip_colors[1] = 0x555555; //Bright Green
  strip_colors[2] = 0x555555; //Bright Blue
  strip_colors[3] = 0x555555; //Faint red
  strip_colors[4] = 0x555555; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(60);
  
  strip_colors[0] = LOW; //Bright Red
  strip_colors[1] = LOW; //Bright Green
  strip_colors[2] = LOW; //Bright Blue
  strip_colors[3] = LOW; //Faint red
  strip_colors[4] = LOW; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(60);
  }
  
    //Bright Blue
  //Pre-fill the color array with known values
  strip_colors[0] = 0x00008B; //Bright Red
  strip_colors[1] = 0x00008B; //Bright Green
  strip_colors[2] = 0x00008B; //Bright Blue
  strip_colors[3] = 0x00008B; //Faint red
  strip_colors[4] = 0x00008B; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(1000);
  
{
  {for (x = 0; x < 10; x++) {
    
  //Bright Green
  //Pre-fill the color array with known values
  strip_colors[0] = 0xFF0000; //Bright Red
  strip_colors[1] = 0xFF0000; //Bright Green
  strip_colors[2] = 0xFF0000; //Bright Blue
  strip_colors[3] = 0xFF0000; //Faint red
  strip_colors[4] = 0xFF0000; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(20);
  
  strip_colors[0] = LOW; //Bright Red
  strip_colors[1] = LOW; //Bright Green
  strip_colors[2] = LOW; //Bright Blue
  strip_colors[3] = LOW; //Faint red
  strip_colors[4] = LOW; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(20);
  }

 delay(2500);
    {
  {for (x = 0; x < 4; x++) {
    
  //Bright Green
  //Pre-fill the color array with known values
  strip_colors[0] = 0x555555; //Bright Red
  strip_colors[1] = 0x555555; //Bright Green
  strip_colors[2] = 0x555555; //Bright Blue
  strip_colors[3] = 0x555555; //Faint red
  strip_colors[4] = 0x555555; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(60);
  
  strip_colors[0] = LOW; //Bright Red
  strip_colors[1] = LOW; //Bright Green
  strip_colors[2] = LOW; //Bright Blue
  strip_colors[3] = LOW; //Faint red
  strip_colors[4] = LOW; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(60);
  }
  
    //Bright Blue
  //Pre-fill the color array with known values
  strip_colors[0] = 0x00008B; //Bright Red
  strip_colors[1] = 0x00008B; //Bright Green
  strip_colors[2] = 0x00008B; //Bright Blue
  strip_colors[3] = 0x00008B; //Faint red
  strip_colors[4] = 0x00008B; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(3000);
  
{
  {for (x = 0; x < 10; x++) {
    
  //Bright Green
  //Pre-fill the color array with known values
  strip_colors[0] = 0xFF0000; //Bright Red
  strip_colors[1] = 0xFF0000; //Bright Green
  strip_colors[2] = 0xFF0000; //Bright Blue
  strip_colors[3] = 0xFF0000; //Faint red
  strip_colors[4] = 0xFF0000; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(20);
  
  strip_colors[0] = LOW; //Bright Red
  strip_colors[1] = LOW; //Bright Green
  strip_colors[2] = LOW; //Bright Blue
  strip_colors[3] = LOW; //Faint red
  strip_colors[4] = LOW; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(20);
  }
 
 
 
 
    delay(2500);
  //Bright Green
  //Pre-fill the color array with known values
  strip_colors[0] = 0xFF0000; //Bright Red
  strip_colors[1] = 0xFF0000; //Bright Green
  strip_colors[2] = 0xFF0000; //Bright Blue
  strip_colors[3] = 0xFF0000; //Faint red
  strip_colors[4] = 0xFF0000; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(14351);
  {
  {for (x = 0; x < 20; x++) {
    
  //Bright Green
  //Pre-fill the color array with known values
  strip_colors[0] = 0xFF0000; //Bright Red
  strip_colors[1] = 0xFF0000; //Bright Green
  strip_colors[2] = 0xFF0000; //Bright Blue
  strip_colors[3] = 0xFF0000; //Faint red
  strip_colors[4] = 0xFF0000; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(20);
  
  strip_colors[0] = LOW; //Bright Red
  strip_colors[1] = LOW; //Bright Green
  strip_colors[2] = LOW; //Bright Blue
  strip_colors[3] = LOW; //Faint red
  strip_colors[4] = LOW; //Bright Red


  post_frame(); //Push the current color frame to the strip
  delay(20);
  }
  strip_colors[0] = LOW; //Bright Red
  strip_colors[1] = LOW; //Bright Green
  strip_colors[2] = LOW; //Bright Blue
  strip_colors[3] = LOW; //Faint red
  strip_colors[4] = LOW; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(40000);
  
   {
  {for (x = 0; x < 12; x++) {
    
  //Bright Green
  //Pre-fill the color array with known values
  strip_colors[0] = 0xFF0000; //Bright Red
  strip_colors[1] = 0xFF0000; //Bright Green
  strip_colors[2] = 0xFF0000; //Bright Blue
  strip_colors[3] = 0xFF0000; //Faint red
  strip_colors[4] = 0xFF0000; //Bright Red

  post_frame(); //Push the current color frame to the strip
  delay(100);
  
  strip_colors[0] = LOW; //Bright Red
  strip_colors[1] = LOW; //Bright Green
  strip_colors[2] = LOW; //Bright Blue
  strip_colors[3] = LOW; //Faint red
  strip_colors[4] = LOW; //Bright Red


  post_frame(); //Push the current color frame to the strip
  delay(100);
  }
  strip_colors[0] = LOW; //Bright Red
  strip_colors[1] = LOW; //Bright Green
  strip_colors[2] = LOW; //Bright Blue
  strip_colors[3] = LOW; //Faint red
  strip_colors[4] = LOW; //Bright Red
  
    delay(200000000);
  }}}}}}}}}}}}}
 }}

//Throws random colors down the strip array
void addRandom(void) {
  int x;
  
  //First, shuffle all the current colors down one spot on the strip
  for(x = (STRIP_LENGTH - 1) ; x > 0 ; x--)
    strip_colors[x] = strip_colors[x - 1];
    
  //Now form a new RGB color
  long new_color = 0;
  for(x = 0 ; x < 3 ; x++){
    new_color <<= 8;
    new_color |= random(0xFF); //Give me a number from 0 to 0xFF
    //new_color &= 0x555555; //Force the random number to just the upper brightness levels. It sort of works.
  }
  
  strip_colors[0] = new_color; //Add the new random color to the strip
}

//Takes the current strip color array and pushes it out
void post_frame (void) {
  //Each LED requires 24 bits of data
  //MSB: R7, R6, R5..., G7, G6..., B7, B6... B0 
  //Once the 24 bits have been delivered, the IC immediately relays these bits to its neighbor
  //Pulling the clock low for 500us or more causes the IC to post the data.

  for(int LED_number = 0 ; LED_number < STRIP_LENGTH ; LED_number++) {
    long this_led_color = strip_colors[LED_number]; //24 bits of color data

    for(byte color_bit = 23 ; color_bit != 255 ; color_bit--) {
      //Feed color bit 23 first (red data MSB)
      
      digitalWrite(CKI, LOW); //Only change data when clock is low
      
      long mask = 1L << color_bit;
      //The 1'L' forces the 1 to start as a 32 bit number, otherwise it defaults to 16-bit.
      
      if(this_led_color & mask) 
        digitalWrite(SDI, HIGH);
      else
        digitalWrite(SDI, LOW);
  
      digitalWrite(CKI, HIGH); //Data is latched when clock goes high
    }
  }

  //Pull clock low to put strip into reset/post mode
  digitalWrite(CKI, LOW);
  delayMicroseconds(500); //Wait for 500us to go into reset
}

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Flora Coding

Post by adafruit_support_bill »

The pixel is specified in the first parameter of setPixelColor(). See the Blink() function that I wrote for you.
can you make this code similar to below code
We can offer advice and assistance, but we can't write all of your code for you. If you need someone to develop code for you, you may want to post it as a contract project in our Jobs board: http://adafruit.com/jobs/

User avatar
skelhoney
 
Posts: 48
Joined: Fri Jun 14, 2013 3:04 pm

Re: Flora Coding

Post by skelhoney »

Hi.. can you please make this code work on flora pixel

i want this type of simple code

Code: Select all

#define LEDPIN 6;

Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, LEDPIN, NEO_GRB + NEO_KHZ800);


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

void loop() 
{
  strip.setPixelColor(0, strip.Color(255,255,255)); // white
  strip.show();
  delay(1000);
  
  strip.setPixelColor(0, strip.Color(0,0,0)); // black
  strip.show();
  delay(1000);
}

User avatar
skelhoney
 
Posts: 48
Joined: Fri Jun 14, 2013 3:04 pm

Re: Flora Coding

Post by skelhoney »

i want with the pixel number

User avatar
skelhoney
 
Posts: 48
Joined: Fri Jun 14, 2013 3:04 pm

Re: Flora Coding

Post by skelhoney »

Hi can u please send me this type of code that can work on flora pixel

Code: Select all

#define LEDPIN 6;

Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, LEDPIN, NEO_GRB + NEO_KHZ800);


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

void loop() 
{
  strip.setPixelColor(0, strip.Color(255,255,255)); // white
  strip.show();
  delay(1000);
  
  strip.setPixelColor(0, strip.Color(0,0,0)); // black
  strip.show();
  delay(1000);
}

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Flora Coding

Post by adafruit_support_rick »

Code: Select all

 
   strip.setPixelColor(0, strip.Color(255,255,255));
//                     ^
//                     |
//        the pixel number goes here

User avatar
skelhoney
 
Posts: 48
Joined: Fri Jun 14, 2013 3:04 pm

Re: Flora Coding

Post by skelhoney »

strip.setPixelColor(0, strip.Color(255,255,255));
// ^
// |
// the pixel number goes here


that i know the pixel number goes here but this code is not uploading on flora

can you make Below code working on flora

Code: Select all

#define LEDPIN 6;

Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, LEDPIN, NEO_GRB + NEO_KHZ800);


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

void loop() 
{
  strip.setPixelColor(0, strip.Color(255,255,255)); // white
  strip.show();
  delay(1000);
  
  strip.setPixelColor(0, strip.Color(0,0,0)); // black
  strip.show();
  delay(1000);
}

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Flora Coding

Post by adafruit_support_bill »

You need to use the appropriate library. You are using FloraPixels and not the Neopixel Strip:

Code: Select all

#include "Adafruit_FloraPixel.h"

// Set the first variable to the NUMBER of pixels. 
Adafruit_FloraPixel strip = Adafruit_FloraPixel(8);

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

void loop() 
{
  strip.setPixelColor(0, strip.Color(255,255,255)); // white
  strip.show();
  delay(1000);
  
  strip.setPixelColor(0, strip.Color(0,0,0)); // black
  strip.show();
  delay(1000);
}

User avatar
skelhoney
 
Posts: 48
Joined: Fri Jun 14, 2013 3:04 pm

Re: Flora Coding

Post by skelhoney »

Dear i am still having a error please see the attached pitcher
Attachments
error.jpg
error.jpg (148.66 KiB) Viewed 7113 times

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Flora Coding

Post by adafruit_support_rick »

This way will work:

Code: Select all

  strip.setPixelColor(0, 255,255,255); // white

User avatar
skelhoney
 
Posts: 48
Joined: Fri Jun 14, 2013 3:04 pm

Re: Flora Coding

Post by skelhoney »

Dear thank u soooo Much for the code. i want to make dance costume with this pixels. can you pls let me know how many max pixels i can use with 1 flora. i want to order more 100 pixels and 10 flora ?

and please also let me know can we do this same format of code in fade effect also ( i want both fade in and fade out )

Code: Select all

#include "Adafruit_FloraPixel.h"

// Set the first variable to the NUMBER of pixels. 
Adafruit_FloraPixel strip = Adafruit_FloraPixel(8);

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

void loop() 
{
  strip.setPixelColor(0, 255,255,255)); // white
  strip.show();
  delay(1000);
  
  strip.setPixelColor(0, 0,0,0)); // black
  strip.show();
  delay(1000);
}

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Flora Coding

Post by adafruit »

Flora can easily support 100 pixels as long as they are wired well and have good power supply. We suggest the Adafruit_NeoPixel library since its been optimized

https://github.com/adafruit/Adafruit_NeoPixel

User avatar
skelhoney
 
Posts: 48
Joined: Fri Jun 14, 2013 3:04 pm

Re: Flora Coding

Post by skelhoney »

hi can i use flora with 12v battery which is the best conductive thread for flora if i want to use 100 pixels

User avatar
skelhoney
 
Posts: 48
Joined: Fri Jun 14, 2013 3:04 pm

Re: Flora Coding

Post by skelhoney »

hi can i use flora with 12v battery which is the best conductive thread for flora if i want to use 100 pixels

also want to know what will happen if 1 pixel between the 10 pixel is stop working is the other pixels also stop working

Locked
Please be positive and constructive with your questions and comments.

Return to “Test Message Forum (closed)”