Translator: Hack E Bot - UA-ScriptEase/scriptease GitHub Wiki
#Hack-E-Bot
Hack-E-Bot is a cost effective and open source robot for children. It was crowd funded in October 2014 from Crowd Supply, and meant as a teaching tool to get children excited about electrical engineering, electronics, and programming. Since ScriptEase is also meant as a teaching tool for helping younger people develop the reasoning skills behind programming, we thought a translator would be a good fit.
If you plan on buying a Hack-E-Bot, we recommend you don't choose the DIY option as the wire crimping and soldering can be frustrating, even for adults.
#Disclaimer The Hack-E-Bot translator is still a work in progress. Unfortunately, there are still bugs in the code that we haven't yet fixed, and they will remain for the forseeable future. We can't guarantee that everything will work as planned, but we hope that you still enjoy the work that we've done so far. Please see our issue tracker for more details.
#Downloading Arduino
The first thing we’ll need in order to work the Hack-E-Bot is set up Arduino. The Hack-E-Bot uses an Adafruit board. The easiest installation I’ve found was to download the Arduino zip file from this site, extract and add to the C:/ drive. The download link is near the bottom of the page and named “Arduino 1.6.4 with Adafruit boards for Windows”. I’ve found that the automatic installer does not always install the correct boards and is easier to do this manually.
If you already have a copy of Arduino on your computer, the link provided also has instructions for updating your boards.
#Downloading Drivers
Follow along with the instructions from the Arduino Adafruit site here.
You will need to install the USBTinyISP driver so that you can connect the Adafruit board to your computer.
###Step by Step Setup
- Rename Adafruit 1.6.x folder to Arduino and copy/paste the folder into your
C:/
drive - Start Arduino; this automatically creates an Arduino folder in your Documents for your sketches and libraries. (ex:
C:/Users/NAME/Documents/Arduino
) - Download the StandardCplusplus Arduino library either from our repository or from the original author Maniacbug.
- Extract the StandardCplusplus folder into your
C:/Users/.../Arduino/libraries
folder within your Documents. - Download the ScriptEase.zip and extract.
- Begin ScriptEase by clicking on the ScriptEase.jar. Then select a ‘Title’, Hack-E-Bot from the Game drop down menu, and any text file for the module. We do not save any relevant information to the module so any file will do.
- Play around with the translator and save, this will make sure that the HEBIncludes folder for making Hack-E-Bot function are copied into your
C:/Users/.../Documents/Arduino/libraries
folder. (ex: HackEBot_Sonar.cpp, HackEBot_Move.cpp, HEBStory.cpp) - On Windows press F9 to automatically open Arduino and transfer the code. On a Mac, you will need to copy all the text below the “==== DESCRIPTION ====” title from
File > Test and Display Code
into the Arduino IDE. If you run into problems with automatic testing, copying/pasting the code also works on Windows. - In Arduino go to
Tools > Board
and select ProTrinket 5v/16MHz (USB) - In Arduino go to
Tools > Port
and make sure that COM is selected - In Arduino go to
Tools > Programmer
and select USBTinyIsp - Click the “Checkmark” button to compile.
- Connect the Hack-E-Bot and click the “Arrow” upload button.
- You’re done!
###Trouble Shooting
-
The default translator will look for the Arduino executable in the file path
C:/Arduino
for utilizing the “Test Story” shortcut within ScriptEase so it is important to save your installation of Arduino here. You can change the path that ScriptEase looks for the executable by either changing the GAME_DIRECTORY variable in the Hack-E-Bot translator.ini file to your preferred Arduino directory, or you may also change the path name within ScriptEase itself by editing the translator from the Library drop down menu (Library>HackEBot>Edit Translator>Browse Game Directory
. Make sure not to select a .exe file, just the folder that it resides in) -
Your file paths should look like this:
-
`C:/Arduino`
-
`C:/Users/YOUR_NAME/Arduino/libraries/StandardCplusplus`
-
`C:/Users/YOUR_NAME/Arduino/libraries/HEBIncludes`
-
As this translator is a work in progress, and a number of these variables are hard coded into the translator, it is important that these file paths be exact in order for ScriptEase to function correctly.
-
For the StandardCplusplus library, make sure that you extract to a folder named StandardCplusplus, and that that folder contains no folders within it. Arduino has a difficult time recognizing when a library folder contains folders within it and likely won’t function.
-
Currently, you can use the Hack-E-Bot translator on both a PC and a Mac. However, you will only be able to use the “Test Story” shortcut in ScriptEase if you are on a PC.
-
#Hack-E-Bot test environment
Since the majority of development has taken place in the Eclipse IDE, and since the Arduino IDE does not have an easy-to-use debugger, it was necessary to create a C++ specific package to test our Hack-E-Bot code. This environment is labeled as botstory within our repository and contains the C++ source code that would be generated by ScriptEase to run in Arduino.
If you do not wish to used Eclipse, the three files you need to run through a terminal or your choice of compiler are within the src folder.
###Step by Step Instructions
- Generate the Arduino code in ScriptEase, and either use the F9 shortcut to open the code in Arduino or open the "Test and Display Code" option in the File menu.
- Copy the contents of the "StoryPointSetup" method not including the
if(!storyInitialized)
code. Paste this code into main.cpp in main() afterenum State
. Replace any existing code. - Copy the contents of the "Do" method into the "for" loop in main.cpp.
- Make sure to erase the "_NUMBER" suffix from each of the method calls. (ex:
TurnDirection_0
TurnDirection_1
should both just beTurnDirection
) Do NOT delete the "_NUMBER" suffix from any of the variables. - If present, copy the contents of
WhenRobotIsWithinDistanceCentimetersFromAnObstacle
method into the same named method within main.cpp. - You may now run the C++ code, which will simulate the exact sequence of instructions that would be sent to your Hack-E-Bot, and the time that each action takes to complete. Currently, each action that moves forward or back takes 250 ms and each turn option takes 450 ms. Turn by degrees takes approximately 5 ms per degree.
MinGW was the compiler used for testing.
#Quick Link If the above instructions do not adequately cover all questions you may have, please look through the official Hack-E-Bot website.