be80be
Well-Known Member
What I'm trying to do is save two voltage values the first being the highest
and the second the lower seeing ADC is bigger then 8 bits I get a error saying out of bounds when I try it like this
and the second the lower seeing ADC is bigger then 8 bits I get a error saying out of bounds when I try it like this
Code:
Dim highvolts As Word
Dim lowvolts As Word
Dim Counter As Word
Dim hold(2) As Word
Counter = 0
For Counter = 0 To 1 // loop 2 times
While Get_ADC_Sample > 0 // get sample
Wend
hold(Counter) = Get_ADC_Sample // put in hold(1)
DelayMS(20) // small delay
Next
highvolts = hold(1) [COLOR="Red"]//I get a Constant expression [/COLOR]
lowvolts = hold(2) [COLOR="Red"]//violates subrange bounds here [/COLOR]