a method and device for control of a low - cost dc motor such as that suitable for portable or battery - powered applications are disclosed such that an intended behavior for the motor may be programmed without reliance on external equipment or specific expertise . the invention enables programming of a motor controlling device by means of physical manipulation of the motor . in other words , the invention allows for the training of a motor by demonstrating the intended behavior for the motor . the invention specifies a method of parsing an observation of the motor system into storable commands , while preserving information on motor response and conditions for execution . a motor controller device comprising an implementation of this method is also presented .