• RasPiO Shop
  • Pro Hat
  • Analog Zero
  • Duino
    • duino-assembly
    • duino-setup
    • duino-programming
    • duino-videos
    • lcd20
  • RasPiO Products
    • inspiring
    • Pro Hat
    • Analog Zero
    • Duino
      • lcd20
    • Portsplus
    • GPIO ruler
    • GPIO Zero ruler
    • Breakout
    • 7 Seg kit
  • About RasPiO®
RasP.iO

Digispark sketch for RasPiO InsPiRing

Posted on March 16, 2019 by alex

Use the Arduino IDE with the Adafruit DotStar library
Data Pin 1
Clock Pin 0

// Simple strand test for Adafruit Dot Star RGB LED strip.
// This is a basic diagnostic tool, NOT a graphics demo...helps confirm
// correct wiring and tests each pixel's ability to display red, green
// and blue and to forward data down the line.  By limiting the number
// and color of LEDs, it's reasonably safe to power a couple meters off
// the Arduino's 5V pin.  DON'T try that with other code!

#include <Adafruit_DotStar.h>
// Because conditional #includes don't work w/Arduino sketches...
//#include <SPI.h>         // COMMENT OUT THIS LINE FOR GEMMA OR TRINKET
#include <avr/power.h> // ENABLE THIS LINE FOR GEMMA OR TRINKET

#define NUMPIXELS 24 // Number of LEDs in strip

// Here's how to control the LEDs from any two pins:
#define DATAPIN   1 //4
#define CLOCKPIN  0 //3
Adafruit_DotStar strip = Adafruit_DotStar(
  NUMPIXELS, DATAPIN, CLOCKPIN, DOTSTAR_BGR);
// The last parameter is optional -- this is the color data order of the
// DotStar strip, which has changed over time in different production runs.
// Your code just uses R,G,B colors, the library then reassigns as needed.
// Default is DOTSTAR_BRG, so change this if you have an earlier strip.

// Hardware SPI is a little faster, but must be wired to specific pins
// (Arduino Uno = pin 11 for data, 13 for clock, other boards are different).
//Adafruit_DotStar strip = Adafruit_DotStar(NUMPIXELS, DOTSTAR_BRG);

int delayval = 30;  // delay for 1 ms

void setup() {

#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000L)
  clock_prescale_set(clock_div_1); // Enable 16 MHz on Trinket
#endif

  strip.begin(); // Initialize pins for output
  strip.show();  // Turn all LEDs off ASAP
}

void loop() {   

    for(int i=NUMPIXELS; i>-1; i--){
      strip.setPixelColor(i, strip.Color(255, 0, 0)); // pixels.Color takes RGB values in GRB format,  0,0,0  to 255,255,255
      strip.show();
      delay(delayval);
    }

    for(int i=0; i<NUMPIXELS; i++){
      strip.setPixelColor(i, strip.Color(0, 255, 0)); 
      strip.show();
      delay(delayval);
    }

    for(int i=NUMPIXELS; i>-1; i--){
      strip.setPixelColor(i, strip.Color(0, 0, 255)); 
      strip.show();
      delay(delayval);
    }

    for(int i=0; i<NUMPIXELS; i++){
      strip.setPixelColor(i, strip.Color(255, 0, 125)); 
      strip.show();
      delay(delayval);
    }

    for(int i=NUMPIXELS; i>-1; i--){
      strip.setPixelColor(i, strip.Color(0, 255, 125)); 
      strip.show();
      delay(delayval);
    }

    for(int i=0; i<NUMPIXELS; i++){
      strip.setPixelColor(i, strip.Color(255, 100, 0)); 
      strip.show();
      delay(delayval);
    }

    for(int i=NUMPIXELS; i>-1; i--){
      strip.setPixelColor(i, strip.Color(255, 125, 125)); 
      strip.show();
      delay(delayval);
    }
}

Posted in Uncategorized |
« RasPiO Night Light arrival tweets
RasPiO Breadboard Pi arrival tweets »

NEW Product!

NEW RasPiO® Breadboard Pi Bridge New RasPiO Breadboard Pi Bridge

Pi Ports to Breadboard in Numerical Order

Check out NEW RasPiO Online Shop New products being added daily.

Pages

  • inspiring
  • prohat
  • analogzero
  • gpioruler
  • gpiozeroruler
  • duino
    • duino-assembly
    • duino-programming
    • duino-setup
    • duino-videos
    • lcd20
  • portsplus
  • Introducing RasPiO®
  • range
  • RasPiO Breakout

Archives

  • May 2019
  • March 2019
  • October 2018
  • January 2018
  • July 2017
  • June 2017
  • December 2016
  • November 2016
  • September 2016
  • December 2015
  • November 2014
  • October 2014
  • August 2014
  • July 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2013
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Pages

  • analogzero
  • duino
    • duino-assembly
    • duino-programming
    • duino-setup
    • duino-videos
    • lcd20
  • experiment
  • gpioruler
  • gpiozeroruler
  • inspiring
  • Introducing RasPiO®
  • portsplus
  • prohat
  • range
  • RasPiO Breakout
  • RasPiO Breakout Pro
  • RasPiO Port labels

Archives

  • May 2019
  • March 2019
  • October 2018
  • January 2018
  • July 2017
  • June 2017
  • December 2016
  • November 2016
  • September 2016
  • December 2015
  • November 2014
  • October 2014
  • August 2014
  • July 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2013

WordPress

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
© Alex Eames 2012-19