About This is Dexter Development Environment
version: 2.0.18
released: Aug 17, 2017

DDE helps you create, debug, and send software to a Dexter robot. You can use any JavaScript augmented with DDE-specific functions to help find out about, and manipulate, a robot.
Videos on Dexter

Why Use DDE? Dexter has a limitless variety of capabilities. We couldn't think of them all let alone program them. And if we could, finding the right button for each program would be extremely difficult, besides overfilling screen real estate.

By providing a general purpose language that is broad enough to cover all the bases, yet detailed enough to specify the action details, users can specify the precise behavior they desire. We've extended JavaScript, most common web page programming language, with dexter-specific functions like "move" and ways to gets values from its sensors (like camera"). This allows you to specify things like: If part X is in the workspace, then move it 10 millimeters to its left.

You need a general purpose language to customize that "10" with any computable number in a myriad of ways. We may want to create actions that depend on conditions that differ with the environment, time, or materials. Instead of move, we might want to rotate, or grasp, or drill, etc.
Won't a Text Editor Do? You could use any old text editor to write code. But you'd need to know:
  1. What capabilities are available?
  2. What do they actually do? (semantic details)
  3. How do I use them? (syntactic details)
  4. How do I run the code?
  5. How do I localize bugs?
  6. How do I understand and fix them?
  7. How do I store and re-run programs I've created?
  8. How do I change and extend existing code?
DDE helps you with all of the above.
Prerequisites You'll need a Dexter robot and a basic knowledge of JavaScript to make full use of DDE. DDE provides a lot of help for learning JavaScript directly and the Learning JavaScript section of this documentation gives you a number of very good on-line sources to smooth your path. Without a robot, you can still use DDE to simulate one.
Installation
First Install To get the latest DDE release,
Updating to the latest DDE Follow the directions under First Install above. This will not change any files in your Documents/dde_apps folder.

Twist down the About row in the Doc pane to see the installed version number of DDE.

Launch DDE On Windows, the DDE application is installed in C:\Program Files\dexter_dev_env\dexter_dev_env.exe and on the desktop.
On Mac, Macintosh HD/Applications/dever_dev_env.app

Double click on the file to launch DDE. If there is a file Documents/dde_apps/dde_init.js, it will be loaded automatically. Thus you can put any code in that file that you want to be evaled at start-up, such as libraries you've written, etc.

Configure DDE DDE requires that you create a folder under your Documents folder named dde_apps. If this does not exist when you launch DDE, you'll see a warning in the output pane.

DDE requires that you have a default robot named "dexter0". Usually the one that is automatically inserted into the file dde_apps/dde_init.js is fine. However, in that file you may need to modify the ip_address and port number of Dexter. The default ip_address is "192.168.1.142" The port number is typically "50000".

Configure Dexter
Key Parts Dexter has 5 joints and 5 links between them. The two longest links are each about 32 centimeters long and made of square carbon fiber tubes. The tube closest to Dexter's base is LINK2.

Mounted on it is the motor controller printed circuit board, 17cm x 6 cm. Mounted on top of it is the processor board, 10cm x 6cm. Mounted on the bottom of the processor board is a metal housing containing an Ethernet socket for an RJ45 connector. The lower portion of the housing for the RJ45 contains a USB socket. To the left of the housing hanging over the bottom of the processor board is a micro USB socket. Underneath this housing on the motor controller board is a green-yellow LED. This is the "power" LED. It is fairly hidden, but you can see it between the boards if you look carefully.

Power Up When Dexter is off and disconnected from the power, you can move each joint manually with just a little resistence from Dexter. When transporting Dexter you should move the joints to fold it up into a compact configuration.

Moving a joint will cause a corresponding drive belt to move. You'll hear a "whirring" sound from the transmission. You should also see the power light to go on. Dexter's motors act as generators and will generate electricity which powers the power LED. Seeing the light go on when you move a joint is a diagnostic that the wiring is, at least partially, correct.

