Lists (arrays, vectors, whatever you call them) are statically sized in UR. You have to predefine the size of array that you want to use before you can use it. Then you cannot dynamically change the size of the list while in operation and lists can only be around 250 elements long before there starts to be issues.
myList = [1,2,3,4,5,6,7.....n] #You have to actually predefine this, it does not care what the values are just so long as there are values
i = 0 #counter for our while loop
while i<length(myList):
myList[i] = analog_in(0)
i=i+1
sleep(0.5)
end
Hi There!
I try to create a thread with UR script language for saving analog_in values (from a sensor) every 0.5 seconds. The values shall all be saved in a vector / table / string ... something similar for processing them afterwards.
My progress so far is as follows:
thread myThread():
i = 1
z = [] #vector or similar
while True:
z[i] = analog_in(0)
i = i+1
sleep(0.5)
end
end
Do you know how to solve this Problem?
Thanks a lot for your help!
Best Regards
Sascha