No problem, thank you for the help so far anyway!
The values in arrayu are just the values for a square wave between 1 and 1024:
int arrayu[512] = {1024, 1024, 1023, 1024, 1024, 1023, 1024, 1024, 1023, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1023, 1024, 1024, 1023, 1024, 1023, 1024, 1024, 1024, 1024, 1024, 1024, 1023, 1024, 1024, 1024, 1023, 1024, 1024, 1024, 1024, 1024, 1023, 1024, 1024, 1024, 1023, 1024, 1024, 1024, 1024, 1023, 1024, 1023, 1023, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1023, 1023, 1024, 1024, 1024, 1023, 1024, 1024, 1023, 1024, 1024, 1024, 1024, 1023, 1024, 1024, 1024, 1024, 1024, 1023, 1024, 1023, 1024, 1024, 1023, 1023, 1024, 1024, 1024, 1024, 1024, 1023, 1024, 1024, 1023, 1024, 1024, 1023, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1023, 1024, 1024, 1023, 1024, 1024, 1024, 1024, 1023, 1024, 1023, 1023, 1024, 1024, 1024, 1024, 1024, 1023, 1024, 1023, 1023, 1024, 1023, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1023, 1023, 1024, 1024, 1023, 1023, 1024, 1024, 1024, 1023, 1024, 1024, 1023, 1023, 1023, 1023, 1024, 1024, 1024, 1024, 1023, 1024, 1024, 1024, 1024, 1024, 1023, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1023, 1023, 1023, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1023, 1024, 1024, 1024, 1023, 1024, 1024, 1024, 1023, 1024, 1023, 1024, 1023, 1024, 1024, 1024, 1024, 1023, 1023, 1024, 1024, 1023, 1024, 1024, 1023, 1024, 1024, 1023, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1023, 1023, 1024, 1024, 1024, 1024, 1023, 1024, 1023, 1024, 1024, 1024, 1024, 1024, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
I created them on matlab, hence why a few are 1023 instead but thats not a problem.
So sorry to be a pain but would you be able to write me the final piece of code that would be required, all relating v0, v1, r and c?
Thanks a bunch!