Dexter does not have an on-off switch. You just plug it into its power adapter and the wall to turn it on. The power adapter that comes with Dexter is a fairly common "power brick" or "wall wart" used on many PC laptops. It is about 3 meters long. The wall end is a 2 prong, unpolarized connector, common for USA appliances. Electrically, it accepts input of 100 to 240 volts, 50 to 60 Hz AC, which is supplied throughout the world. However, mechanical connections vary from country to country. Adapter plugs that accept the USA 2 prong plugs are commonly available.

The Dexter end of the power adapter is a male cylinder 5mm in outer diameter, common on older PC laptops. The Power Adapter consumes 1.5 Amps and outputs 3.15 Amps at 19 volts. If you lose it, many PC laptop power adapters will work.

Before turning on Dexter, move its joints so that its standing straight up. With the power board facing you, the final link should be horizontal pointing to the left. Dexter's power socket is connected by 2 short wires to Dexter's base. You turn on Dexter by plugging in the the power adapter to Dexter and the wall. If the wall has power, an LED on the power adapter will go on.

When Dexter is turned on, after about 8 seconds, it does a 5 second or so little "dance" moving each of its joints.

The processor board has 3 bright LEDs.

The base of the motor controller board has 3 green-yellow LEDs on one side and 2 on the other. Each indicates that a joint has power.
Data Connection The primary interface between the computer running DDE and Dexter is WiFi. Dexter ships with a USB WiFi "nub", a tiny device ethat plugs into a USB port. We recommend USB 3.0. USB2.0 will work but is slower. You will need to be in a strong WiFi area for best results.

ping
Dexter is shipped with an ip_address of "192.168.1.142" You can use a low level tool called "command prompt" or "terminal" to verify connectivity. Windows and Mac OS's do an excellent job at hiding these useful tools.
On Windows 7,
Start/All Programs/Accessories/Command Prompt.
On MacOS: try
Favorites/Applications/Utilities/terminal.app.
Enter ping 192.168.1.142

If you have connectivity you should see something like the cryptic:
Reply from 192.168.1.142 bytes=32 time 1ms
several times. Without connectivity you'll see something like:
Destination host unreachable or
Request timeout or
Host is down several times.

Ethernet Cable
If WiFi doesn't work for you, use an Ethernet cable (with RJ45 male connectors) to go between Dexter and your computer. Available at Staples, Home Depot, Best Buy, Amazon, etc. Ethernet cables come in different "Categories". Get "Cat 5e". The Ethernet socket on Dexter is on the bottom of the processor board with the socket facing down. Most modern laptop computers lack an Ethernet socket but there are USB 3.0 to Ethernet RJ45 adaptors for about $15 here. Get one that purports to work with your OS, as there are some incompatibilities. Beware that for some adaptors for some OS's you need to install a software driver, typically downloadable for free from the USB to Ethernet adaptor's website. (Necessary for Macs at least.)

Instead of getting a USB to Ethernet adaptor, you can use a USB cable that has a male micro USB and a regular (larger) USB male. The micro USB male plugs into the micro USB socket on Dexter's processor board. See the Key Parts section above for how to find the micro USB socket.

The software setup for such direct-wire connectivity is a bit tricky. First, make sure your cable is plugged into and firmly seating in both your computer and Dexter.
On Windows 7:

  1. Go to Start/Control Panel
  2. Click on: "Network and Sharing Center"
  3. In the left column, click on "Change adapter settings".
  4. In the new dialog, click right on "Local Area Connection" and
  5. Choose "Properties".
  6. In the new dialog, in "Network" tab, click on "Internet Protocol Version 4" to select it.
  7. Click on the "Properties" button. This presents yet another dialog box.
  8. Select "Use the following IP address"
  9. Enter ip address: 192.168.1.50
  10. The Subnet mask should be:
    255 255 255 0
  11. Leave the "Default gateway blank.
  12. Click the OK button and close the remaining dialogs.
