Пример #1
0
Effects::Effects() {
    this->strip =
        Adafruit_NeoPixel(NEOPIXEL_COUNT, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
    this->strip.begin();

    this->neoCandle = new NeoCandle(&strip);
}
/** Construct a new cube.
  @param s Size of one side of the cube in number of LEDs.
  @param mb Maximum brightness value. Used to prevent the LEDs from drawing too much current (which causes the colors to distort).

  @return A new Cube object.
  */
Cube::Cube(unsigned int s, unsigned int mb) : \
    maxBrightness(mb),
    onlinePressed(true),
    lastOnline(true),
    strip(Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE)),
    size(s),
	// initialize Text members
    done(false),
    looping(false)
{ }
Пример #3
0
void Strip::setup(uint16_t _initialPin = 0) {

  int _stripCount = 8;

  // build array of LED strip
  for (uint16_t i = 0; i < _stripCount; i++) {
     strip[i] = Adafruit_NeoPixel(30, _initialPin + i, NEO_GRB + NEO_KHZ800);
  }

}
	KnightriderStrip(uint16_t n, uint8_t p, uint32_t rgb, neoPixelType t, Interpolation type, int effectLength, int headDistance, int speed)
	: KnightriderEffect(n, type, effectLength)
	{
		this->strip = Adafruit_NeoPixel(n, p, t);
		this->strip.begin();

		this->setHeadDistance(headDistance);
		this->setSpeed(speed);
		this->setColor(rgb);
	}
/** Construct a new cube with default settings.
  @param s Size of one side of the cube in number of LEDs.
  @param mb Maximum brightness value. Used to prevent the LEDs from drawing too much current (which causes the colors to distort).

  @return A new Cube object.
  */
Cube::Cube() : \
    maxBrightness(50),
    onlinePressed(true),
    lastOnline(true), 
    strip(Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE)),
    size(8),
	// initialize Text members
    done(false),
    looping(false),
    selectedFont(CUBE_FONT)
{ }
Пример #6
0
	// -------------------------- Pixel --------------------------
	Pixel::Pixel(uint8_t number_of_vertex) {
		// プロトタイプ2号のピン配置
		this->ports.push_back(Port(new skInfraredCOM(2, 11), 0));
		this->ports.push_back(Port(new skInfraredCOM(3, 12), 0));
		this->ports.push_back(Port(new skInfraredCOM(4, 13), 0));

		this->configured = false;
		this->device_id = 0;
		this->number_of_vertex = number_of_vertex;
		this->led = Adafruit_NeoPixel(1, 10, NEO_GRB + NEO_KHZ800);
		this->led.begin();
	}
Пример #7
0
void Flash_Color::flashColor_setStripInstruction(byte pitch, byte velocity, byte red, byte green, byte blue) {
    // instruction_start = millis();
    // instruction_length = 200;
    // instruction_start_val = expScale(velocity);

    // instruction_args[0] = pitch;
    // instruction_args[1] = velocity;
    // instruction_args[2] = red;
    // instruction_args[3] = green;
    // instruction_args[4] = blue;
Adafruit_NeoPixel strip_1 = Adafruit_NeoPixel(21, 6, NEO_GRB + NEO_KHZ800);
        uint32_t color = strip_1.Color(
            128,
            128,
            128
        );

        for(uint16_t i = 0; i < 21; i++) {
            strip_1.setPixelColor(i, color);
        }
        strip_1.show();

        Serial.println("asd");
}
Пример #8
0
//for Flash Air
#include <iSdio.h>
#include <utility/Sd2CardExt.h>
#include <Adafruit_NeoPixel.h>
#include <avr/power.h>
//for Servo
#include <Servo.h>
#include <avr/wdt.h>

//for FlashAir
#define VOLPIN 1
#define NEOPIXEL_PIN 9
//#define PIXEL_NUM 32
#define PIXEL_NUM 9
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_NUM, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800);
const int chipSelectPin = 4;
Sd2CardExt card;
uint8_t buffer[512];

//for NeoPixel
int currentByte = 0;
int LED_R = 0;
int LED_G = 0;
int LED_B = 0;

//for Servo
Servo sv;
#define SERVO_PIN 11

//for button
const int buttonPin = 13;     // the number of the pushbutton pin
Пример #9
0
#include "application.h"
#include "MPU6050.h"
#include "Adafruit_NeoPixel.h"
#include <math.h>
#include "UDPLogger.h"

#define PIXEL_COUNT  16
#define LED_MODULO 4

