Hi guys, I'm a newbie in both this forum and electronics so please pardon me if i'm using the wrong terms and if my descriptions below is a bit off/confusing.
I'm trying to create an 180 degrees oscillating base, which once power is connected, it will continually oscillating from left to right.
I've found the pre-made part for which has a "base" with motor and two mouse switches on either side. But i have no idea how to wire it:

I think, i need a circuit, where, it will reverse the polarity of power to the motor, when the oscillating "base stick" hits the left or right most position, triggering a signal from the mouse switch.
Hope this makes sense and would appreciate any recommendations/guidances.
Many thanks.
I'm trying to create an 180 degrees oscillating base, which once power is connected, it will continually oscillating from left to right.
I've found the pre-made part for which has a "base" with motor and two mouse switches on either side. But i have no idea how to wire it:

I think, i need a circuit, where, it will reverse the polarity of power to the motor, when the oscillating "base stick" hits the left or right most position, triggering a signal from the mouse switch.
Hope this makes sense and would appreciate any recommendations/guidances.
Many thanks.