Avatar for AdaMan82

AdaMan82

Member since Aug 2018 • Last active Aug 2018
  • 2 conversations
  • 16 comments

Most recent activity

    • 22 comments
    • 357 views
  • Avatar for AdaMan82

    Yeah I considered adding animations to the randomizer function. It's just flair really so not worth the effort right now, but I'm going to make it so I can connect a cable to the prototype so if I want to mess with the code I can.

    There's not really any value to adding a screen as the game keeps track of all the stuff itself, but if we really wanted to go crazy at some point you could load a thing that keeps track of the expansions so you can manually select/deselect them (or random decks) and make it fully customizeable.

    I thought about making it sellable at some point (have to make one first), but I've kinda missed the boat. The game peaked years ago, so its more of a niche thing, mainly for myself, because card storage and selection is REALLY inefficient as a whole and takes up about 25% of playtime I would say.

  • Avatar for AdaMan82

    Sorry for the disappearing act, I was otherwise engaged.

    So I'm using 3x AAs which provide 4.5 volts, more than enough to do the job. The way I have it configured now, 10x LEDs light up for 1 minute in their random configuration. When increasing or decreasing the total number of LEDs, one LED illuminates for 500ms.

    The big picture project is to build a modular deck holder for the Dominion game to hold all the cards for all the random expansions, and based on the number of decks, (which is changed by adjusting the "max" number of leds using +/- buttons in the diagram below) randomly select 10 decks and display those lights on for 60 seconds, allowing you to pull the decks out of the box.

    So now I have the electronics but, I actually need to build the holder. With even as little as 3 hours of functional power, that means over 180 randoms +/-. I doubt I will play 180 games in a year, so it meets my needs. Also, I am only outputting at 20 out of 255, so I'm assuming the reduced brightness will also prolong the battery. I'm fairly confident that 3AA should last me one or more years assuming the batteries are not hot garbage. With rechargeable, the brightness may be lower but still good.

    And to answer questions, ref: limitations, obviously has to be portable, and I want the batteries to be easily replaceable.

    I'm fairly confident that the current setup and code work to my requirements.

    Cross posted from my other thread:
    Imagine the black bars being full slots in a holder, and the white bars being empty slots, that could be filled.

    [+] increases the length of the strip flashing the next light in the strip to show where the "max" is at for the random (green dot in this case).

    [-] decreases the length of the strip as per above.

    [rnd] lights up 10x random "full" slots (cyan dots as an example) for 1 minute. If you press the button again, it lights up a new random 10 lights for 1 minute.

  • in Pico / Wifi / Original Espruino
    Avatar for AdaMan82

    Good point on the data sheet. I guess that makes the most sense. The issue applied on both with USB + battery and just battery pack. The working version does not use pinMode(B15,"af_opendrain").

    My programming background is basically VB in HS, some random C/C++/C# and excel macros, so hardly a pro. Just a baseline knowledge to make things happen.

    Either way, after overcoming the issue above, I have actually completely finished (the electronics part anyways) my project, and a aside from a brief flash at startup as it conducts onInit() and blacks everything out, which ultimately confirms that its turning on, it works perfectly.

    Now for the frigging 100 hours of 3d printing the pieces its going into.

  • in Pico / Wifi / Original Espruino
    Avatar for AdaMan82

    Alright I've got it all figured out. For whatever reason, (either by design or by fluke) my strip defaults to on, so on init I need to turn everything off before doing things off the battery pack. The reason is the draw is too high which makes the lights appear to be out or red when on. I anticipated this, but I did not anticipate the lights to be on by default. Here is how I executed the code to turn everything off, so I could then start turning what I want on:

    var rgb = new Uint8ClampedArray(300*3);
    
    function setOff() {
      for (var i=0;i<rgb.length;i+=3) {
         rgb[i  ] = 0;
         rgb[i+1] = 0;
         rgb[i+2] = 0;
      }
    }
    
    function doOff() {
      setOff();
      require("neopixel").write(B15, rgb);
    }
    function onInit() {
    doOff();
    }
    
    onInit();
    

    Wiring as per below. Moving the resistor also had an effect on how strong the lights that I wanted to turn on would be when I wanted them on.

    I can now turn the lights on at will. Big success.

    Thanks again for everyone's help.

  • in Pico / Wifi / Original Espruino
    Avatar for AdaMan82

    That's right. It is one whole strip. zig zagging through the assembly.

    Ultimately 3 functions. One to increase the number (ideally illuminating the light its at), one to reduce the number (illuminating the spot its at) and one to generate a random 10 numbers up to and including where its at and leave them on for 3 mins.

    Its pretty straightforward (I think)

  • in Pico / Wifi / Original Espruino
    Avatar for AdaMan82

    I made a huge step. So all the lights go on by default, but I can turn them off manually with require("neopixel").write(B15, [0,0,0]); I can also turn specific ones on in correct colour combos. ALSO, the reddish colour is definitely due to voltage drop.

    I just don't know why it all defaults to but hey that's a start. The resistor and using the 3.3v output was the issue.

  • in Pico / Wifi / Original Espruino
    Avatar for AdaMan82

    Ok, so I've made some interesting progress.

    I have discovered that the whole strip lights up, but when connecting the 5v line from the strip to the 3.3v out on the Pico, and execute the following code:

    require("neopixel").write(B15, [255,0,0, 0,255,0, 0,0,255]);
    

    Those pixels go very dim but turn the required colour. The remainder of the lights stay on in a redish colour (which I assume is due to voltage drop but would otherwise I assume, be white).

    Its almost like its wired in revers but I have checked the hell out of things so I am fairly confident.

    In response to your questions:
    1) Tutorial: http://www.espruino.com/Individually+Add­ressable+LEDs
    2) Literally: just working with the line above

  • in Pico / Wifi / Original Espruino
    Avatar for AdaMan82

    No way more simple than that. See graphic below.
    Imagine the black bars being full slots in a holder, and the white bars being empty slots, that could be filled.

    [+] increases the length of the strip flashing the next light in the strip to show where the "max" is at for the random (green dot in this case).

    [-] decreases the length of the strip as per above.

    [rnd] lights up 10 random "full" slots (cyan dots as an example) for 3 minutes. If you press the button again, it lights up a new random 10 lights for 3 minutes.

Actions