On MacOS its even harder.
  1. Disconnect your WiFi (sorry, its necessary) by clicking on the "Radio waves" icon in the upper right of the screen. Choose "Turn WiFi Off".
  2. Select Apple Menu/System Preferences
  3. If your OS version is Sierra, a mostly useless dialog will come up. You have to click the left arrow in the upper left of this dialog to get the useful System Preferences with lots of choices.
  4. Click the "Network" icon to get another dialog box.
  5. Running down the left side of this dialog is an unlabeled column of all the possible connections. Apple cleverly made this column too narrow to be useful, so hover your mouse over each items to be able to read one in full. You're looking for a USB to Ethernet connection. For example, the UGreen adaptor helpfully says "AX881" until you hover the mouse over it to see its full name ending in "USB 3.0 to Gigabit Ethernet". Click on the appropriate connection.
  6. Clicking on the connection changes the inputs to the right.
    For the Configure IPV4 field, choose Manually
    For the IP Address field, type in the IP address to give your Mac, typically 192.168.1.200 works, but definately not the IP address of Dexter.
    For the Subnet Mask field, type in 255.255.255.1
    For the Router field, leave it blank.
  7. Click the "Apply" button.
We are working on making this easier.
Test Connectivity You should now be able to ping Dexter and have connectivity.
(See above on how to "ping".)
Troubleshooting
Ping doesn't find the host? Try reseating all the cables. Try power cycling Dexter and/or your computer.
If you are using an Ethernet cable, there are two LEDs on top of the RJ45 socket. When the amber one is lit, it shows connectivity. The green LED indicates data transfer.

Using DDE
On the Jobs menu/Simulate? submenu, choose "false". Now choose Jobs menu/Run Instruction/NEUTRAL_ANGLES, or other angles.

If the robot moves, you can control it from DDE! The next step is calibrating Dexter. Choose the menu item Jobs menu/Calibrate Dexter to start.

We recommend choosing ? in the upper right corner of the Doc pane to understand the Help System.

Dexter's File System Dexter's processor board runs Linux. Once you are connected to Dexter, you should be able to browse this file system using your computer's file navigation tools. Dexter's file system will show up as a separate "Volume" or "Device". On the Mac, in the Finder, you should see, in the left column, Localhost. Click on it. In a half minute or so, you should see in the right (main) pane of the finder a single folder share. This folder is on Dexter. Expand it to see several files on Dexter.

DDE can also access this share folder on Dexter. Use the File menu/Open to edit a file. You can save modified files on Dexter too.

Calibrate Dexter When
To obtain optimal precision, Dexter must be calibrated after it is built.

Environmental effects of heat, humidity, movement, and orientation towards gravity, all conspire to make minor changes that affect Dexter's accuracy. Calibrate optical sensors will most likely only need to be done once. If you received a fully assembled Dexter, this initial calibration has been done. If you are building a kit, you must calibrate it when the building is complete. Calibrate optical encoders needs to be done every time Dexter is turned on. If Dexter is having sporadic movement or is not smooth in FollowMe mode, try going through a full calibration.

How
Choose the Test menu item of "Calibrate Dexter..." to open a dialog aiding calibration.

Step 1
Select the robot to calibrate. If you have only one Dexter, the default of dexter0 will already be selected.
Step 2
Calibrate optical sensors by calibrating each of the five joints. When you choose the radio button for a joint, this begins a Job that draws thousands of points in the large white square plot area on the right of the dialog. If you don't see points drawn, you probably have your robot set to simulate i.e. new Dexter({simulate: true}) or have that simulate init param set to null which causes it to look at the Jobs menu/Simulate? radio buttons for a value, or there is a discontinuity in your wiring. If the robot has its simulate init parameter set to null (the default and the case for dexter0), choose Jobs menu/Simulate?/ of false.

For each Joint, twist the two trim pots on the small (several centimeters per side) printed circuit board (the "optical board") for the joint that you are calibrating, until the drawn points form a circle, or as near a circle as you can make. The desired circle fills the white plot area in the dialog, not smaller and not larger.

Joints 1, 4, and 5 also have two screws to adjust the position of the optical blocks. If you see the drawn points form the pattern of an elongated diagonal oval, that indicates that the positional screws need to be adjusted.

All adjustments can be made with the provided small screw driver.

