Counter problem

I am having issues setting up a sequence and would appreciate some help.
I have a hue dimmer and would like to achieve the following:

first press - turn light on 5%
second press - 25%
third press - 45%
fourth press - 65%
fifth press - back to 5%

Then loop through the same percentages with each press: 5,25,45,65,5,25,45,65 etc.....

[{"id":"977bd2ef.a55","type":"function","z":"c560b506.abe4d8","name":"","func":"\nif (msg.count === 1) {\n    return{\n        payload: {\n            \"on\": \"true\",\n            \"brightness\": 5\n        }\n    };\n}\nelse if (msg.count === 2) {\n    return{\n        payload: {\n            \"on\": \"true\",\n            \"brightness\": 25\n        }\n    };\n}\nelse if (msg.count === 3) {\n    return{\n        payload: {\n            \"on\": \"true\",\n            \"brightness\": 45\n        }\n    };\n}\nelse if (msg.count === 4) {\n    return{\n        payload: {\n            \"on\": \"true\",\n            \"brightness\": 65\n        }\n    };\n}\nelse if (msg.count === 5) {\n    return [ null, msg ];\n}","outputs":2,"noerr":0,"x":770,"y":500,"wires":[["c616a5f1.4cb638","956fddf.ee8872"],["666c319c.573ca","2838a1c3.11b71e"]]},{"id":"c616a5f1.4cb638","type":"hue-light","z":"c560b506.abe4d8","name":"desk lamp","bridge":"8c5e7db8.8c1fd","lightid":"8","colornamer":true,"skipevents":false,"x":1010,"y":480,"wires":[["4f3a3441.a33abc"]]},{"id":"956fddf.ee8872","type":"debug","z":"c560b506.abe4d8","name":"1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":990,"y":420,"wires":[]},{"id":"aefb6e90.bdb25","type":"inject","z":"c560b506.abe4d8","name":"reset","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":510,"y":600,"wires":[["2838a1c3.11b71e"]]},{"id":"e456a128.e2117","type":"counter","z":"c560b506.abe4d8","name":"","init":"0","step":1,"lower":"","upper":"","mode":"increment","outputs":1,"x":620,"y":500,"wires":[["977bd2ef.a55"]]},{"id":"3eb509df.7c9f26","type":"inject","z":"c560b506.abe4d8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":440,"y":500,"wires":[["e456a128.e2117"]]},{"id":"666c319c.573ca","type":"debug","z":"c560b506.abe4d8","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":970,"y":560,"wires":[]},{"id":"5315be88.f89dc","type":"inject","z":"c560b506.abe4d8","name":"off","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":650,"y":420,"wires":[["d3369016.bd819"]]},{"id":"d3369016.bd819","type":"change","z":"c560b506.abe4d8","name":"off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"on\":false}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":420,"wires":[["c616a5f1.4cb638"]]},{"id":"2838a1c3.11b71e","type":"change","z":"c560b506.abe4d8","name":"","rules":[{"t":"set","p":"payload.brightness","pt":"msg","to":"5","tot":"str"},{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":600,"wires":[["e456a128.e2117","c616a5f1.4cb638","9aad63b.f35b9a"]]},{"id":"9aad63b.f35b9a","type":"debug","z":"c560b506.abe4d8","name":"rules","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":970,"y":620,"wires":[]},{"id":"4f3a3441.a33abc","type":"debug","z":"c560b506.abe4d8","name":"lamp","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1190,"y":480,"wires":[]},{"id":"8c5e7db8.8c1fd","type":"hue-bridge","z":"","name":"Philips hue","bridge":"192.168.1.120","key":"XtlsvGPtH9Z9O41tqByhqviDaR1yArK8OHhLLpVL","interval":"3000","disableupdates":false}]

With the code above, I get the following:

first press - turn light on 5%
second press - 25%
third press - 45%
fourth press - 65%
fifth press - NOTHING
sixth press - back to 5%

then it loops as desired apart from the nothing every fifth press.

Thanks in advacne.

I haven't loaded your flow as it contains a number of nodes which I don't have installed, but I think I get what you are trying to achieve.
Shouldn't it return to zero after 65, otherwise it will be permanently on? ie 5,25,45,65,0,5,25,45,65 etc.
If written a quick bit of code which achieves that, if you want to check it out;

[{"id":"bb5394c7.fb1a88","type":"inject","z":"c53060.842a0fa","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":860,"wires":[["91417629.04ebe8"]]},{"id":"91417629.04ebe8","type":"function","z":"c53060.842a0fa","name":"Steps","func":"let savedState = flow.get(\"savedState\") || 0;\nvar incState;\nif (savedState===0){incState=5}\nelse if(savedState===5){incState=25;}\nelse if(savedState===25){incState=45;}\nelse if(savedState===45){incState=65;}\nelse if(savedState==65){incState=0;}\nflow.set(\"savedState\",incState);\nmsg.payload = incState;\nreturn msg;","outputs":1,"noerr":0,"x":240,"y":860,"wires":[["bd4b6011.5f3a3"]]},{"id":"bd4b6011.5f3a3","type":"debug","z":"c53060.842a0fa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":390,"y":860,"wires":[]}]

If you set up local file system context storage, my example will save it's current state, and safely resume the increment after a reboot etc.

In your function node you have 2 outputs, but your function only outputs to the first, unless the counter is 5 ? I am not sure I follow, but try this flow:

[{"id":"93a1ff2d.dc4df8","type":"inject","z":"7ac1830a.bd0024","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":480,"wires":[["9e02408a.2884d8"]]},{"id":"9857e888.68349","type":"function","z":"7ac1830a.bd0024","name":"","func":"let c = msg.counter\nlet b\n\nswitch(c) {\n  case 1:\n    b = 5\n    break;\n  case 2:\n    b = 25\n    break;\n  case 3:\n    b = 45\n    break;\n  case 4: \n    b = 65\n    break\n  case 5:\n    b = 5\n    break;\n  default:\n    b = 0\n    break;\n}\n\nreturn {\n    payload:{\n        \"on\":true,\n        \"brightness\":b\n    }\n}\n\n","outputs":1,"noerr":0,"x":626,"y":480,"wires":[["b59ff975.8b01a8"]]},{"id":"b59ff975.8b01a8","type":"debug","z":"7ac1830a.bd0024","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":766,"y":480,"wires":[]},{"id":"9e02408a.2884d8","type":"function","z":"7ac1830a.bd0024","name":"","func":"for(x=1;x<6;x++){\n node.send({counter:x})   \n}\n","outputs":1,"noerr":0,"x":314,"y":480,"wires":[["f915cb7e.c7d328"]]},{"id":"f915cb7e.c7d328","type":"delay","z":"7ac1830a.bd0024","name":"","pauseType":"rate","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":454,"y":480,"wires":[["9857e888.68349"]]}]

The 2nd function node handles the counter.