ARC Pro

Upgrade to ARC Pro

Unleash your creativity with the power of easy robot programming using Synthiam ARC Pro

#17  

You might be happier with this slight mod of your code. It allows individual pixels to be set using the original Cp,r,g,b command and adds an Sr,g,b command which will change the color of the entire neopixel ring. It looks like you want the ring to gradually go bright to dim to bright again. With the code you have it will be doing that every 2.5 seconds or so. That might be a bit fast. delay(50) is a 50millisecond delay you get 25 of these in each brightness change loop. so it will go from bright to dim in about 1.25 seconds and dim to bright in 1.25 seconds. That seems fast to me. You might want to only change the brightness by 1 instead of 10. Not sure how response it will be to serial commands with the longer delays though.


/*
Simple BlinkyStrip control

This sketch allows serial control over a BlinkyStrip.
To set any pixel in the strip, send the following serial string:

Cp,r,g,b

To set the whole strip to a single color, send the following serial string:

Sr,g,b

p is the pixel number to set
r, g, and b are ASCII numbers for the red, green, and blue brightness
levels, from 0 to 255.




This will probably work for any string of NeoPixels from Adafruit as well.

Uses Adafruit's NeoPixel library: https://github.com/adafruit/Adafruit_NeoPixel

original sketch created 4 Dec 2014
by Tom Igoe
modified for neopixel ring 

*/
#include <Adafruit_NeoPixel.h>

#define PIN 6

Adafruit_NeoPixel strip = Adafruit_NeoPixel(16, PIN, NEO_GRB + NEO_KHZ800);
int incomingByte = 0;   // for incoming serial data
int input_pixel = 0; // pixel number that you're changing
int red = 0; // new serial red value 
int green = 0; // new serial green value
int blue = 0; // new serialblue value

void setup() 
{
Serial.begin(9600); // initialize serial communication
Serial.setTimeout(10); // set serial timeout
strip.begin(); // initialize pixel strip
strip.show(); // Initialize all pixels to 'off'
}

void loop() 
{
// listen for serial:
if (Serial.available() > 0) 
{
  incomingByte = Serial.read();
  if (incomingByte == 'C' ) 
    { // string should start with C
    input_pixel = Serial.parseInt(); // then an ASCII number for pixel number
    red = Serial.parseInt(); // then an ASCII number for red
    green = Serial.parseInt(); // then an ASCII number for green
    blue = Serial.parseInt(); // then an ASCII number for blue
    strip.setPixelColor(input_pixel, red, green, blue);// set the color for this pixela
    strip.show(); // refresh the strip
   }
  if (incomingByte == 'S' ) 
    { // string should start with S
    red = Serial.parseInt(); // then an ASCII number for red
    green = Serial.parseInt(); // then an ASCII number for green
    blue = Serial.parseInt(); // then an ASCII number for blue
    for (int j=0; j < 16; j++)
      {
      strip.setPixelColor(j, red, green, blue);// set the color for this pixela
      strip.show(); // refresh the strip
      }
    }
  }
for (int i=0; i<250; i= i+10)
  {
  strip.setBrightness(i);
  strip.show(); // refresh the strip
  delay(50);
  }
for (int i=250; i > 0; i=i-10)
  {
  strip.setBrightness(i);
  strip.show(); // refresh the strip
  delay(50);
  }
}


#18  

I figured I would play with the delay when I have something in my hands to use. I'm thinking of it more as a heart beat than anything right now. I'll check out your code.

#19  

I also want the user to be able to set the color and then forget it unless they want to change the color. I figured the loop would allow them to change the color and then perform the heart beat type of series. I am guessing what the results will be until I get my anxious hands on these components.

#20  

I've been playing with a Neo Ring the last couple of days and have a script working thru the EZBv4. I have tried running the scripts above and get this error message for all 3 - what am I missing?

Arduino: 1.6.3 (Windows 8.1), Board: "Arduino Uno"

Neo_ring_from_forum.ino:1:1: error: 'Code' does not name a type

Neo_ring_from_forum.ino:36:1: error: 'Adafruit_NeoPixel' does not name a type

Neo_ring_from_forum.ino: In function 'void setup()':

Neo_ring_from_forum.ino:47:1: error: 'strip' was not declared in this scope

Neo_ring_from_forum.ino: In function 'void loop()':

Neo_ring_from_forum.ino:63:1: error: 'strip' was not declared in this scope

Neo_ring_from_forum.ino:73:1: error: 'strip' was not declared in this scope

Neo_ring_from_forum.ino:80:1: error: 'strip' was not declared in this scope

Neo_ring_from_forum.ino:86:1: error: 'strip' was not declared in this scope

Error compiling.

Thanks

#21  

Remove the word Code: from the top of your arduino file and try to compile it again.

#22  

If it still doesn't work, make sure that you have the Adafruit_NeoPixel library loaded into your user libraries.

#23  

Ok, that worked, got it loaded, however when I enter C in the serial monitor nothing happens. Are there some color values that have to be added/changed?

#24  

I don't have my arduino or neopixel yet. I think ARC would use something like this

SendSerial(d0, 9600, "C0,255,0,0" ) 

with the wire from the signal of D0 to the serial pin or rx pin on the arduino. I'm new at this part for sure as I don't even have one yet.