As hek says, read the API documentation. "Waiting using the Arduino delay() command is not a good idea. It halts all MySensors processing and should be avoided. Instead you should use the provided wait function which calls process() while waiting." Exchange delay with gw.wait and you should be fine