octoblu / microblu_mqtt

Microblu OS (firmware for Arduino-compatible devices) using MQTT
GNU Lesser General Public License v2.1
50 stars 21 forks source link

Can't control arduino via nodeblu #7

Open mcinnes01 opened 9 years ago

mcinnes01 commented 9 years ago

Hi,

I have flashed microblu on to an arduino nano with a w5100 ethernet shield connected. I used the curl command as follows and included this guid and token in the code I flashed the arduino nano with and the same code in nodeblu to connect to the nano:

curl -X POST -d "type=firmwareController&payloadOnly=true&name=Arduino" http://skynet.im/devices

I then hooked up an led to d7, and used "1" and "0" from an inject node to the arduino output node to try to control the led, as below:

[{"id":"a97a2dcc.5685d","type":"skynet-device","uuid":"{UUID FROM CURL}","token":"{TOKEN FROM CURL}","name":"","dne":""},{"id":"4a58c085.b5a74","type":"arduino out","name":"LED","remote":true,"pin":"7","state":"OUTPUT","arduino":"","skynetFirmware":"a97a2dcc.5685d","x":503,"y":306,"z":"e0e74ed1.1f18b","wires":[]}]

Do you have any tips as how I might be able to get this work?

Many thanks

Andy

chrismatthieu commented 9 years ago

Try sending the 0/1 payloads through Nodeblu (https://chrome.google.com/webstore/detail/nodeblu/aanmmiaepnlibdlobmbhmfemjioahilm). I believe that we perform some firmata encoding before sending the command to Microblu. /cc @monteslu @jacobrosenthal @iamruinous @redaphid @royvandewater @kmariano

mcinnes01 commented 9 years ago

Hi @chrismatthieu I have just started testing with Octoblu to help me understand how everything is working before I try to hook things up differently. I've got my arduino nano connected :) but I am struggling to get the LED on pin 7 to turn on. When I click the trigger button in Octoblu I can see activity on the arduino but I am obviously not formating my command correctly.

In octoblu I have added my device and set pin 7 as a digital output. I then linked 2 trigger buttons up and have left the topic blank and then in the payload set 1 and 0 respectively for on an off.

As an additional test I added another arduino node to my octoblu design this time as a digital input on pin 9. As I toggle high and low I can this in the debug window in octoblu.

Do I need to format my load differently, perhaps in some firmata syntax and what is the arduino node expecting to recieve to control digital output pin 7?

Many thanks

Andy

PS Octoblu is looking awesome you guys must have been very busy looking at all the devices available in the library already :+1:

chrismatthieu commented 9 years ago

Hi Andy,

Thanks for the feedback :)

The microblu_mqtt readme (https://github.com/octoblu/microblu_mqtt) references the following unavailable pins:

7, 10, 11, 12, 13 If the SD card is in use Pin 4 will also be unavailable.

All other pins should be fair game. You should also make sure that your device has the following property added it's profile:

payloadOnly=true

i.e.

curl -X POST -d "type=firmwareController&payloadOnly=true&name=Arduino" http://skynet.im/devices

Hope this helps...