POV code not working
this first post here , first real arduino project
ok wrote code make pov
i borrowed letter index user
dopeyalan
which appreciate much
it saved me lot of time
currently arduino lights first code letter 'h'
which 01110111
but stops there appreciate offer
ok wrote code make pov
i borrowed letter index user
dopeyalan
which appreciate much
it saved me lot of time
currently arduino lights first code letter 'h'
which 01110111
but stops there appreciate offer
quote
const int ledcount = 8; // number of leds in pov
boolean col[8]={
0,0,0,0,0,0,0,0};//binary hex binary conversion
int letters[][5] = { //begin letter hex index
{
0x7e, 0x09, 0x09, 0x09, 0x7e }
, //a
{
0x7f, 0x49, 0x49, 0x49, 0x36 }
, //b
{
0x3e, 0x41, 0x41, 0x41, 0x22 }
, //c
{
0x7f, 0x41, 0x41, 0x22, 0x1c }
, //d
{
0x7f, 0x49, 0x49, 0x49, 0x49 }
, //e
{
0x7f, 0x09, 0x09, 0x09, 0x09 }
, //f
{
0x7e, 0x41, 0x49, 0x49, 0x38 }
, //g
{
0x7f, 0x08, 0x08, 0x08, 0x7f }
, //h
{
0x00, 0x41, 0x7f, 0x41, 0x00 }
, //i
{
0x30, 0x40, 0x41, 0x7f, 0x01 }
, //j
{
0x7f, 0x08, 0x14, 0x22, 0x41 }
, //k
{
0x7f, 0x40, 0x40, 0x40, 0x40 }
, //l
{
0x7f, 0x02, 0x04, 0x02, 0x7f }
, //m
{
0x7f, 0x02, 0x0c, 0x10, 0x7f }
, //n
{
0x3e, 0x41, 0x41, 0x41, 0x3e }
, //o
{
0x1e, 0x21, 0x21, 0x21, 0x5e }
, //q
{
0x7f, 0x09, 0x19, 0x29, 0x46 }
, //r
{
0x26, 0x49, 0x49, 0x49, 0x32 }
, //s
{
0x01, 0x01, 0x7f, 0x01, 0x01 }
, //t
{
0x3f, 0x40, 0x40, 0x40, 0x3f }
, //u
{
0x07, 0x38, 0x40, 0x38, 0x07 }
, //v
{
0x3f, 0x40, 0x3f, 0x40, 0x3f }
, //w
{
0x63, 0x14, 0x08, 0x14, 0x63 }
, //x
{
0x07, 0x08, 0x70, 0x08, 0x07 }
, //y
{
0x61, 0x51, 0x49, 0x45, 0x43 } //z
};//end letter hex index/
int ledpins[] = {
2, 3, 4, 5, 6, 7,8 ,9}; //pin numbers leds
void bincon(int num){ //binary conversion
int count=0; //counter 1 or 0 gets put in correct place in col array
for(int i=128; >=1; i/= 2){ //for loop binary integer subtracting 128,64,32,16,8,4,2,or 1 number , seeing if above 0
num -= i;
if (num >=0){
col[count]= 1;// puts 1 in col
}
else{
num += i;
col[count]= 0;//puts 0 in col
}
count++;
}
}
void printletter(char letter){ //takes char , prints on leds
int letnum = int(letter); //converts char type integer
for(int j=0;j<5;j++){ //for loop each hex and change binary print it
bincon(letters[letnum-65][j]); // changes hex calue index binary , puts in col string/array
for (int i=0;i<8;i++){ //loop print col string/array leds
if (col==1){
digitalwrite(ledpins,high);
}
else{
digitalwrite(ledpins,low);
}
}
}
delaymicroseconds(750);
}
void setup() {
for (int thisled = 0; thisled < ledcount; thisled++) { // set pins output
pinmode(ledpins[thisled], output);
}
}
void loop() {
printletter('h');
printletter('i');
}
the first code of 'h' appears 0x7f, 01111111 according letters array.
i don't see wrong code (other slow). try putting serial.print of num @ start of bincon can verify intended values fetched.
i don't see wrong code (other slow). try putting serial.print of num @ start of bincon can verify intended values fetched.
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > POV code not working
arduino
Comments
Post a Comment