bigal_scorpio
Active Member
Sure. Here's a Charlieplexed 20-LED circuit with 32 duty cycle levels per LED.
The software PWM driver uses a 20 element array which contains duty cycles values of 0..31 for each LED. You stuff the array in 'main' with the values you want to animate the display.
Here's the code Futz came up with for the pattern shown in the video above (note that LED 0 is top left and LED 19 is bottom right). I had to use very low duty cycle values to keep from overloading the camera. The entire BoostC program listing can be found here.
Cheerful regards, Mike
Code:// simple interface to pwm driver using duty cycle values of 0..63 led[0] = led[19] = 11; // 11 * 0.3125% = 3.4% of 20% max led[1] = led[18] = 7; // 7 * 0.3125% = 2.2% led[2] = led[17] = 5; // 5 * 0.3125% = 1.5% led[3] = led[16] = 4; // 4 * 0.3125% = 1.2% led[4] = led[15] = 3; // 3 * 0.3125% = 0.9% led[5] = led[14] = 2; // 2 * 0.3125% = 0.6% led[6] = led[13] = 1; // 1 * 0.3125% = 0.3% led[7] = led[12] = 0; // led[8] = led[11] = 0; // led[9] = led[10] = 0; // while(1) { // simple animation demo temp = led[0]; // while(!last_column); // sync' to 16.25 msec frame rate for(x=0; x<19; x++) // { led[x] = led[x+1]; // } // led[19] = temp; // delay_ms(26); // } }
Hi Mike,
Thanks for the code but what language is it?
I only have experience of MikroBasic and in your code I don't see anything resembling the Array command that I have?
Also what is the X++ meaning?
Al
Last edited by a moderator: