monteslu / node-red-contrib-gpio

A set of node-red nodes for connecting to johnny-five IO Plugins
MIT License
41 stars 31 forks source link

Arduino - TypeError: Cannot set property 'mode' of undefined #6

Open DarekLin opened 9 years ago

DarekLin commented 9 years ago

Hello, I would like to run communication with Arduino Uno via hosted node-red on beaglebone black and base on node-red-contrib-gpio but i can't. When I try to send "1" to 13 pin I received:

root@beaglebone:~# node-red-pi

Welcome to Node-RED

7 Oct 21:56:53 - [info] Node-RED version: v0.11.2 7 Oct 21:56:53 - [info] Node.js version: v0.10.38 7 Oct 21:56:53 - [info] Loading palette nodes 7 Oct 21:57:05 - [warn] ------------------------------------------ 7 Oct 21:57:05 - [warn] Failed to register 1 node type 7 Oct 21:57:05 - [warn] Run with -v for details 7 Oct 21:57:05 - [warn] ------------------------------------------ 7 Oct 21:57:05 - [info] Settings file : /usr/local/lib/node_modules/node-red/settings.js 7 Oct 21:57:05 - [info] User directory : /root/.node-red 7 Oct 21:57:05 - [info] Flows file : /root/.node-red/flows_beaglebone.json 7 Oct 21:57:05 - [info] Server now running at http://127.0.0.1:1880/ 7 Oct 21:57:05 - [info] Creating new flow file 7 Oct 21:57:05 - [info] Starting flows 7 Oct 21:57:05 - [info] Started flows 7 Oct 21:58:30 - [info] Stopping flows 7 Oct 21:58:30 - [info] Stopped flows 7 Oct 21:58:30 - [info] Starting flows 7 Oct 21:58:30 - [info] Started flows [TypeError: Cannot set property 'mode' of undefined] 7 Oct 21:58:39 - [warn] [gpio out:ab8e80ad.e6dd6] TypeError: Cannot set property 'value' of undefined [TypeError: Cannot set property 'mode' of undefined] 7 Oct 21:58:46 - [warn] [gpio out:ab8e80ad.e6dd6] TypeError: Cannot set property 'value' of undefined [TypeError: Cannot set property 'mode' of undefined] 7 Oct 21:58:50 - [warn] [gpio out:ab8e80ad.e6dd6] TypeError: Cannot set property 'value' of undefined ^C7 Oct 22:02:12 - [info] Stopping flows

[{"id":"6e07a27.21db85c","type":"nodebot","name":"","username":"","password":"","boardType":"firmata","serialportName":"/dev/ttyACM0","connectionType":"local","mqttServer":"","pubTopic":"","subTopic":"","tcpHost":"","tcpPort":"","sparkId":"","sparkToken":"","beanId":"","impId":""},{"id":"80727098.01cab8","type":"inject","name":"","topic":"","payload":"1","payloadType":"string","repeat":"","crontab":"","once":false,"x":127.08332824707031,"y":128.0833282470703,"z":"cfe76e5b.795f88","wires":[["ab8e80ad.e6dd6"]]},{"id":"ab8e80ad.e6dd6","type":"gpio out","name":"","state":"OUTPUT","pin":"","i2cDelay":"0","i2cAddress":"","i2cRegister":"","outputs":0,"board":"6e07a27.21db85c","x":335.0833282470703,"y":138.0833282470703,"z":"cfe76e5b.795f88","wires":[]}]

On the arduino I have install standardFirmata. On the node-red the gpio module flash green so coonection to serial seems to be ok. Could you help me?

DarekLin commented 9 years ago

Sorry my mistake. I didn't assigned pin (;

nkolban commented 8 years ago

I seem to be getting the same issue but in my case, I have defined a Pin. I am using CHIP as my board ... here is my current flow:

[{"id":"1ce0da90.705275","type":"gpio out","z":"93e6f36a.1d1aa","name":"","state":"OUTPUT","pin":"\"XIO-P0\"","i2cDelay":"0","i2cAddress":"","i2cRegister":"","outputs":0,"board":"e735b9b7.bd9d68","x":396,"y":196,"wires":[]},{"id":"e735b9b7.bd9d68","type":"nodebot","z":"93e6f36a.1d1aa","name":"","username":"","password":"","boardType":"chip-io","serialportName":"","connectionType":"local","mqttServer":"","socketServer":"","pubTopic":"","subTopic":"","tcpHost":"","tcpPort":"","sparkId":"","sparkToken":"","beanId":"","impId":"","meshbluServer":"https://meshblu.octoblu.com","uuid":"","token":"","sendUuid":""}]

and here is the log from Node.RED:

7 Aug 00:21:42 - [info] Starting flows
1470547302354 Device(s) C.H.I.P.  
7 Aug 00:21:42 - [info] Started flows
1470547302379 Connected C.H.I.P.  
[TypeError: Cannot read property 'number' of undefined]
7 Aug 00:21:47 - [warn] [gpio out:1ce0da90.705275] TypeError: Cannot read property 'number' of undefined
nkolban commented 8 years ago

Aha!!! Solved the problem by running the node.js debugger and stepping through. I had coded:

"XIO-P0"

as my pin name when what I should have coded was:

XIO-P0

i.e. no quotes. Changed in my flow and all is now well.