An electric device for a bicycle, the electric device comprising: a casing having an inner space; a pedal shaft mounted through the casing and having two ends protruding out of the casing; a motor shaft mounted pivotally in the casing and mounted around the pedal shaft; a rotor assembly mounted in the casing, connected to the motor shaft, and actuating the motor shaft; a stator assembly mounted securely in the casing and corresponding to the rotor assembly; a gear assembly mounted in the casing, and connected to the pedal shaft and the motor shaft,; a chain wheel connected to the gear assembly and actuated by the gear assembly; and a control unit mounted securely in the casing and having a circuit board electrically connected to the stator assembly and having a normal parallel to the motor shaft; and a rotor detecting segment being adjacent to the rotor assembly and detecting the rotor assembly; and multiple power switch devices electrically connected to the circuit board; wherein the casing has multiple heat-dissipating fins formed on an outside surface of the casing and disposed on an outside of the power switch devices; the electric device characterized in that: the gear assembly is actuated by the pedal shaft or the motor shaft; and each of the power switch devices has a metal heat-dissipating surface abutting an inside surface of the casing; a switch body parallel to the circuit board; and multiple pins connected to the switch body and the circuit board, and bent vertically. a casing having an inner space; a pedal shaft mounted through the casing and having two ends protruding out of the casing; a motor shaft mounted pivotally in the casing and mounted around the pedal shaft; a rotor assembly mounted in the casing, connected to the motor shaft, and actuating the motor shaft; a stator assembly mounted securely in the casing and corresponding to the rotor assembly; a gear assembly mounted in the casing, and connected to the pedal shaft and the motor shaft,; a chain wheel connected to the gear assembly and actuated by the gear assembly; and a control unit mounted securely in the casing and having a circuit board electrically connected to the stator assembly and having a normal parallel to the motor shaft; and a rotor detecting segment being adjacent to the rotor assembly and detecting the rotor assembly; and multiple power switch devices electrically connected to the circuit board; a circuit board electrically connected to the stator assembly and having a normal parallel to the motor shaft; and a rotor detecting segment being adjacent to the rotor assembly and detecting the rotor assembly; and a normal parallel to the motor shaft; and a rotor detecting segment being adjacent to the rotor assembly and detecting the rotor assembly; and multiple power switch devices electrically connected to the circuit board; wherein the casing has multiple heat-dissipating fins formed on an outside surface of the casing and disposed on an outside of the power switch devices; the electric device characterized in that: the gear assembly is actuated by the pedal shaft or the motor shaft; and each of the power switch devices has a metal heat-dissipating surface abutting an inside surface of the casing; a switch body parallel to the circuit board; and multiple pins connected to the switch body and the circuit board, and bent vertically. the gear assembly is actuated by the pedal shaft or the motor shaft; and each of the power switch devices has a metal heat-dissipating surface abutting an inside surface of the casing; a switch body parallel to the circuit board; and multiple pins connected to the switch body and the circuit board, and bent vertically. a metal heat-dissipating surface abutting an inside surface of the casing; a switch body parallel to the circuit board; and multiple pins connected to the switch body and the circuit board, and bent vertically.