Building Hex Files for the Meggy Jr
Getting started with the Meggy Jr on the linux machines in CS department.
- Download the MeggyJrSimple.cpp,
and simple-test.cpp files.
- Plug the Meggy Jr device into your USB port in CompSci 325 or 215.
- Follow the directions at the top of the Makefile file to compile the example and install it on your Meggy Jr device.
Use the reference compiler to compile a MeggyJava program
The reference compiler compiles MeggyJava code to AVR assembly, which
is what your compilers will be doing as well.
It can be helpful to use the reference compiler on your test cases
to see what code it generates.
To try out the reference compiler, first download the example input
PA5Cylon.java. Then do the following
on a linux box in the CS department:
java -jar ~cs453/public/MJ.jar PA5Cylon.java
This will generate a PA5Cylon.java.s file, which you can then
compile and upload to the Meggy Jr using the above provided Makefile.
Things to try out next
- Create your own .cpp file by copying the simple-test.cpp file. The build process in the Makefile is set up for a single .cpp file of any name.
Getting started with the Meggy Jr on a Mac (OPTIONAL)
Pretty much following www.evilmadscientist.com/article.php/meggyjrlib. These instructions are offered as is with NO support from the 453 instructor or TA. If you figure out how to get Arduino to work with your Windows or linux box, please consider sharing it with the rest of the class. If you find any errors in the below, please let us know.
- Download the Arduino software from http://arduino.cc/en/Main/Software. Copy the Arduino application to the Applications directory.
- It is possible that you will need to install a USB serial driver. I did in 2011, but I didn't in 2015.
- Make the MeggyJrLibrary accessible in Arduino.
- Download MeggyJrLibrary1.40.zip from http://code.google.com/p/meggy-jr-rgb/.
- Exit out of Arduino application.
- Put the unzipped folder into the Sketchbook location in a subdirectory called libraries, which is specified in the Arduino preferences and is by default /Users/yourusername/Documents/Arduino/. You will probably have to create the libraries subdirectory, /Users/yourusername/Documents/Arduino/libraries/, and place the MeggyJr folder in the libraries/ subdirectory.
- Restart the Arduino application.
- You should be able to open the MeggyJr examples. For instance, try File->Examples->MeggyJr->MeggyJr_FroggyJr in the Arduino application.
- Upload an example to the MeggyJr device.
- Under the Tools->Board menu select Arduino Duemilanove or Nano w/ ATmega328
- Plug the Meggy Jr device into your USB port, turn it on, and make sure /dev/tty.usbserial-* is selected under Tools-->Serial Port.
- Click the upload button on the example. The example should start immediately running on the Meggy Jr device.
- Writing your own example in C WITHOUT using the Arduino GUI.
- Download the MeggyJrSimple.cpp,
- Plug the Meggy Jr device into your USB port, turn it on, and make sure /dev/tty.usbserial-** is selected under Tools-->Serial Port in Arduino (this is all you have to do in the Arduino IDE).
- Follow the directions at the top of the Makefile.mac file for
the input file simple-test.cpp (so file=simple-test).
- Create your own .cpp file by copying the frame.cpp file. The build process in the Makefile.mac is set up for a single .cpp file of any name.
.... January 9, 2015