11-10-2022 04:02 PM - edited 11-10-2022 04:23 PM
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.
11-10-2022 04:23 PM
Hi Cabaiste, what have you tried so far?
Can this give you any ideas?
11-10-2022 04:46 PM - edited 11-10-2022 04:48 PM
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.
11-10-2022 05:13 PM
11-10-2022 05:24 PM
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?
11-10-2022 05:30 PM
11-10-2022 05:42 PM
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!
11-11-2022 06:18 AM
Your code should be able to handle a change in requirements. What if the assignment changed from four numbers to four hundred?