Tricky Dicky
Senior Member
I have been trying to produce a program that switches on a series of LEDs in sequence. The speed of the sequence is determined by Wait commands keeping each LED on for a set period. To vary the speed of the sequence I have used a potentiometer and Readadc the value thus obtained is used in a variable in the Wait command to produce varying delays for the LED ONs. Written in Basic in Programme Editor this produces the desired effect, but with Logicator I am getting either frenetic flashing or deadly slow and the simple maths seems completely baffling.
It seems Logicator treats standard numerical delays and variables differently. As an example, Entering 0.5 in the Wait cell produces the following line of Basic;
pause 500 'Wait command
However, when using a variable the following two lines of Basic are produced;
let w6 = varB * 1000 'convert from s to ms
pause w6 'Wait command
If an Expression cell is used to assign Variable B = 1 / 2, which would make Variable B = 0.5
the first of the above lines should produce w6 = 500 and the second line should then be the equivalent of the pause 500. When downloaded this produces a very brief flash through all the LEDs as if the conversion to ms had not occurred. Conversley if Var B is given the value 250*2 in the expression and Variable B = 500 the s to ms conversion applies and the delays are equivalent to 1 min. presumably because B = 500,000ms well in excess of the 65,000 max. Can you explain what is going on or is this a fault in Logicator.
Richard
It seems Logicator treats standard numerical delays and variables differently. As an example, Entering 0.5 in the Wait cell produces the following line of Basic;
pause 500 'Wait command
However, when using a variable the following two lines of Basic are produced;
let w6 = varB * 1000 'convert from s to ms
pause w6 'Wait command
If an Expression cell is used to assign Variable B = 1 / 2, which would make Variable B = 0.5
the first of the above lines should produce w6 = 500 and the second line should then be the equivalent of the pause 500. When downloaded this produces a very brief flash through all the LEDs as if the conversion to ms had not occurred. Conversley if Var B is given the value 250*2 in the expression and Variable B = 500 the s to ms conversion applies and the delays are equivalent to 1 min. presumably because B = 500,000ms well in excess of the 65,000 max. Can you explain what is going on or is this a fault in Logicator.
Richard