Using the Arduino Library Manager install the most current version of the u8glib library (find it by searching), then from the examples list in the file main menu, from the u8glib select the Chess example.
Modify the Source
Add or change the Chess example from the u8glib library to reflect the source below. See the comments of each code block for further instructions.
// Create the u8g object according to the Arduboy's hardware.
// SW SPI Com: SCK = 15, MOSI = 16, CS = 12, A0 = 4, RST = 6
U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(15, 16, 12, 4, 6); // add this line.
// keys for Arduboy 1.0
// change the existing values
uint8_t uiKeyPrev = A2; // left button
uint8_t uiKeyNext = A1; // right button
uint8_t uiKeySelect = 7; // 'A' button
uint8_t uiKeyBack = 8; // 'B' button
Modify the setup() function to stop the screen from being rotated.
void setup() {
// rotate screen, if required
//u8g.setRot180(); // comment this line out
uiSetup();
chess_Init(u8g.getU8g(), 0);
}
Arduboy Button Bindings
The following are the pin values for the Arduboy 1.0 buttons. These can be used to customize the button layout used by the game in the previous section.
Great! Now, if I’m not mistaken, what his suggestion is in getting the chess engine to work, for the devkit at least, is to replace the values in the Chess example in the u8glib, which can be added to the Arduino IDE.
Have a look at this wiki guide, @Maddow on u8glib, and install the library then open the Chess example from the main menu.
This game doesn’t require the Arduboy Library, but you will need the production unit’s pin values which are used to replace the devkit pin values in the code below.
Hrmmmm Maybe I can make a screen cap or something of the steps… A port isn’t needed. Let me see if I can do that, those are probably the “clearest” written instructions I can provide all together, but lets try small steps each post.
If you can, start by installing the the u8glib in the IDE in the same way you installed the Arduboy Library. Open the library manager and search for “u8glib”. If you get that far, let me know.
The next step would be to open an example, in particular the Chess example, in the same way you would open an Arduboy example.
Alright, now if you go to the main menu and select from the File menu, the Examples section, do you see a subsection for u8glib? If so do you see the example for Chess? If yes open it up and take a moment to skim through it. Don’t worry, it’s not super important to understand any of it really, but it’s good to gleen a few random things from it if you can. This pre-reading can help you after you go to compile it. Which is the next step.
Ok, now with the source open, refer back to the original topic post, which has some information about the lines that need to be changed to make this source compile for the devkit. For the lines below I’ve replaced it with the button values for the Arduboy 1.0.
Setting up Little Rook for Arduboy 1.0
Add or change the Chess example from the u8glib library to reflect the source below. See the comments of each code block for further instructions.
// Create the u8g object according to the Arduboy's hardware.
// SW SPI Com: SCK = 15, MOSI = 16, CS = 12, A0 = 4, RST = 6
U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(15, 16, 12, 4, 6); // add this line.
// keys for Arduboy 1.0
// change the existing values
uint8_t uiKeyPrev = A2; // left button
uint8_t uiKeyNext = A1; // right button
uint8_t uiKeySelect = 7; // 'A' button
uint8_t uiKeyBack = 8; // 'B' button
Modify the setup() function to stop the screen from being rotated.
void setup() {
// rotate screen, if required
//u8g.setRot180(); // comment this line out
uiSetup();
chess_Init(u8g.getU8g(), 0);
}
Arduboy Button Bindings
The following are the pin values for the Arduboy 1.0 buttons. These can be used to customize the button layout used by the game in the previous section.
Ok now select your target board as the leonardo, and then select the COM port your Arduboy is on. After setting up the device, you then will hit compile and upload, and you should be ready to play.
If it compiles with errors, please post them back in here and we can resolve them.
When selecting a COM port, as long as it shows up as a leonardo you should be fine. Windows will tend to place it on COM3 in most cases. When in doubt, save your work, and restart the IDE with the unit plugged in. You can also open up the Windows Device Manager and check which COM it is on.
Anyway, here’s the part that is important to you from the thead above, it should help with the compile/build and upload process.
Select the Leonardo Board and a COM port
From the Arduino IDE menu select Tools > Board > Arduino Leonardo.
Select the appropriate COM from Tools > Com.
Uploading
In the upper left corner of the Arduino IDE are two buttons used to verify (compile) and upload code to the Arduboy.