Rotating something in 3D

I have a frame animation of an object spinning. I would like to control is spinning left or right either by the user’s mousemovement or a left and right arrow below. Can anyone point me in the right direction to find some code to do this. I have tried searching but as usual I can’t get the right keywords in.

Thanks…