I don't have a flexsensor, but I have a pot.
I didn't want to rig up a bunch of LEDs (it's your project), but I have a bulb that pulls 120mA (considerable draw), used a MOSFET. So, I rigged that much up and used the following sketch; pretty short and sweet --
/*
read pot (sensor)
result PWM
repeat
*/
const byte sensorPin = 3;
const byte lightPin = 0;
int sensorval;
void setup()
{
pinMode (lightPin, OUTPUT);
}
void loop ()
{
sensorRead();
analogWrite (lightPin,sensorval);
}
void sensorRead ()
{
delay(10);
sensorval = analogRead(sensorPin);
sensorval = sensorval/4; // 1024/4 = 256
if (sensorval < 20) // for solid OFF "zone"
{
sensorval = 0;
}
}
I used an ATtiny85 instead of a full-blown Arduino, but, again, same difference.
For the analogWrite pins, use one of the designated PWM pins (D13 is not one.)
For the analogRead, use A0-A5.
> > > I guess I wasn't paying close enough attention - you've bought a matrix already.
I don't have any good suggestions for that (other than not using it.) You'll have to home-run 16 wires or something (not good)? I'm not a 7219 maven. Code intensive little things for being so "handy".
So, I guess your dilemma is: How To Vary the Intensity of LEDs with a 7219?
Also, with a 5x7, say, being a rectangle, basically everyone wants to reckon that as 5 columns and 7 rows.
But a square has as many rows as columns, so whether it's column cathodes or column rows is more, to me, in the eye of the beholder. Page 3 of your linked PDF shows how they figure though. I guess, looking at the labelled side with the pins pointing down, pin 1 is on the left (and pin 16 is directly opposite it on the other side.)