Adafruit_NeoPixel strip1 = Adafruit_NeoPixel(PIXEL_COUNT, D2, WS2812B);
Adafruit_NeoPixel strip2 = Adafruit_NeoPixel(PIXEL_COUNT, D3, WS2812B);
MPU6050 mpu = MPU6050(MPU6050::Address0);
UDPLogger logger;

static bool ballTurnedOn = false;

uint32_t Wheel(byte WheelPos);

void rainbow(uint8_t modulo, uint8_t wait);
void ball(void);

void blinkLED(unsigned int count, unsigned int mydelay)
{
    int led = D7;
    
    pinMode(led, OUTPUT);
    while (count > 0) {
        digitalWrite(led, HIGH);
        delay(mydelay);               // Wait for 1000mS = 1 second
        digitalWrite(led, LOW); 
        delay(mydelay);               // Wait for 1 second in off mode
Пример #10
0
#include "InternetButton2.h"
#include "math.h"

//----------------- Button ----------------//

uint8_t pin = 3;
uint8_t b1 = 4;
uint8_t b2 = 5;
uint8_t b3 = 6;
uint8_t b4 = 7;


Adafruit_NeoPixel ring = Adafruit_NeoPixel(PIXEL_COUNT, pin, PIXEL_TYPE);
ADXL362 accelerometer;

InternetButton::InternetButton(){

}

void InternetButton::begin(){
    ring.begin();
    ring.show();

    accelerometer.begin();                   // Setup SPI protocol, issue device soft reset
    accelerometer.beginMeasure();            // Switch ADXL362 to measure mode
    accelerometer.checkAllControlRegs();     // Burst Read all Control Registers, to check for proper setup

    pinMode(b1, INPUT_PULLUP);
    pinMode(b2, INPUT_PULLUP);
    pinMode(b3, INPUT_PULLUP);
    pinMode(b4, INPUT_PULLUP);
Пример #11
0
#include <Wire.h>
#include <Adafruit_NeoPixel.h>

#define NUM_PIXELS 16
#define INPUT_PORT 6
#define BLINK_DELAY 5
#define NUM_COLORS 10

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_RGB     Pixels are wired for RGB bitstream
//   NEO_GRB     Pixels are wired for GRB bitstream
//   NEO_KHZ400  400 KHz bitstream (e.g. FLORA pixels)
//   NEO_KHZ800  800 KHz bitstream (e.g. High Density LED strip)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_PIXELS, INPUT_PORT, NEO_GRB + NEO_KHZ800);

int currentPixel = 0;
int direction;
int colorIndex = 0;

// Here is where you can put in your favorite colors that will appear!
// just add new {nnn, nnn, nnn}, lines. They will be picked out randomly
//                                  R   G   B
uint8_t colorList[][NUM_COLORS] = {
  {0, 255, 0},
  {255, 0, 255},
  {0, 255, 0},
  {255, 0, 255},
  {0, 255, 0},
  {255, 0, 255},
Пример #12
0
#include "ws2812.h"
#include "Arduino.h"

Adafruit_NeoPixel strip = Adafruit_NeoPixel(STRIP_LENGTH, LED_PIN, NEO_GRB + NEO_KHZ800);

char buf[BUFLENGTH]; // character buffer for json message processing

void ws2812_initialise() {
    // initialises the strip
    strip.begin();
    strip.show();
}

void process_command(byte argc, byte *argv){
    // this takes a pixel command that has been determined and then
    // processes it appropriately.

    switch (argv[0]) {
        case PIXEL_SHOW: {
            show();
            break;
        }
        case PIXEL_SET_STRIP: {
            // sets the entirety of the strip to one colour
            uint32_t strip_colour = (uint32_t)argv[1] + ((uint32_t)argv[2]<<7) + ((uint32_t)argv[3]<<14) + ((uint32_t)argv[4] << 21);
            for (uint16_t i = 0; i<STRIP_LENGTH; i++) {
                strip.setPixelColor(i, strip_colour);
            }
            break;
        }
        case PIXEL_SET_PIXEL: {
#include "SparkButton.h"
#include "math.h"

//----------------- Button ----------------//

Adafruit_NeoPixel ring = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
ADXL362 accelerometer;

SparkButton::SparkButton(){
    
}

void SparkButton::begin(){
    ring.begin();
    ring.show();
    
    accelerometer.begin();                   // Setup SPI protocol, issue device soft reset
    accelerometer.beginMeasure();            // Switch ADXL362 to measure mode  
    accelerometer.checkAllControlRegs();     // Burst Read all Control Registers, to check for proper setup
    
    pinMode(D1, INPUT_PULLUP);
    pinMode(D2, INPUT_PULLUP);
    pinMode(D3, INPUT_PULLUP);
    pinMode(D4, INPUT_PULLUP);
}

void SparkButton::ledOn(uint8_t i, uint8_t r, uint8_t g, uint8_t b){
    //i-1 shifts the location from human readable to the right index for the LEDs
    if(i == 12){
        ring.setPixelColor(0, ring.Color(r,g,b));
        ring.setPixelColor(10, ring.Color(r,g,b));
Пример #14
0
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_RGB Pixels are wired for RGB bitstream
// NEO_GRB Pixels are wired for GRB bitstream
// NEO_KHZ400 400 KHz bitstream (e.g. FLORA pixels)
// NEO_KHZ800 800 KHz bitstream (e.g. High Density LED strip)

//Adafruit_NeoPixel strips[NUM_PIXEL_STRIPS] = {
//		Adafruit_NeoPixel(NUM_PIXELS, pinPixels[0], NEO_GRB + NEO_KHZ800),
//		Adafruit_NeoPixel(NUM_PIXELS, pinPixels[1], NEO_GRB + NEO_KHZ800),
//		Adafruit_NeoPixel(NUM_PIXELS, pinPixels[2], NEO_GRB + NEO_KHZ800)
//};

uint8_t pinPixels[NUM_STRIPS] = {8, 12, 13};

Adafruit_NeoPixel strip1 = Adafruit_NeoPixel(NUM_PIXELS, pinPixels[0], NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip2 = Adafruit_NeoPixel(NUM_PIXELS, pinPixels[1], NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip3 = Adafruit_NeoPixel(NUM_PIXELS, pinPixels[2], NEO_GRB + NEO_KHZ800);

//Adafruit_NeoPixel* left = &strip1;
//Adafruit_NeoPixel* right = &strip2;
//Adafruit_NeoPixel* sub = &strip3;

Adafruit_NeoPixel* strips[3] = { &strip1, &strip2, &strip3 };

void initPixels() {

  	for (int i = 0; i < NUM_STRIPS; i++) {
  		pinMode(pinPixels[i], OUTPUT);
		strips[i]->begin();
		strips[i]->show(); // Initialize all pixels to 'off'
Пример #15
0
#include "Arduino.h"
#include "HIDIO.h"
#include "Adafruit_NeoPixel.h"

const WebUSBURL URLS[] = {
  { 1, "esplanade.xobs.io" },
  { 0, "localhost:8000" },
};

const uint8_t ALLOWED_ORIGINS[] = { 1, 2 };

HIDIO_ HIDIO(URLS, 2, 1, ALLOWED_ORIGINS, 2);

Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, LED_BUILTIN_RGB,
                                            NEO_GRB + NEO_KHZ800);
int loops;

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

enum command {
  read_digital = 0,
  write_digital = 1,
  read_analog = 2,
  write_analog = 3,
  read_serial = 4,
  write_serial = 5,
  set_rgb = 6,
// Finally, set value to requested pin (go())
// wait 10 ms
// do that undefinitly!!!
//*************************************************
// INFO: 3digits code sur 8bits
//SoftwareSerial mySerial(16, 17); // RX, TX
/*       NEOPIXEL       */
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif
#define PIN_LED_BELT   46
#define PIN_LED_EARS   8
#define NUMPIXELS      20

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN_LED_BELT);
Adafruit_NeoPixel ears = Adafruit_NeoPixel(2,PIN_LED_EARS);

String json = "";
String command = "";
String order = "";
int i=0;
int values[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int E1 = 5;
int M1 = 4;
int E2 = 6;
int M2 = 7;
//Ear Leds, pin access
int RL1 = 8;
int GL1 = 9;
int BL1 = 10;
Пример #17
0
void Pixel_Clock::led_strip_init() {
  pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
  pixels.begin();
}
InteractiveWall::InteractiveWall() {

        //takes in 2 parameters, (numberOfPixelsInStrip, stripPinNumber), change accordingly if required
        strips[0] = Adafruit_NeoPixel(57, NP0);
        strips[1] = Adafruit_NeoPixel(61, NP1);
        strips[2] = Adafruit_NeoPixel(61, NP2);
        strips[3] = Adafruit_NeoPixel(61, NP3);
        strips[4] = Adafruit_NeoPixel(56, NP4);
        strips[5] = Adafruit_NeoPixel(56, NP5);
        strips[6] = Adafruit_NeoPixel(56, NP6);
        strips[7] = Adafruit_NeoPixel(61, NP7);
        strips[8] = Adafruit_NeoPixel(56, NP8);
        strips[9] = Adafruit_NeoPixel(60, NP9);
        strips[10] = Adafruit_NeoPixel(53, NP10);
        strips[11] = Adafruit_NeoPixel(57, NP11);
        strips[12] = Adafruit_NeoPixel(54, NP12);
        strips[13] = Adafruit_NeoPixel(59, NP13);

        //each array stores the number of LEDs in each cell
        uint8_t list0[] = {3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,3,4};
        uint8_t list1[] = {3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,3,3,4,7};
        uint8_t list2[] = {3,3,3,3,3,3,3,3,3,4,3,3,3,3,2,2,3,3,4,4};
        uint8_t list3[] = {3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,3,3,4,7};
        uint8_t list4[] = {2,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3,4,5};
        uint8_t list5[] = {3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,3,3,4,5};
        uint8_t list6[] = {4,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,3,4,5};
        uint8_t list7[] = {5,4,3,3,3,3,3,3,3,2,2,2,2,3,3,3,3,3,3,5};
        uint8_t list8[] = {5,3,3,3,3,2,2,2,2,2,2,2,2,3,3,3,3,3,3,4};
        uint8_t list9[] = {5,4,3,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,4};
        uint8_t list10[] = {5,4,3,3,2,2,2,3,2,2,2,2,2,2,2,3,3,3,3,3};
        uint8_t list11[] = {6,4,3,2,2,2,2,3,3,3,3,2,2,2,3,2,3,3,3,4};
        uint8_t list12[] = {6,3,2,2,2,2,2,2,3,3,3,2,2,2,2,3,3,3,3,4};
        uint8_t list13[] = {3,3,3,3,3,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3};

        pixels[0] = list0;
        pixels[1] = list1;
        pixels[2] = list2;
        pixels[3] = list3;
        pixels[4] = list4;
        pixels[5] = list5;
        pixels[6] = list6;
        pixels[7] = list7;
        pixels[8] = list8;
        pixels[9] = list9;
        pixels[10] = list10;
        pixels[11] = list11;
        pixels[12] = list12;
        pixels[13] = list13;
}
Пример #19
0
NeoPixelLed::NeoPixelLed(uint16_t n, uint8_t p, neoPixelType t) {
    neopixel = Adafruit_NeoPixel(n, p, t);
}
Пример #20
0
#include "pixels.h"



//////// Static Initialization

#define NEOPIXEL_PIXEL_COUNT 8
Adafruit_NeoPixel strip = Adafruit_NeoPixel( NEOPIXEL_PIXEL_COUNT, NEOPIXEL_PIN, NEO_GRB + NEO_KHZ800 );

// NOTE: Vars are being stored this way so that names don't collide.

//// Color Wheel Animation

// How much to shift the color of each pixel in the animation as they're iterated over.
#define COLOR_WHEEL_SHIFT_AMOUNT 16

struct ColorWheelAnimationModel {
	struct AnimationTimingModel timing;
	byte colorPosition;
	byte saturation;
};

struct ColorWheelAnimationModel colorWheelAnimation = {
	.timing = {
		.progress = 0
		, .normalDuration = 5500
		, .rate100 = 100
	}
	, .colorPosition = 0
	, .saturation = 0
Пример #21
0
// Arduino code for Neopixel LED controller
// using a potentiometer and switch button
// (C) Ismail Uddin, 2015
// www.scienceexposure.com

#include <Adafruit_NeoPixel.h>
#define PIN 3
Adafruit_NeoPixel strip = Adafruit_NeoPixel(12, PIN, NEO_GRB + NEO_KHZ800);

int potPin = 2;
int val = 0;
int colorVal = 0;
int reading = 0;
int x;
int prevVal = 0;
int switchPin = 6;
boolean lastBtn = LOW;
boolean NeopixelColor = false;
boolean lastButton = LOW;


void setup() {
  // put your setup code here, to run once:
  strip.begin();
  strip.show();
  pinMode(switchPin, INPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
Пример #22
0
/*
 LearnBits Raspberry Pi Shield - Arkadi Rafalovich 11/24/2015

 Description:
 LearnBits Raspberry pi Shield V0

 */


#include "LearnBitsShield.h"

///////////////////////////
//  Neo Pixels Variables //
///////////////////////////
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, DIN_NEO, NEO_GRB + NEO_KHZ800);

const uint32_t RGB_TABLE[RGB_TABLE_SIZE]={
0x800000,0x8B0000,0xA52A2A,0xB22222,0xDC143C,0xFF0000,0xFF6347,0xFF7F50,0xCD5C5C,0xF08080,0xE9967A,0xFA8072,
0xFFA07A,0xFF4500,0xFF8C00,0xFFA500,0xFFD700,0xB8860B,0xDAA520,0xEEE8AA,0xBDB76B,0xF0E68C,0x808000,0xFFFF00,
0x9ACD32,0x556B2F,0x6B8E23,0x7CFC00,0x7FFF00,0xADFF2F,0x006400,0x008000,0x228B22,0x00FF00,0x32CD32,0x90EE90,
0x98FB98,0x8FBC8F,0x00FA9A,0x00FF7F,0x2E8B57,0x66CDAA,0x3CB371,0x20B2AA,0x2F4F4F,0x008080,0x008B8B,0x00FFFF,
0x00FFFF,0xE0FFFF,0x00CED1,0x40E0D0,0x48D1CC,0xAFEEEE,0x7FFFD4,0xB0E0E6,0x5F9EA0,0x4682B4,0x6495ED,0x00BFFF,
0x1E90FF,0xADD8E6,0x87CEEB,0x87CEFA,0x191970,0x000080,0x00008B,0x0000CD,0x0000FF,0x4169E1,0x8A2BE2,0x4B0082,
0x483D8B,0x6A5ACD,0x7B68EE,0x9370DB,0x8B008B,0x9400D3,0x9932CC,0xBA55D3,0x800080,0xD8BFD8,0xDDA0DD,0xEE82EE,
0xFF00FF,0xDA70D6,0xC71585,0xDB7093,0xFF1493,0xFF69B4,0xFFB6C1,0xFFC0CB,0xFAEBD7,0xF5F5DC,0xFFE4C4,0xFFEBCD,
0xF5DEB3,0xFFF8DC,0xFFFACD,0xFAFAD2,0xFFFFE0,0x8B4513,0xA0522D,0xD2691E,0xCD853F,0xF4A460,0xDEB887,0xD2B48C,
0xBC8F8F,0xFFE4B5,0xFFDEAD,0xFFDAB9,0xFFE4E1,0xFFF0F5,0xFAF0E6,0xFDF5E6,0xFFEFD5,0xFFF5EE,0xF5FFFA,0x708090,
0x778899,0xB0C4DE,0xE6E6FA,0xFFFAF0,0xF0F8FF,0xF8F8FF,0xF0FFF0,0xFFFFF0,0xF0FFFF,0xFFFAFA,0x000000,0x696969,
0x808080,0xA9A9A9,0xC0C0C0,0xD3D3D3,0xDCDCDC,0xF5F5F5,0xFFFFFF};

///////////////////////
Пример #23
0
void Effects::init(){
  strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
  strip.begin();
  strip.show();
}
Пример #24
0
/*
 * This is a minimal example, see extra-examples.cpp for a version
 * with more explantory documentation, example routines, how to
 * hook up your pixels and all of the pixel types that are supported.
 *
 */

SYSTEM_MODE(AUTOMATIC);

// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_PIN D2
#define PIXEL_COUNT 10
#define PIXEL_TYPE WS2812B

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

// Prototypes for local build, ok to leave in for Build IDE
void rainbow(uint8_t wait);
uint32_t Wheel(byte WheelPos);

void setup()
{
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}
void loop()
{
  rainbow(20);
}
Пример #25
0
// constructor
Led::Led(int data_pin) {
  pin = data_pin;
  pixels = Adafruit_NeoPixel(NUMPIXELS, pin, NEO_GRB + NEO_KHZ800);
  pixels.begin();
  pixels.setBrightness(255);
}
Пример #26
0
#include <Adafruit_NeoPixel.h>
#include "debug/Debug.h"
#include "color/Color.h"
#include "color/ColorShift.h"

#ifdef __AVR__
#include <avr/power.h>
#endif

#define PIN_LED_STRIP 6
#define  PIN_DIAGNOSTIC_LED 13

#define NUM_LEDS  77

Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN_LED_STRIP, NEO_GRB + NEO_KHZ800);

void colorSet(uint32_t c);

void fade(const Color from, const Color to, uint32_t how_long_ms);


uint32_t minutes_to_ms(uint32_t minutes) {
    return minutes * 60 * 1000;
}

void setup() {
    pinMode(PIN_DIAGNOSTIC_LED, OUTPUT);

    Serial.begin(9600);

    debug(F("initializing LED Strip\n"));
Пример #27
0
#include <Adafruit_NeoPixel.h>
#include <avr/power.h>
#include <XBee.h>

#define PIN       6
#define NUMPIXELS 8

char MSG[25], CMD[30];
int DEL = 100, BRI = 20, R = 255, G = 100, B = 50, TOUT = 5;
int x;
long t;

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

XBee xbee = XBee();
XBeeResponse response = XBeeResponse();
ZBRxResponse rx = ZBRxResponse();
ModemStatusResponse msr = ModemStatusResponse();

void setup() {
  pixels.begin(); 
  t = millis() + TOUT * 1000;
  CMD[0] = 'F';
  
  //Change to Serial1 if using micro
  Serial.begin(9600); 
  xbee.begin(Serial);
}

void checkTimeout(){
  if(TOUT == 0)
Пример #28
0
    1,  1,  1,  1,  1,  1,  1,  1,  1,  2,  2,  2,  2,  2,  2,  2,
    2,  3,  3,  3,  3,  3,  3,  3,  4,  4,  4,  4,  4,  5,  5,  5,
    5,  6,  6,  6,  6,  7,  7,  7,  7,  8,  8,  8,  9,  9,  9, 10,
   10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16,
   17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25,
   25, 26, 27, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36,
   37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50,
   51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68,
   69, 70, 72, 73, 74, 75, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89,
   90, 92, 93, 95, 96, 98, 99,101,102,104,105,107,109,110,112,114,
  115,117,119,120,122,124,126,127,129,131,133,135,137,138,140,142,
  144,146,148,150,152,154,156,158,160,162,164,167,169,171,173,175,
  177,180,182,184,186,189,191,193,196,198,200,203,205,208,210,213,
  215,218,220,223,225,228,231,233,236,239,241,244,247,249,252,255 };

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NEOPIXEL_COUNT, PIN_LED_NEOPIXEL, NEOPIXEL_MODE);

uint16_t curDispVal;
uint32_t lastUpdateMillis;
uint32_t lastWriteBucket = 0;

void setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b) {
    pixels.setPixelColor(n, GAMMAS[r], GAMMAS[g], GAMMAS[b]);
}

#define MAX_SPEED 1
void recalcVal(int16_t sensorVal) {
	uint32_t curMillis = millis();
	uint32_t delta = curMillis - lastUpdateMillis;

	if (delta) {
Пример #29
0
}

Morse *ExtendoHand::createMorse() {
    return new Morse(SPEAKER_PIN, morseStopTest);
}
*/

/*
Droidspeak *ExtendoHand::createDroidspeak() {
    return new Droidspeak(SPEAKER_PIN);
}
*/

#include <Adafruit_NeoPixel.h>

Adafruit_NeoPixel leds = Adafruit_NeoPixel(1, RGB_LED_PIN, NEO_GRB + NEO_KHZ800);

void ExtendoHand::setColor(unsigned long color) {
    leds.setPixelColor(0, (uint32_t) color);
    leds.show();
}

void ExtendoHand::vibrate(unsigned long durationMs) {
    digitalWrite(VIBRO_PIN, HIGH);
    delay(durationMs);
    digitalWrite(VIBRO_PIN, LOW);
}

void ExtendoHand::vibrateNonBlocking(unsigned long durationMs) {
    if (0 == durationMs) {
        return;
Пример #30
0
#include <Arduino.h>
#include <Adafruit_NeoPixel.h>
#include <CmdMessenger.h>

#define MAX_TEMP 60.0f
#define MIN_TEMP 0.0f

#define NUM_LED 12
#define LED_PIN 2

#define CYCLE 1000

CmdMessenger cmdMessenger = CmdMessenger(Serial);
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LED, LED_PIN, NEO_GRB + NEO_KHZ800);
int blink = 0;
int warning = 0;

enum
{
  kSetLED,
};

void warning_blink()
{
  if (warning < 0 && blink >= CYCLE / 2)
    {
      for(int j=0; j < NUM_LED; j++) {
	strip.setPixelColor(j, strip.Color(0, 0, 255));
      }
    }
  else if (warning > 0 && blink >= CYCLE / 2)