As you adjust, the screen will become cluttered with now obsolete dots. Click the "Restart" button to clear the dots and start calibrating the selected Joint over again.

Allow the drawing of points to complete (several minutes). If the circle looks good, click the mouse in the center of the circle. This will draw a red point there. If you are not satisfied with the center you've chosen, click the mouse again at a new location.

Once you are satisfied with the circle center you've chosen, click the "Done" check box underneath the Joint's radio button. Then click another Joint's radio button and repeat the above process for that Joint.

When you've completed calibrating all five joints, click the "Save" button.

Step 3
Calibrate optical encoders
Caution! Clear area for large robot movements.
Calibrate the optical encoders by clicking the bottom button in the dialog. This will take about a minute. When the directions line in Step 2 says that calibration is complete, you can close this dialog by clicking the x in its upper right corner.
User Interface
Help System Web programmers spend an inordinate amount of time searching the web because of missing or incomplete documentation. DDE bends over backwards to provide the documentation you need to create jobs. There are quite a number of ways to get "just in time & place" help within DDE. We've tried to make them easy to discover, but in such a sophisticated environment, you might miss a few. So here's the list:
Editor Pane The Editor pane is a text editor. You can view and edit any text documents in it, but primarily you will be editing JavaScript that defines a job to make something with Dexter. DDE expects you to save such "apps" in your Documents/dde_apps/ folder.

The red dots on the left column of the editor indicate possible syntactic errors. Many of these are unnecessary or trivial formatting issues that will not affect running the code. If the code doesn't Eval, look at the red dots and their tooltips for clues.

Output Pane DDE prints information in the Output pane that will be useful in your current context. You can explicitly print in the output pane with a call to the JavaScript function out. Example:
out("hi world", "blue")
out accepts any valid HTML as its first argument. It will be rendered in the Output pane.
Start Job Button Clicking this button evals and starts the job that the cursor is in.

If the cursor is in a job's source code but not in the do_list, then the job source will be evaled, and the job started.

If the cursor is on an instruction in the do_list with no selection, the job will be evaled and started with the first instruction run being the one the cursor is on.

If there is a selection within the do_list, then the first instruction run will be the one that contains the start of the selection, and the last instruction run will be the one that contains the end of the selection. This works by setting the job's program_counter and ending_program_counter properties.

