The Alpha Geek – Geeking Out

Project #2 – Lens – LED – Mk3

neopixMk3

1 X Arduino and Breadboard Holder

1 X Breadboard – Translucent Self-Adhesive (Clear)

1 X Arduino UNO Rev3

2 X Panel Mount 10K potentiometer (Breadboard Friendly) – 10K Linear

13 X Jumper Wires Premium 6″ M/M

1 X Cable

1 X Project #2 – Lens – LED – Mk1

LensLEDMk3.3.ino

// ***** Don Luc *****
// Software Version Information
// 3.0
// Real
// 3.1
// sensorValue
// 3.2
// red, green, blue
// 3.3
// delayVal

#include <Adafruit_NeoPixel.h>
// Which pin on the Arduino is connected to the NeoPixels?
#define PIN 6
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 2
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
// Panel Mount 1K potentiometer Brightneed
const int sensorPin = A0;
// Panel Mount 1K potentiometer
const int sensorDelay = A1;
// variables:
int sensorValue = 0;         // the sensor value
int sensorMin = 1023;        // minimum sensor value
int sensorMax = 0;           // maximum sensor value
int red = 0;
int green = 0;
int blue = 0;
int x = 0;
long delayVal = 0;
long xp = 0;

void loop() {
 
  xp = analogRead(sensorDelay);
  delayVal = (20000 + xp);
  // range value:
  switch (x) {
    case 0:
      // Blue
      red = 0;
      green = 102;
      blue = 204;        
      neopix();
      delay(delayVal); // Delay for a period of time (in milliseconds).
      x = 1;
      break;
    case 1:
      // Yellow
      red = 255;
      green = 255;
      blue = 0;        
      neopix();
      delay(delayVal); // Delay for a period of time (in milliseconds).
      x = 2;
      break;
    case 2:
      // Pink
      red = 255;
      green = 153;
      blue = 203;        
      neopix();
      delay(delayVal); // Delay for a period of time (in milliseconds).
      x = 3;
      break;
    case 3:
      // White
      red = 255;
      green = 255;
      blue = 255;        
      neopix();
      delay(delayVal); // Delay for a period of time (in milliseconds).
      x = 4;
      break;  
    case 4:
      // Green
      red = 0;
      green = 255;
      blue = 0;        
      neopix();
      delay(delayVal); // Delay for a period of time (in milliseconds).
      x = 5;
      break;
    case 5:
      // Orange
      red = 255;
      green = 102;
      blue = 0;        
      neopix();
      delay(delayVal); // Delay for a period of time (in milliseconds).
      x = 6;
      break;
    case 6:
      // Violet
      red = 204;
      green = 102;
      blue = 204;        
      neopix();
      delay(delayVal); // Delay for a period of time (in milliseconds).
      x = 0;
      break;      
  }

}

neopin.ino

void neopix() {
  
  for(int i=0; i

setup.ino

void setup() {
  pixels.begin(); // This initializes the NeoPixel library.
}

Don Luc

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories
Archives