I know that it is very simply way to receive data, but i use my scatch who is very similar, (the same idea), but ii doesn't work on esp8266-E12... When i use it on arduino uno, the same code is working good...
I don't know where is the problem, because, when i use esp8266 to send by TX then it is ok.. but when i would like to receive data via RX pin ( number pin - 21 ) - it doesn't work...