If you have selected the source code for one or more instructions (with comma's between them) and there is no new Job() wrapper around the instructions, then a Job wrapper will be automatically made behind the scenes, the job will be defined, and started.

Just before an instruction is run, it will be selected in the editor.

Documentation Pane The Documentation pane describes the core knowledge you'll need to command Dexter to make things. Admittedly we'll always fall short of this goal, but let us know if some crucial information is missing and we'll do our best to fill the void.

You can find out what version of DDE is running and the latest changes under the Release Notes section of the documentation. Details about programming Dexter are in the Reference Manual section.

Simulate Pane
The simulate pane shows a graphical simulation of Dexter with joint angles of the last heartbeat robot status returned. (By default, heartbeats happen every 100ms.)

Use the mouse in the Simulate pane to:

  • Rotate table: mouse-down then drag.
  • Zoom: shift-down then mouse-down then drag.
  • Pan: alt or option down, then mouse-down, then drag.

shows Dexter randomly flailing around, not correlated to a connected Dexter.

The menu in the Simulate pane header let's you browse several videos showing off Dexter's capabilities.

Stepping Instructions To understand a Job's behavior, its useful to step through each instruction. Checking the pause checkbox will cause running jobs to pause when they have completed their current instruction. Jobs started when the pause button is checked will pause right before the first user instruction on the do_list is run.

When a job is paused, clicking the button will cause it to execute the next instruction, print out useful information in the Output pane, and pause. If a job is paused, and you uncheck the pause checkbox, then click the button, the job will begin running normally.

"debugger" The instruction of "debugger" in a do_list will cause the pause checkbox to be checked and the job to pause. A function that returns the string "debugger" or even an array that has an element of "debugger" will cause a pause.

Note that using the string "debugger" is intentionally similar to using the JavaScript constant debugger. If you have the constant debugger in the body of a function that is a do_list item, or is called by a do_list item, it will cause a JavaScript breakpoint and you can step through that code using the Chrome dev tools. See Documentation top level section Debugging.

JavaScript DDE let's you control a Dexter robot with Javascript. You can execute all of JS. DDE extends JavaScript with a library of functions that control Dexter, allow access to Unix commands on Dexter's computer, Window system extensions, as well as ROS specific function calls allowing you to find out about and control Dexter.

In DDE, console.log sends its output to the (usually hidden) Chrome console. Use out (on the menu) to see output in the Output pane.

Learning JavaScript The quickest way to learn most of the JavaScript you'll need is from the Editor Pane's menu. Read menu item tooltips, choose an item to insert code, then click to eval all the code in the Editor. If there's a selection when you click Eval, just the selected code will be evaluated. In fact, works on any selected text. Try it by: Choose menu items under in depth-first order for a consistent overview, and later you can choose exactly those items you need to insert a code snippet.
Warning Code in the editor that has not been evaled will have no effect.

A nice interactive tutorial is available at: https://www.codecademy.com/learn/javascript Beware that console.log prints to the normally hidden chrome console. DDE's out is easier to use.

If you want more prose, there are lots of JavaScript tutorials on the web. You will not need to know HTML, CSS or JQuery that are commonly taught in conjunction with JavaScript.

A very gentle intro to JavaScript. Ignore the parts that use the Underscore library.
A more formal (and long) tutorial.

JS for Programmers If you're already a competent programmer but don't know JS specifics, here's a few tips:
JavaScript is an untyped language. That means you don't declare types of variables, function parameters, or return values. So for instance,
C's       int foo = 32;
in JS is var foo = 32;
The type system is, um, weak. The object system is also in somewhat of disarray. Because of that there are many packages adding a more rational Object system, but they all differ, confusingly.

There's no compiler in JavaScript. There are no "includes" or "pre processors" or "macros". The code is run in an iterpreter inside a browser (every browser, actually). The major browsers also offer a debugging environment, though typically no Editor. DDE gives you an editor and a lot of other convenieces for developing code.

Whitespace characters are those characers that "take up space" but you can't otherwise see. This includes space, tab, newline and a few others. In Javascript, mostly its the case that 1 whitespace character is equivalent to any number of contiguous whitespace characters. Except that function calls need to be ended with either a semicolon or a newline, not just a space. For example:
Math.min(3, 4); Math.min(5, 6)
is legal, as is:
Math.min(3, 4)
Math.min(5, 6)

but not:
Math.min(3, 4)  Math.min(5, 6)

There is no Window System per se in JavaScript but it ties into HTML, CSS and the browser's Document Object Model. This is confusing since it requires several different syntaxes and ways-of-thinking. DDE simplifies this by providing the key window system facilites you'll need for commanding Dexter via the function show_window, the Human.enter_* instructions and a few other utilities. See the menu.

Javascript's functionality greatly expanded in 2016 with a new version who's name itself is confusing. You'll see EcmaScript 6, JavaScript 2015 and a few variants. Browsers vary as to how much of this they implement, but Chrome, the browser DDE uses, has nearly 100% of this new standard implemented as of June, 2016. DDE depends on these new features.

See in, this documentation, Installation/Keep Chrome up to date. JS 6 can run code from earlier versions of JS, but there's an awful lot of new functionality that isn't in most existing JS documentation.

Like all popular programming languages, JavaScript has its problems. But its unique in its "deployability". JS and DDE runs on Windows, Macs, Linux, and Chromebooks. Its new features are quite powerful, and DDE strives to make learning and using JS as simple as possible. Your new skills will serve you well in Web programming for billions of users.

Recommended JS Tutorials for the experienced programmer (both of which ignore the new JS 6 extensions):
JS re-introduction
more comprehensive

Eventually you will need to know the concepts of ROS (the Robot Operating System), though not the syntax of BASH, C++ and Python normally required to work with ROS.
Workflow DDE let's you execute arbitrary JavaScript that is entered into the Editor pane.
  1. The Editor pane's menus allow you to insert useful code snippets into the Editor pane.
  2. You can edit and extend the inserted code. Use any valid JavaScript.
  3. Click the button. The result of the last expression evaluated will appear in the Output pane.
  4. If there is a selection when the button is clicked, only the selected code will be executed.
  5. Triple click on a line to select it.
  6. Alt-click on a JS function call to select it.
Try this: type into the editor
2 + 3
Click and see 5 in the Output pane.
Persistent Data When you have defined a named function, set a global variable or a property reachable by a global variable, that data will remain in the JS environment until you relaunch DDE. This is even true if you bring a new file into the editor.

Overall this facilitates programming, but it does have some behavior that may be unexpected. Imagine you define
function foo(){return bar()} and
function bar(){return 'stuff'}
You call foo() => 'stuff'. Now you rename bar to baz like so: function baz(){return 'stuff'}and test baz() => 'stuff' as expected, as does calling foo() => 'stuff'. Now

The call to foo will error because bar is no longer defined. When redefining function and global variables, its a good idea to save your code in file(s), relaunch DDE, and reload your code periodically, to check against such issues.
Working with Dexter
  1. In the output pane, enter any Unix BASH shell command in the shell type in and hit enter. It is run on Dexter's computer. Returned text will be printed below. The command you typed in will also be added to the Output pane's menu under "User Commands" should you want to execute it again.
  2. The Output pane's menu allows easy access to finding out about the ROS environment.
  3. If you click on underlined text in the Output pane, it will scroll to a relevent section of the Doc pane, or, in the case of core JavaScript, pop up a window of documentation.
Series A useful way to organize knowledge is to construct lists of similar-typed concepts. DDE calls such lists series. There are over 30 series in DDE, including numbers, dates, colors, functions for math, strings, arrays, etc. The most useful functions and data structures in DDE are in a series.

The menu allows you to insert into the editor, an example item from each series. When you click on a series item in the editor, help is given on that item in the Output pane. Using the Right and Left arrow keys, you can replace a selected series item with the next or previous item in its series. The Up and Down arrow buttons replace a selected series item with an item from another series. Effectively this uses the series of series.

An example of a series is boolean. Choose it from the menu. It inserts true. Now hit the right arrow key to see additional items in the series (false, null, etc.) The left arrow goes backwards through the series.

With any series item selected, hit the down arrow. If you're on a member of the boolean series, this will replace the selection with an item from the integer series. Press the up and down arrows to go to a new series.

Each time you go to a new item from series or click on one already in the editor, help on it will be displayed in the Output pane.

Jobs A job feeds the instructions in its do_list to a robot for making things. Most users of DDE will spend most of their time creating and running jobs.

The menu gives help on Jobs and Robots.
The menu contains numerous examples of defining Jobs and how to run them. Choose Insert example 1 and read the comments to understand Job syntax. See the Reference Manual on Job for the details of specifying a job.

Robots A robot is a machine capable of performing the instructions in its instruction set. The class hierarchy of DDE Robots is:
To get a robot to perform instructions, you create an instance of its class, giving it at least a name (and in the case of Dexter, an ip_address and a port number) then create an instance of Job and give it a robot property of the robot you created. The job should also have a do_list, which is the sequence of instructions to run on the robot. When the start method is called on a Job, it sends the items on its do_list to the associated robot, sequentially, one at a time.

From a software standpoint, a robot is its instruction set. The key difference between different kinds of Robots is the difference between their instruction sets. If a robot is sent an instruction not in its instruction set, it will error, because it doesn't know how to perform that kind of instruction.

Robot is the superclass of all robot classes. It contains instructions that can run on all robots. These are control instructions because they help manage the flow of instructions in a job. Examples include: Robot.stop to end a job immediately without processing the insructions after the stop instruction, and Robot.wait_until which pauses execution of the job's instructions until the calling of the given JS function returns true.

See submenu "robot" for details about robots as well as the Reference Manual section on Robots.

TestSuite DDE has the capability to compose, run and report on Test Suites. DDE comes with several Test Suites and you can define more.

Each Test Suite has a name and an array of tests. A test is composed of an array of 1, 2, or 3 literal strings.

  1. A literal string of JavaScript code to evaluate that returns a value to be tested.
  2. The expected value of the above JavaScript code, also represented by a literal string of JavaScript.
  3. A literal string of a comment to aid in understanding the purpose or behavior of this test. If the comment starts with "known", then if the test does not pass, it will be reported on as an "known" failure. Other failures will be reported as "unknown". Often it is convenient to mark a test as "known" when you'd like to defer fixing it and just want to see the "unknown" failures.
Choose Insert Example to see a demonstation Test Suite.

You run a Test Suite by selecting it and hitting the right arrow key or choosing the Editor pane's Test/naviation/Run & sel next item menu item. Use the down arrow key to select the next level down item such as a test or even a part of a test. In each case, the right arrow executes the item and selects the next item at that level.

To create a Test Suite, type in the JavaScript source of the suite's first test, select it, and choose Selection to test. This will wrap a Test Suite around the item and fill in the test's expected value with the result of evaluating the code you have selected. If you do that again for a second JavaScript selection, it will also create a test, but this time, because the test is already in a Test Suite, it will not create a new Test Suite.

Other operations on the menu are documented with tooltips.

Debugging Most programmers spend most of their time debugging. We recommend entering just a bit of code at a time; a line or less before testing it. That way, when a bug shows up, you'll know it was in the last bit that you added. If you fail to do this, and have a large amount of code that has a bug, comment out lines incrementally and test to isolate the bug.

DDE uses an automatic syntax checker named ESLint. It indicates syntax errors in the Editor pane as soon as you enter them. There are many different styles of JS coding and different versions of JS so its hard to get such errors correct. Even if you have syntax errors indicated, your code may run fine. As a first pass though, try to fix such errors before evaling. If you can't, go ahead and evaluate your code. Perhaps runtime errors will help you fix the bug, or perhaps it will run OK and you'll know to just ignore the JS Pane syntax bug indication.

Evaling just selected portions is another way to isolate bugs. If there is a selection of JavaScript code, only that code will be evaled when you click

Another technique is to comment out code until your bug goes away.
// comments out to the end of the line.
/* comment */ Wrap JavaScript in
slash-star ... star-slash
to comment out code in the middle of a line or multiple lines. See the Editor pane's debugging menu items.

Entering debugger; into the body of a JS function definition will set a breakpoint there. When debugger; is evaluated (after you call the function) and the Chrome Developer Tools window is open, execution will pause and highlight the debugger; statement in a copy of your source code. (To open the Chrome Developer Tools window, click right on any DDE pane and choose Inspect. If you don't see "Inspect" on the menu, read the documentation under "Installation" on "Configure Chrome".) Use the arrow buttons stepper buttons in the Developer Tools window upper right to step execution.

Wrapping console.log() around a complex data structure will print it out in the Chrome Developer Tools console with arrows to allow you to expand data pieces of your choice to inspect. To see the console, click right anywhere in DDE and choose "Inspect".

You can print strings into the Output pane with a call to out. Because out returns its 1st argument, you can embed it in code to see an intermediate value.
out(2 + 3) * 4 => 20
will print out 5, but return 20.
Print to output has items that print in a few different colors so that you can distinquish some outputs from others in a complex debugging session.

speak behaves similarly to out in that it returns its 1st arg. It can be useful in contexts where you want to know a value but don't want to look at the screen to find it. speak is on the Insert menu, under Learn Javascript/debugging.

Because JavaScript, like all popular textual programming languages, has not been designed with the "user experience" in mind, it is full of ideosyncracies that make learning how to use it require remembering a lot of "gotchas". The web has pages on common JavaScript programming errors. A good one is: https://www.w3schools.com/js/js_mistakes.asp , incomplete, but a good start.

Contact Please help us by emailing a bug report or suggestion to cfry@hdrobotic.com Take a look at the latest Release Notes and the Known Issues to avoid duplication.