Hi again guys.
the following code, displays a value of the potentiometer relative to the value before, I.e it tells the the change in the potentiometer, (well its supposed to)
the probelm is sometimes it updates and i am satisfied, and other times it doesnt update satisfactorily, and i am suspicious enough of my coding to believe its not correct.
while(1)
{
// A variable to store our converted analog value in:
int pot;
// Initialize the ADC:
analog_init();
// The endless loop
for(;;)
{
// Store the value of our analog input:
pot = analog10(7);
if (pot > analog10(7))
{
number = number + (pot-analog10(7));
}
else if (pot < analog10(7))
{
number = number - (analog10(7)-pot);
}
else
{
number = number;
}
lcd_line1();
lcd_string("number");
lcd_line2();
lcd_int(number);
}
}
I want it to update so that it is very quick to tell you the value.
What i am leading to is trying to duplicate the ipods navigating songs device - not enough to suspect copyrighting breach, dont worry.
I want it to display a different number on the screen depending on where its has got to in a list.
(the numbers being the numbers on a roulette wheel - in order:
I.e
const unsigned char single_zero_wheel[37]={0,32,15,19,4,21,2,25,17,34,6,
27,13,36,11,30,8,23,10,5,24,
16,33,1,20,14,31,9,22,18,29,
7,28,12,35,3,26};
if (number = 25) /*number - the variable from code above */
{
lcd_line2();
lcd_int(char single_zero_wheel[24]);
}
then as the pot is changed, the number that appears on line 2 of the screen updates accordingly.
I’ve definately got the jist, and think i’m basically there, but dont trust my own coding!!!