• Hi - it shouldn't really matter. I think generally Graphics expects the pixels start in the top-left and scan across and then down, but you can fix any rotation and mirroring that's needed with g.setRotation.

    The Charlieplex library does expect that the LEDs are going to be arranged in a N*N-1 pattern though - so if you do something different then the underlying code would need changing... However I doubt doing that is as mind-bending as it would be trying to wire up something that wasn't N*N-1...

    And yes, as long as the Graphics library has the pixels in the right places it'll be fine to display text.

    How big a Charlieplexed pattern were you thinking of doing with it?

  • Oh another question, how do I turn a function on and off using only one button?
    For now I have individual on/off buttons but I would like to use just one.
    I've tried var l;function(l=!l) and similar methods but they all don't seem to work.

    pinMode(B8, 'input_pullup');
    pinMode(B5, 'input_pullup');
    
    function random(state) {
      
      if (state === true || state === 1) {
        random();
      } else if (state === false || state === 0) {
        allClear();
        clearTimeout();
        setDeepSleep(1);
        return;
      }
      
      digitalWrite(A8, 0);
      digitalWrite(B7, 0);
      
      //var num = Math.floor((Math.random() * 10));
      //var sec = ((Math.random() * 0.5) + 1) * 1000;
      var what = Math.floor((Math.random() * 3));
      
      if (what === 0) {
        allClear();
      }
      else if (what == 1 || what == 2) {
        digitalWrite(A, Math.floor((Math.random() * 2)));
        digitalWrite(B, Math.floor((Math.random() * 2)));
        digitalWrite(C, Math.floor((Math.random() * 2)));
        digitalWrite(D, Math.floor((Math.random() * 2)));
        digitalWrite(E, Math.floor((Math.random() * 2)));
        digitalWrite(F, Math.floor((Math.random() * 2)));
        digitalWrite(G, Math.floor((Math.random() * 2)));
      }
    
      setTimeout(random, ((Math.random() * 701) + 1));
      
      setWatch( function(e) {
        random(false);
      }, B8, {repeat:true, edge:'falling', debounce:100});
      
    }
    
    setWatch( function(e) {
      clearTimeout();
      random(true);
    }, B5, {repeat:true, edge:'falling', debounce:100});
    
    setDeepSleep(1);
    
About

Avatar for Gordon @Gordon started