This is no different than controlling a brushless DC motor open loop. Actually, this is a brushless DC motor.
I would not use a single electromagnet. With a single pair of poles, you can only make the field flip, not actually spin at some controlled rate. Or put another way, you can make the field rotate at any frequency you want, but it won't rotate smoothly. It will always jump 180° at a time and the torque goes to 0 twice per cycle.
The minimum to make a rotating field requires 3 poles, which is why so many motors have 3 wires going to the field windings. The three windings would be arranged in a even "Y" layout. You can connect the inside ends of each of the coils together and control everything from the 3 remaining outside connections. Each of these 3 lines is then connected to a half bridge, meaning a high side and a low side switch that can be controlled independently.
Since the rotation speed is going to be very slow compared to the speed of a microcontroller, you have the micro step thru all the phases of a rotation sequentially. The easiest is a 12 step process. Each line is driven with a OPEN - HIGH - OPEN - LOW repeating sequence. Draw it out on paper and you can see how you make one change to one line each step, which eventually walks the magnetic field thru steps of about 30° each. One advantage of this 12 step scheme is that it naturally does break before make. There are other scheme that can deliver more power thru the same set of windings, but the 12 step scheme is very easy to implement and more forgiving of screwups, making it all around better for beginners.