-
Notifications
You must be signed in to change notification settings - Fork 0
/
howto.txt
124 lines (93 loc) · 4.26 KB
/
howto.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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 drop the entire Tool_Skeleton folder
from my git repository in there. It 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
├── howto.txt
├── 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 howto.
------------------------------------------------------------------------------------
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
The Tool_Skeleton folder should contain:
├── bin
│ └── com
│ └── tool_skeleton
│ └── Tool_Skeleton.class
├── build.xml
├── make.sh
├── src
│ └── Tool_Skeleton.java
└── tool
└── Tool_Skeleton.jar
-------------------------------------------------------------------------------------
Caviats:
I'm pretty sure make.sh doesn't work. I will probably remove it down the road.
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.
-------------------------------------------------------------------------------------
James R. Strickland for the Tool_Skeleton project in 27 August, 2015
Tool_Skeleton is based on Mangle by Ben Fry and Casey Reas, which is still included in
Arduino 1.6.5 even though it no longer builds.