Skip to content

jrstrick/Arduino_IDE_Tool_Skeleton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Tool Skeleton


This is skeleton code for adding your own entries to the Arduino Tools dropdown, since the example code shipped with arduino 1.6.5 doesn't actually work.


##How to install the Tool_Skeleton Repository Files


First, grab the Arduino source code from their git repository. Make sure to install all the various tools you need to build Arduino 1.6.5 (or higher, unless they change stuff (again.))

Make sure you can build Arduino. If you can't, you probably won't be able to build tools for it either.

Dive into the build/shared/tools directory, and and clone this archive into a directory named Tool_Skeleton there. If you downloaded the zip archive, rename the directory Arduino_IDE_Tool_Skeleton-master to Tool_Skeleton and put it in build/shared/tools. Tool_Skeleton based tools won't build without all the Arduino stuff upstream.

When correctly installed, the directory tree should look like this:

Arduino-master/build/shared 
└── tools
    └── Tool_Skeleton
        ├── bin
        │   └── com
        │       └── tool_skeleton
        │           └── Tool_Skeleton.class
        ├── build.xml
        ├── make.sh
        ├── src
        │   └── Tool_Skeleton.java
        └── tool
            └── Tool_Skeleton.jar

Everything under bin /should/ be automatically generated by ant, but it's easier this way, and the compiled jar I've included is smaller than this document.


##How to use Tool_Skeleton


If you've written many Arduino sketches, Tool_skeleton should seem eerily familiar. Once all the declarations are done, your code actually goes in the init() method and the run() method. There's some housework to take care of before we get started.

First, rename the package It needs to be com.<your package name>. Don't take out the com. You'll mess up the paths.

Import whatever imports you need next.

Next, declare the public class.

public class <your class name> implements Tool { Editor editor;
	public void init(Editor editor) { this.editor = editor; }

Next, declare the title as it will be seen in the Tools menu:

public String getMenuTitle() 
	{ return "Your Tool's Name in the Menu"; }

Everything else goes in run(). The stuff that goes in run can be calls to the editor class or, with some tinkering and includes (make sure you modify the classpaths in build.xml), you can abuse most of the classes that are part of Arduino.


##How to build Tool_Skeleton


cd into the Tool_Skeleton directory. Build the tool with ant.

$ant

Ant should have a lot to say, and it should look something like this:

Buildfile:
<your home>/Arduino-master/build/shared/tools/Tool\_Skeleton/build.xml

compile: [javac] Compiling 1 source file to
<your home>/Arduino-master/build/shared/tools/Tool\_Skeleton/bin

build: [jar] Building jar:
<your home>/Arduin-master/build/shared/tools/Tool\_Skeleton/tool/Tool\_Skeleton.jar

BUILD SUCCESSFUL Total time: 0 seconds

##Where to put Tools


Your finished tool is in Arduino-master/build/shared/tools/Tool_Skeleton.

To install, go to your Sketchbook directory and create a directory called "tools". (or CD into if it exists)

Move the directory formerly known as Arduino-master/build/shared/tools/Tool_Skeleton into Sketchbook/tools

Like this:

sketchbook
└── tools
    └── Tool_Skeleton
        ├── bin
        │   └── com
        │       └── tool_skeleton
        │           └── Tool_Skeleton.class
        ├── build.xml
        ├── make.sh
        ├── src
        │   └── Tool_Skeleton.java
        └── tool
            └── Tool_Skeleton.jar

Could you just put the bin directory in the tools directory of sketchbook and have it work? Probably, but I haven't tried it.


##Caviats


build.xml doesn't contain much in the way of useful paths into the guts of Arduino. I'll fix that soon by backporting from the project I actually built Tool_Skeleton to understand.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages