Project #2 – Lens – LED – Mk4

LensLEDMk4

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

3 X Jumper Wires Premium 6″ M/M

1 X Project #2 – Lens – LED – Mk3

LensLEDMk4.3.ino

// ***** Don Luc *****
// Software Version Information
// 4.1 - 4.2 - 4.3
// sensorNumber

#include 
// 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;
// Panel Mount 1K potentiometer
const int sensorNumber = A2;
// 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;
int y = 0;
int z = 0;

void loop() {
 
  z = analogRead(sensorNumber);
  y = (z / 127);
  
  // range value:
  switch (y) {
    case  0:
      // Blue
      red = 0;
      green = 102;
      blue = 204;        
      neopix();
      break;
    case 1:
      // Yellow
      red = 255;
      green = 255;
      blue = 0;        
      neopix();
      break;
    case 2:
      // Pink
      red = 255;
      green = 153;
      blue = 203;        
      neopix();
      break;
    case 3:
      // White
      red = 255;
      green = 255;
      blue = 255;        
      neopix();
      break;  
    case 4:
      // Green
      red = 0;
      green = 255;
      blue = 0;        
      neopix();
      break;
    case 5:
      // Orange
      red = 255;
      green = 102;
      blue = 0;        
      neopix();
      break;
    case 6:
      // Violet
      red = 204;
      green = 102;
      blue = 204;        
      neopix();
      break;     
    case 7:
        xp = analogRead(sensorDelay);
        delayVal = (1000 * 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;      
          }
          break; 
  }

}

neopin.ino

void neopix() {
  
  for(int i=0; i<NUMPIXELS; i++){
 
     // read the sensor:
    sensorValue = analogRead(sensorPin);

    // apply the calibration to the sensor reading
    sensorValue = map(sensorValue, sensorMin, sensorMax, 0, 255);

    // in case the sensor value is outside the range seen during calibration
    sensorValue = constrain(sensorValue, 0, 255); 
    
    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setBrightness( sensorValue );
    pixels.setPixelColor(i, pixels.Color(red,green,blue)); 
    pixels.show(); // This sends the updated pixel color to the hardware.

    delay(50); // Delay for a period of time (in milliseconds).
    
  }
  
}

setup.ino

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

Don Luc

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

Project #2 – Lens – LED – Mk2

LensLEDMk2

1 X Arduino UNO Rev3

1 X Cable

1 X Project #2 – Lens – LED – Mk1

LensLEDMk2.1.ino

// ***** Don Luc *****
// Software Version Information
// 2.1

#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);

int delayval = 500; // delay for half a second

void loop() {

  for(int i=0;i<NUMPIXELS;i++){
    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setBrightness(125);
    pixels.setPixelColor(i, pixels.Color(50,150,50)); // Moderately bright green color.
    pixels.show(); // This sends the updated pixel color to the hardware.
    delay(delayval); // Delay for a period of time (in milliseconds).
    
  }
}

setup.ino

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

Don Luc

Project #1 – The AcceleroSynth – Mk1

Apr 3, 2012 @ 15:03


We are finally ready for our first electronics project, The AcceleroSynth. It is an microcontroller-based (Arduino) music synth that is controller by a 3 axis analog accelerometer. It will be both a hardware and a software synth. This is the announcement for the project and in the coming days I will post the BOM (Bill of Material), schematics and Arduino code with the first assembly video. The project will first be assembled on a protoboard, then a soldered version will be built either on a perfboard or on an Arduino ProtoShield. If there is enough demand either a PCB or an Arduino Shield will be built for the project and sold here. More on that later. The first installment on the building of the project should be up on a few days.

Don Luc

Tomorrow’s Video – An Introduction to Microcontrollers

Mar 28, 2012 @ 22:12

I’m hard at work… Actually make that “I think” that tomorrow’s video post will be an introduction to microcontrollers. I will dig some stuff out of the drawers tomorrow and as usual make it up as I go and it will probably be about microcontrollers.

Sleep tight…

Don Luc

New Format and Name

Mar 14, 2012 @ 23:39

This blog was launched close to 2 years ago and was active only a few weeks. Our work load got the best of us and most of the blogs we maintained have been inactive since then. In the past weeks we have started to revamp our web presence and for this blog the first step was to change its focus and name. It was started as a consulting industry blog called “Consult Ants” and it will now become “The Alpha Geek” a video blog about all things technological. In the coming days the first video post will be live and we will also start posting project from programming of all kind (desktop, microcontroller, web and mobile) to electronics and even music instrument hacks.

Watch this space in the coming days for our debut video and further announcements.

Don Luc

Fun with browsers and WordPress

Apr 30, 2010 @ 20:40

It has been one of those days. Somebody reported to me last night that the theme of our <a href=”http://www.igourmand.com/eatdrink/”>food and wine blog</a> did not display the first photo of any page correctly. The first image appeared after a huge space. The problem only happened with Internet Explorer and everything was fine with Firefox. Thus became the quest early this morning at 8am and I started tracking the problem.

I first thought that it was some “Div” problem as the theme used was one that I had made over 5 years ago. I recently rewrote it to change the look and then I rewrote it again last week to bring it into line with the current WordPress theme architecture. I had yet to polish it and finish formatting it and commenting it properly, so my logical thought was it was just some error in one of the PHP files of the theme. I even remembered checking it with various browsers just last week to make sure there was not such a problem, but since I have been doing small incremental update maybe some little error slipped in and I did not catch it.

I first checked the source code in the browser to see if I could find something wrong there. I used a few automated HTML formatter and the results were dismal. If somebody has a good HTML formatter that actually works to recommend, please let me know.

I ended up formatting everything by hand and after reviewing the code found out that there was absolutely nothing obviously wrong with it, and nothing that would explain the discrepancy between Firefox and IE. I had a hunch that the problem might be with the sidebar code, so I disabled it and low and behold the huge space before the first image on a page disappeared. Thus my hunch was right.

I then re-enabled each section of the sidebar one after another until the problem reappeared and finally found that the problem was with the image links I added a few days ago in the sidebar. There is absolutely no reason that IE should behave this way, except that it does not interpret the CSS properly. There is plenty of space for both the sidebar image links and the image in the post, and even if I resized the image in the post to a smaller size the problem continued.

I then starting fine-tuning the CSS and with just a few minor changes of around 15 pixels in one section everything popped back together as it should. I guess that IE is just very bad at properly following the CSS and placing elements on the screen.

Once that was done I decided that since I was in the middle of doing a lot of things with the theme, I should finish it properly. I spent the rest of the day properly formatting the code, changing deprecated WordPress functions to their new versions, profusely commenting the theme so the next time I need to modify things I can quickly find what I am looking for, doing some minor cosmetic changes to the theme, and generally improved its function and look. I still want to spend a bit of time beautifying things, but now it will be a much simpler job after the work that was done today.

What started as what I thought would be a simple job finding a faulty line of code, ended up a day of detective work. The nice thing is that I learned a lot dissecting the more recent template format of WordPress as I had not digged in its depths since version 1.5. It is much more flexible and powerful now and I will go to bed much less stupid tonight after a great day learning new things about the inner works of WordPress. I’m just glad that the work was for myself as I would not have like to explain the reason to justify a full day a work simply to move a picture up in a blog to a client.

Don Luc