Java Magazine, September/October 2016
ORACLE COM JAVAMAGAZINE SEPTEMBER OCTOBER 2016 30 internet of things ends the program M30 I also need to support multiple passes through the material because acrylic is too hard to cut in one pass For a 1 8 inch thick piece of acrylic I recommend seven passes each incrementally deeper The following code calls the drawStar function multiple times to accomplish that sendSequenceAndWait START_ SPINDLE moveToStart 50 100 for int i 1 i Z_ STEPS i double newZ MATERIAL_ THICKNESS Z_ STEPS i Z_ STEPS sendCommandAndWait G1Z String format 3f newZ F355600 sendCommandAndWait F1117600 sendSequenceAndWait drawStar 9 50 90 100 sendSequenceAndWait END_ SEQUENCE This code makes use of a new argument F to G1 It is the feed rate You can also call this code by itself to set the feed rate for subsequent linear operations Finally there are two parameters the MATERIAL_ THICKNESS and number of Z_ STEPS that you can set based on the material you are using static final int Z_ STEPS 7 static final double MATERIAL_ THICKNESS 254 1 8 Just to make sure the program is working correctly you might want to perform a first run with no material inside the machine If anything unexpected happens killing the Java program or pressing the power switch on the Nomad 883 Pro will immediately stop the operation Once you are confident that you have a working application load a piece of acrylic plastic into your Nomad 883 Pro and run the program again The router should slowly cut the acrylic layer by layer until it gets just above the routers wasteboard Upon completion vacuum up the plastic scraps and carefully remove the finished piece from the tray You should have a perfectly cut star similar to the one shown in Figure 2 Running the Code on the Raspberry Pi Running the code on the Raspberry Pi is the easiest part of the process described in this article Java 8 comes bundled with the standard Raspbian Linux distribution so if you have an up to date installation you already have Java ready to go And if you are using NetBeans there is built in support for running the code on the Raspberry Pi using the Remote Java Platform functionality To set up your Raspberry Pi in NetBeans for the first time 1 In the Tools menu choose Java Platforms 2 Click Add Platform and select Remote Java Standard Edition Figure 2 An acrylic star cut using the presented code
You must have JavaScript enabled to view digital editions.