I have been trying to work this exercise out for the last week and I just can't seem to grasp it so any help would be much appreciated. Its a simple one, I need to use a number generator that displays a current value and also display the last 4 values to then get the average of those readings. Need to use shift registers to achieve this
Solved! Go to Solution.
Hi Cabaiste, what have you tried so far?
Can this give you any ideas?
This is where I am at with it, I think it's probably a mess and I think the array is just generating random numbers rather than saving the last 4 numbers of the current value if that makes sense.
I tried starting with a while loop because i just wanted it to run continuously but I just couldn't wire it, kept getting errors so I just ended up with that monstrosity. Yours has given me ideas, I assume that the shift register will register a value every time it loops and if i have 4 elements it should record 4 values?
Thank you so much, its working! Currently where I am at with it and the values actually move from R1.. R2.. R3..R4. Still a little bit more to do but you've been a massive help!
Your code should be able to handle a change in requirements. What if the assignment changed from four numbers to four hundred?