1

We are trying to make an app that generates an Arduino sketch (.ino) using Google's Blockly and node.js, and uploads it to Arduino.

Even after searching a lot, I am unable to find how to build and upload the generated code to the board. Is there any tool or API available for node.js to do the same?

Or could I call some binary for this function. Please help.

dda
1,5951 gold badge12 silver badges17 bronze badges
asked Jan 13, 2017 at 5:03
3
  • 1
    The tool for uploading to an Arduino is "avrdude", it's a command line application that Arduino uses in the background. I'm quote dure you can invoke/run it from nodejs Commented Jan 13, 2017 at 6:00
  • 1
    There is also arduino-builder.exe command line tool in Arduino IDE (since 1.6.6) so you can build and upload sketch programmatically. Commented Jan 13, 2017 at 8:00
  • 1
    Or you can install Sudar Muthu's Arduino Makefile (package arduino-mk on Debian-bases OSes), then just require("child_process").exec("make upload", callback);. Commented Jan 13, 2017 at 8:37

1 Answer 1

1

There are two things you need to do:

  1. Compile the sketch into a .HEX file
  2. Upload the sketch to the board

The first part can be done with arduino-builder which is part of the IDE since 1.6.6, or you can use one of various Makefile projects on a platform that supports make, or you can manually script it yourself calling the correct avr-gcc and avr-g++ commands. You can check the output of the IDE for what those are.

The second part is done, usually, using avrdude - again see the output of the IDE for the correct command format.

answered Jan 13, 2017 at 10:34
1
  • Thanks a lot.. Also can I package only the required files/folders from the Arduino IDE into my software (without any license issues)? Commented Jan 16, 2017 at 5:26

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.