Ok, my first attempt. I'm a beginner, so I welcome any comments towards a more efficient way of doing what I've just done (see code below)
I'm using the Microchip low count board...which only has 4 LEDs - the code I've kludged together below works fine as I turn the potentiometer on the Low Pin Count Board.
I don't think doing 'log' will be so tough after all (on account, there'll only be six LEDs involved when this is on the guitar, just a matter of tweaking with those individual thresholds to get it looking 'right').
My next attempt will be to get a sample & hold vibe going down (which I'm thinking will just be some form of short 'pause' in each of those 'blocks' & some resistors/caps in series with the LEDs?)
Code:Start: ADCIN 2, DC_In ; Read the DC level IN DC_In = DC_In /2 '256 is too much resolution...cut it down by 50% IF DC_In < 10 THEN low PortC.0 low PortC.1 low PortC.2 Low PortC.3 endif IF DC_In > 25 THEN HIGH PortC.0 low PortC.1 low PortC.2 Low PortC.3 endif IF DC_In > 55 THEN High PortC.0 High PortC.1 low PortC.2 Low PortC.3 endif IF DC_In > 85 THEN High PortC.0 High PortC.1 high PortC.2 Low PortC.3 endif IF DC_In > 110 THEN High PortC.0 High PortC.1 high PortC.2 HIGH PortC.3 ENDIF GOTO START end




Bookmarks