Step towards an artificial brain: An artificial synapse capable of learning autonomously