A perpetual motion machine, will have to day away with friction / heat means an absolute perfect application of first law of motion.
Though this question pertains less to micro-controllers and more to mechanics, but every mechanical motion produces friction/heat (roll a ball on a road, why it sops eventually) answer friction, why an electric motor stops once electricity is cut off answer two reason friction / Heat.
If somehow we could develop a technique which could overcome these a perpetual motion machine could be a reality, otherwise a mechanical device could continue its motion for comparatively longer time provided highest quality material (ball bearings/etc are used) and eventually it will have to stop.