I am seeing something very strange. I am using the below code to generate a random number.
B4X:
Sub p5_StateChanged
If p5click = False Then
Log("state 5 changed")
p5click = Not(p5click)
Dim num As Long = Rnd(0, 361)
Dim deg As Int = num
Log("DEG = ", deg)
Dim steps As Int = 4096 * (deg / 360)
For i = 0 To steps
cs.stepSingle(True)
Next
stepcount = stepcount + steps
Log("Step Count = ", stepcount)
Else
p5click = False
End If
End Sub
It does not matter if I recompile the B4R code, reset the UNO, power down and up the stepper motor and reset the UNO - the "random numbers generated always follow the same pattern from a "reset" i.e
This also seems to be somewhat repetitive.....some of the random generated values are appearing very frequently when there are 360 values to choose from.