PCA9685 servo functions

#1

Hi i need help. How do i write multiple inject nodes in 1 function. I tried the arrays below but its not working. The initial flows in the picture below works.

var msg1 = { payload:900 };
var msg2 = { payload:1500 };
var msg3 = { payload:2100 };
return [ [ msg1, msg2, msg3 ] ];

Thank you

[{"id":"feaadd05.f046d","type":"inject","z":"1fe6197f.0d25c7","name":"100%","topic":"","payload":"100","payloadType":"num","repeat":"","crontab":"","once":false,"x":1045,"y":40,"wires":[["46bd9273.6b279c"]]},{"id":"71dd9036.680b3","type":"inject","z":"1fe6197f.0d25c7","name":"50%","topic":"","payload":"50","payloadType":"num","repeat":"","crontab":"","once":false,"x":1045,"y":80,"wires":[["46bd9273.6b279c"]]},{"id":"89f319a8.9eea78","type":"inject","z":"1fe6197f.0d25c7","name":"Off","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"x":1045,"y":120,"wires":[["46bd9273.6b279c"]]},{"id":"1c347df.4004b82","type":"inject","z":"1fe6197f.0d25c7","name":"120�","topic":"","payload":"2100","payloadType":"num","repeat":"","crontab":"","once":false,"x":1045,"y":180,"wires":[["d11db9bf.d2cc58"]]},{"id":"ec6ef0f2.d5b56","type":"inject","z":"1fe6197f.0d25c7","name":"60�","topic":"","payload":"1500","payloadType":"num","repeat":"","crontab":"","once":false,"x":1045,"y":220,"wires":[["d11db9bf.d2cc58"]]},{"id":"4b72d6f3.2020e8","type":"inject","z":"1fe6197f.0d25c7","name":"0�","topic":"","payload":"900","payloadType":"num","repeat":"","crontab":"","once":false,"x":1045,"y":260,"wires":[["d11db9bf.d2cc58"]]},{"id":"eaa2a00e.3dfca","type":"inject","z":"1fe6197f.0d25c7","name":"Off","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"x":1045,"y":300,"wires":[["d11db9bf.d2cc58"]]},{"id":"46bd9273.6b279c","type":"PCA9685 out","z":"1fe6197f.0d25c7","name":"PWM Output 2 (Led)","pca9685":"6ce45bce.cdff94","channel":"2","payload":"","unit":"percent","onStep":"0","x":1260,"y":80,"wires":[]},{"id":"d11db9bf.d2cc58","type":"PCA9685 out","z":"1fe6197f.0d25c7","name":"PWM Output 4 (Servo)","pca9685":"6ce45bce.cdff94","channel":"4","payload":"","unit":"microseconds","onStep":"0","x":1270,"y":240,"wires":[]},{"id":"6ce45bce.cdff94","type":"PCA9685","z":"","deviceNumber":"1","address":"64","frequency":"50"}]
0 Likes

#2

[{"id":"3e5e7537.da8ce2","type":"inject","z":"53143526.3e9914","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":109.5,"y":152,"wires":[["c4afc1aa.458788"]]},{"id":"c4afc1aa.458788","type":"function","z":"53143526.3e9914","name":"","func":"var msg1 = { payload:900 };\nvar msg2 = { payload:1500 };\nvar msg3 = { payload:2100 };\nreturn [ msg1, msg2, msg3 ] ;\n","outputs":3,"noerr":0,"x":278.5,"y":180,"wires":[["6e01a088.841fe"],["dee9e220.3305e"],["729c860e.e20a78"]]},{"id":"6e01a088.841fe","type":"debug","z":"53143526.3e9914","name":"1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":421.5,"y":121,"wires":[]},{"id":"dee9e220.3305e","type":"debug","z":"53143526.3e9914","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":428,"y":173,"wires":[]},{"id":"729c860e.e20a78","type":"debug","z":"53143526.3e9914","name":"3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":445,"y":243,"wires":[]}]

0 Likes