Function will not change input
hi
this code makes me insane:
when finished first loop shifting out 'sqa' doesn't throw away value of 'sqa'.
instead of sending new value of 'sqb' uddata() still uses 'sqa' output.
this gives me 3 for-loops same data-value different 'layer'-value.
anyone knows solution?
hope answer.
this code makes me insane:
code: [select]
void loop() // run on , on again
{
for(x=200; x>0; x--)
{
uddata(sqa, la0);
uddata(sqa, la1);
}
for(x=200; x>0; x--)
{
uddata(sqb, la1);
uddata(sqb, la2);
}
for(x=200; x>0; x--)
{
uddata(sqc, la2);
uddata(sqc, la3);
}
}
void uddata (unsigned int data, int layer)
{
if(data>255)
{
shiftout(datapin, clockpin, lsbfirst, data);
shiftout(datapin, clockpin, lsbfirst, (data >> 8));
}
else
{
shiftout(datapin, clockpin, lsbfirst, 0);
shiftout(datapin, clockpin, lsbfirst, data);
}
digitalwrite(latchpin, high);
digitalwrite(layer, low);
delay(1);
digitalwrite(layer, high);
} when finished first loop shifting out 'sqa' doesn't throw away value of 'sqa'.
instead of sending new value of 'sqb' uddata() still uses 'sqa' output.
this gives me 3 for-loops same data-value different 'layer'-value.
anyone knows solution?
hope answer.
where sqa, sqb, , sqc defined/set value?
please post code well.
!c
please post code well.
!c
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Function will not change input
arduino
Comments
Post a Comment