Little Rook Chess on an Arduboy DevKit

Make sure you add

// SW SPI Com: SCK = 15, MOSI = 16, CS = 12, DC = 4, RST = 6
U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(15, 16, 12, 4, 6);

to the top of the source file somewhere, under the header definitions and above or below that big comment blog at the beginning of the file.

That is the constructor call to setup the library so it can draw to the screen. the u8g is being defined in this line. There is a long list of commented out constructors to choose from, this one is custom, but should work.

Mine looks like:

//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)


// DOGS102 shield configuration values
// uint8_t uiKeyPrev = 2;
// uint8_t uiKeyNext = 4;
// uint8_t uiKeySelect = 5;
// uint8_t uiKeyBack = 3;

// DOGM128-Shield	 configuration values
// DOGXL60-Shield configuration values

U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(15, 16, 12, 4, 6); // <- Here is the added line

uint8_t uiKeyPrev = A2;
uint8_t uiKeyNext = A1;
uint8_t uiKeySelect = 7;
uint8_t uiKeyBack = 8;

And in the setup() function (line 197 about), comment out u8g.setRot180(); so that it looks like the following:

void setup() {
  // rotate screen, if required
  //u8g.setRot180();
  
  uiSetup();
  chess_Init(u8g.getU8g(), 0);
}

When I try to upoload the sketch

D:\Tytin\Mes documents\Arduino\libraries\U8glib\src\clib\u8g_rot.c:48:1: warning: initialization from incompatible pointer type [enabled by default]

u8g_dev_t u8g_dev_rot = { u8g_dev_rot_dummy_fn, NULL, NULL };

^

D:\Tytin\Mes documents\Arduino\libraries\U8glib\src\clib\u8g_rot.c:48:1: warning: (near initialization for ā€˜u8g_dev_rot.dev_fn’) [enabled by default]

Ok sorry about the delay. I currently have it running… haha but the screen is upside down, you just need to comment out the call to rotate the screen in the setup() function.

So warnings shouldn’t prevent you from compiling and uploading.

I did have the values setup incorrectly in the source I posted, so it has been updated. Please look at the source a the bottom of Little Rook Chess on an Arduboy DevKit - #22 by ekem again.

After playing this rather fun game for a bit, it might actually benefit from using the Arduboy Library, either through saving the game state so you can resume a game after the unit is powered off or just saving a game record.

Sound might also make a nice addition as well.

The button mappings are definitely going to be up to a user’s preference : )

Any news on this? Would love to be able to get a nice little version of chess on my production Arduboy.

Everything should work @Josh_Hartdegen. Use whats in this thread Little Rook Chess on an Arduboy DevKit to setup the sketch.

I think this was a pain to put on Codebender, and I didn’t feel right putting it up on Github yet :smiley:

Maybe now I will, but if you follow those instructions you should be able to get everything running. And yes, I flipped the image right side up :smiley:

Please do! It’s not out of laziness or an inability to learn, but this whole process - sketches, functions, etc. - is incredibly new to me, and I’m struggling here. If it’s not too much of a hassle to upload a working production version, I’d really appreciate it! :innocent:

1 Like

The only way I ever learned anything was by seeing it done :smile: . So I present to you a finished, working upload (some assembly required ;)).

Arduboy Little Rook


The link provided is to a Git repository containing the sketch needed to play Little Rook on an Arduboy.

Instructions


Step 01 Ā· Install the U8glib library.

It is the same process to install the U8glib library as it to install the Arduboy library: use the Arduino IDE’s Library Manager. The Library Manager can be found in the Arduino IDE’s menu bar under the Sketch drop down menu, Sketch > Include Library > Manage Libraries....

Step 02 Ā· Create the ArduboyLittleRook sketch, copy and paste, then upload.

It is easiest to open the Arduino IDE and create a new sketch called ArduboyLittleRook, save it, and then copy and paste the source from Github into your new file to create the sketch. Save your sketch, then compile and upload the result to an Arduboy.

Has anyone built an .arduboy package version of this?

All Arduboy Manager games are also hosted on the site’s repo as .arduboy games.

You can find the .arduboy file here: http://www.crait.net/arduboy/littlerookchess/LittleRookChess.arduboy

neat, thanks.
Did you package it? Could you call the hex file something more meaningful, at the moment it’s called app.hex

I currently flash my arduboy using a pocket chip, so the hex files are handy.

If the arduboy format states it should be called app.hex that’s fine, I can work with that.

I have a system that kinda makes them real quick so I don’t worry about manually naming them. Sorry, but feel free to rename the .hex file if it works best for you! :smiley:

Is there a reason the board is only half the screen when it coudl easily be 75% and probably have easier to discern pieces? Was it originally designed for a lower res screen?

It could be expanded, it was originally a demo for a graphics driver that can run many different screens.

It might be fun to zoom in an animate the pieces :smiley:

I was wondering about zooming. I installed it but honestly found it very hard to play that tiny. :frowning:

Not sure how usable seeing only half the chess board would be for thinking thru moves and stuff.