Create 1.Digit recognizer with neural network

This is my first code with Neural network on R. 
With hidden = 10 and act.fct = "tanh"