Wednesday, September 7, 2022

ESP8266 FastLED Issues


While trying to use an ESP8266 D1 mini Arduino board to control some addressable WS8211 LEDs, I found that it didn't seem to work.


After some reading, I found that the pin numbering didn't line up the way I thought it would. I'm not sure if this is a bug in FastLED or the result of using a D1 clone, but once I had this information everything started working perfectly. (Note, my board layout is a bit different, but this still applied.) -- easiest solution is to use D2 label for GPIO4.


Here is the working test sketch: 

#include <FastLED.h>
#define DATA_PIN 4 // but plug into pin 2 or use D4
#define LED_BRIGHTNESS 50 // global brightness setting (might change for HSV)
#define LED_COUNT 50 // lights per pin
void setup() {
  FastLED.addLeds<WS2811, DATA_PIN>(leds, LED_COUNT);
  fill_solid(leds, LED_COUNT, CRGB::Black);;
void loop() {
  cd77_colorwipe_dot(CRGB::Red, 10);
void cd77_colorwipe_dot(CRGB color, uint16_t wait) {
  for (byte led = 0; led < LED_COUNT; led++) {
    leds[led] = color;
    leds[led] = CRGB::Black;;

Thursday, July 28, 2022

Symon (a.k.a. Simon) -- that old toy that tests your memory...

A rapid coding challenge I decided to do sometime ago was for a Simon replication game that was fully user interactive. I've made the code and assets available for anyone interested -- just don't judge me...

Play the game!

Source Code:

Tuesday, July 26, 2022

Start-Up Roadmap - Digi-Key Maker.IO

While looking over some components looking to source a pot for an amp I'm fixing, I found this cool little outline of taking a product from concept to the masses. It's a good thing to remember when we only want to do steps, 1, 4 and 5. 😏

To make it easier for printing and concise to fit on one page, I went a head and created a PDF of it. 

Keep in mind all the logos and images are their copyright, not mine and I'm more than happy to remove files, etc. if Digi-Key prefers. 

It's not super optimized for size, but I'm sure you can manage :).

Chutes and Ladders is totally random, just let the computer play it...

My kids like to play Chutes and Ladders as a family and I have no idea why. Even though the game is pretty much entirely random (pro spinner flickers aside), they still feel bummed when they lose. As a quick exercise, I decided to code up the game having the computer play all the turns until a winner is found. This was meant to take me 30 minutes, but I guess including my son's 30 minutes to test it, we could say it took about an hour. It's not meant to be clean or any kind of representation of proper coding, syntax, etc. so keep your expectations low...

I do not have this hosted at the moment, but the code is available on GitHub:

P.S. If you have your console open, you can see all the moves the winner made on their way to win the game. 

Friday, June 10, 2022

Laravel / Google Maps -- Get Locations in Bounds


While working on a project using Laravel back-end and JavaScript front-end. I had a situation where I needed to get all the locations for the map with given bounds. First, I tried just doing a bounding box check, which worked but only sometimes. 


In this problem, I was not alone. After reading and trying some various approaches, this one by FatMonk on SO did the trick ( 

// Google Maps API map.getBounds()

$north = $lat1_ne || 90;
$east = $lng1_ne;
$south = $lat2_sw || -90;
$west = $lng2_sw;

$locations = Location::whereBetween('lat', [$south, $north])
    ->where(function($query) use ($west, $east){
        if ($west < $east){
            $query->whereBetween('lon', [$west, $east]);
            $query->whereBetween('lon', [$west, 180])
                ->orWhereBetween('lon', [-180, $east]);

Thursday, June 9, 2022

BlackMagic Ursa Mini G2 - Iso to gain DBs translation

Recently I have needed to get this information and couldn't quickly find it, so I'm shamelessly placing it here for next time :). 

db ISO
Natives are 0db and +18db

ISO 100 = -12db. ISO doubles every 6db and the highest ISO is 25600 @ 36db.


Friday, May 27, 2022

Python: valueerror too many values to unpack (expected 2) stackoverflow - dict to tuples

Admittedly, I haven't spent a lot of time in Python lately and find myself hitting my head on the wall trying to figure out some fairly simple things again. This is one of those such things.


I am using the requests library to interact with a server. This library has some great methods to prepare requests and then be able to send them at a later time. In one of these instances, I was building and preparing the Request with some data (also wrapping with the session to preserve cookie info):

request = session.prepare_request(Request('GET', "", params=rdata))

The rdata object looks like a simple dict with key/value pairs. However, when running the code I got the error: 

ValueError: too many values to unpack (expected 2)


After printing out the object and comparing it with a clean object, I found the issue:

rdata = {'key': 1, 'value': 2},

The comma at the end implied to Python that my structure was a tuple (pseudo: type(rdata) == <class 'tuple'>). Also, keep in mind my variable has a lot more data in it running it off the screen and I am not using word-wrap... so out of site, out of mind I guess. 

After removing the comma, rdata was seen as a dict again and could be converted to a list of tuples by requests prepare function.