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

I2C Read Request behavior #11

Open cbr600fsgth opened 8 years ago

cbr600fsgth commented 8 years ago

Board:Raspberry Pi Model B OS:Raspbian Jessie

Hi, I tried reading data from ADXL345, but it's not successful. Node setting below is to read DEVICE ID from the chip and it should output "229" in decimal, "0xE5" in hex. But it outputs always 0. Could you help me out?


Debug output: 2016/3/19 23:58:14I2C Value msg.payload : array [1] [ 0 ] <- This should be "229"


Using i2ctools, it is successful.

pi@raspberrypi:~ $ i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- 53 -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- pi@raspberrypi:~ $ i2cget -y 1 0x53 0x00 b 0xe5 pi@raspberrypi:~ $


Node setting: [{"id":"d8bc70ea.27439","type":"nodebot","z":"62ce1900.9d31e8","name":"Accl","username":"","password":"","boardType":"raspi-io","serialportName":"","connectionType":"local","mqttServer":"","socketServer":"","pubTopic":"","subTopic":"","tcpHost":"","tcpPort":"","sparkId":"","sparkToken":"","beanId":"","impId":"","meshbluServer":"https://meshblu.octoblu.com","uuid":"","token":"","sendUuid":""},{"id":"dec004bf.213ff8","type":"gpio out","z":"62ce1900.9d31e8","name":"I2C Read","state":"I2C_READ_REQUEST","pin":"","i2cDelay":"0","i2cAddress":"83","i2cRegister":"0","outputs":1,"board":"d8bc70ea.27439","x":330,"y":620,"wires":[["a49144f0.5b6eb8"]]},{"id":"daafd17a.25503","type":"inject","z":"62ce1900.9d31e8","name":"1 Byte","topic":"","payload":"1","payloadType":"str","repeat":"","crontab":"","once":false,"x":130,"y":620,"wires":[["dec004bf.213ff8"]]},{"id":"a49144f0.5b6eb8","type":"debug","z":"62ce1900.9d31e8","name":"I2C Value","active":true,"console":"false","complete":"payload","x":510,"y":620,"wires":[]}]


adxl345_register