This sketch counts the number of poles on your hub motor so you can then enter the correct value in your VESC software.
Please note you need to open serial monitor, set it to 115200 baud (then I suggest reboot your arduino). Connect red to 3.3v on arduino, black to gnd, and the hall wire to D2, D3 and D4 Rotate your wheen ONCE (put a sticker so you know you've gone back to the same starting position) then in the serial monitor type in an S and hit return to give you the results.