#include <Gamer.h> Gamer gamer; void setup() { gamer.begin(); void loop() {
Gamer Keywords Inputs Board Pin Out Library Instead of trying to find out which input is plugged into which pin, you can use the following keywords as references to the pin numbers. For example, if you want to check if the up button is pressed, use the function ispressed(up); Use these functions to check if buttons are pressed or held. You can also read the raw value of the light dependent resistor. bool ispressed(uint8_t input); Want to get more creative with your DIY Gamer Kit? Well here s a helping hand to get you on your way. A cheat sheet with code and Arduino layout for you to refer to whenever you re stuck in your electronic exploration. Make, Play, Code and Invent! #define UP 0 #define LEFT 1 #define RIGHT 2 #define DOWN 3 #define START 4 #define LDR 5 Setup It s very important to call the begin() function in your Arduino sketch, specifically within your setup function. This makes sure that all pins are set to inputs or outputs and prepares the hardware. Returns true if the button is pressed. (unique press!) bool isheld(uint8_t input); Returns true if the button is held. (continuous press!) int ldrvalue(); Returns the raw value of the LDR. void setldrthreshold(uint16_t threshold); If you treat the LDR as a button, this sets its trigger theshold. void setled(bool value); void begin(); Sets the programmable LED to either HIGH or LOW. void toggleled(); Outputs Toggles / flips the programmable LED s value. These functions help you write stuff to the display, as well as trigger the programmable red LED on the Gamer. Variables void setrefreshrate(uint16_t refreshrate); Sets the refresh rate of the display. void updatedisplay(); Converts your display array into binary and burns it to the display. void allon(); Turns on all of the pixels. void clear(); You have full access to two variables. The 2 dimensional display array holds your world of pixels. Whenever you call updatedisplay() the display array is converted to the image array. Each row of the display is one byte. All of the rows live inside the image array. Most of the time, you will want to manipulate the display array, but if you re a smarty-pants and you want to play around with more low-level things, feel free to tweak the bytes in the image array. It s your fault if it breaks though! Clears everything on the display. void printimage(byte* img); byte display[8][8]; byte image[8]; Made in Hackney, London Burns a byte image into the display.
Gamer Lettering gamer.image[0] = B00100000; gamer.image[1] = B00100000; gamer.image[2] = B00100000; gamer.image[4] = B00100000; gamer.image[5] = B00100000; gamer.image[5] = B10011000; This sheet will help you to get coding and animating your own images on the gamer. We wanted to help you get started, so we created the DIY Gamer alphabet for you to use. Copy the code next to the associated letter to create it on screen. Look at the code closely and you can see how it correlates with the pixels of the screen. Use this system to design your own letter-forms and illustrations! gamer.image[3] = B10000000; gamer.image[0] = B11110000; gamer.image[6] = B11110000; gamer.image[0] = B00001000; gamer.image[1] = B00001000; gamer.image[2] = B00001000; gamer.image[3] = B00001000; gamer.image[1] = B10010000; gamer.image[2] = B10100000; gamer.image[3] = B11000000; gamer.image[4] = B10100000; gamer.image[5] = B10010000; gamer.image[0] = B10000000; gamer.image[3] = B10000000; gamer.image[0] = B11011000; gamer.image[1] = B10101000; gamer.image[2] = B10101000; gamer.image[3] = B10101000; gamer.image[5] = B10101000; gamer.image[6] = B10101000; gamer.image[4] = B10100000; gamer.image[5] = B10010000; gamer.image[4] = B00001000; gamer.image[5] = B00001000; gamer.image[1] = B00100000; gamer.image[2] = B00100000; gamer.image[4] = B00100000; gamer.image[5] = B00100000; gamer.image[2] = B01010000; gamer.image[4] = B00100000; gamer.image[5] = B00100000; gamer.image[1] = B00001000; gamer.image[2] = B00010000; gamer.image[4] = B01000000; gamer.image[6] = B10000000; gamer.image[0] = B11001000; gamer.image[1] = B10101000; gamer.image[2] = B10101000; gamer.image[3] = B10101000; gamer.image[5] = B10101000; gamer.image[6] = B10011000; gamer.image[5] = B01010000; gamer.image[0] = B01110000; gamer.image[3] = B10000000; gamer.image[4] = B10011000; gamer.image[6] = B01110000; gamer.image[0] = B10101000; gamer.image[1] = B10101000; gamer.image[2] = B10101000; gamer.image[3] = B10101000; gamer.image[5] = B10101000; gamer.image[6] = B11011000; Made in Hackney, London gamer.image[6] = B10000000; gamer.image[2] = B01010000; gamer.image[4] = B01010000;
Arduino Cheat Sheet Need a hand starting with your Arduino board and software? This sheet explains some of the basics to get you going on your coding adventure! Arduino Environment Software written using Arduino are called sketches. These sketches are written in the Arduino Integrated Development Environment (IDE). Sketches are saved with the file extension.ino. The IDE has features for cutting/pasting and for searching/ replacing text. The message area gives feedback while saving and exporting and also displays errors. The console displays text output by the Arduino environment including complete error messages and other information. The bottom righthand corner of the window displays the current board and serial port. The Toolbar Below are the toolbar functions you ll find when you open your Arduino software. Verify - Check your code for errors. Menus Edit Copy for Forum - Copies the code of your sketch to the clipboard in a form suitable for posting to the forum, complete with syntax colouring. Copy as HTML - Copies the code of your sketch to the clipboard as HTML, suitable for embedding in web pages. Sketch Verify/Compile - Checks your sketch for errors. Show Sketch Folder - Opens the current sketch folder. Add File - Adds a source file to the sketch (it will be copied from its current location). The new file appears in a new tab in the sketch window. Files can be removed from the sketch using the tab menu. Import Library - Adds a library to your sketch by inserting #include statements at the start of your code. Tools Sketch A sketch is the name that Arduino uses for a program. It s the unit of code that is uploaded to and run on an Arduino board. Code The setup() function is called when a sketch starts. Use it to initialize variables, pin modes, start using libraries, etc. The setup function will only run once, after each powerup or reset of the Arduino board. After creating a setup() function, the loop() function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond as it runs. Code in the loop() section of your sketch is used to actively control the Arduino board. Arduino Layout The code below won t actually do anything, but its structure is useful for copying and pasting to get you started on any sketch of your own. It also shows you how to make comments in your code. Any line that starts with two slashes (//) will not be read by the compiler, so you can write anything you want after it. Commenting your code like this can be particularly helpful in explaining, both to yourself and others, how your program functions step by step. void setup() { // put your setup code here, to run once: void loop() { // put your main code here, to run repeatedly: The basic components on your Arduino board have been labelled below. These are the ones you will need to know about to get you started with Arduino. Upload - Compiles your code and uploads it to the Arduino I/O board. New - Creates a new sketch. Open - Presents a menu of all the sketches in your sketchbook. Clicking one will open it within the current window. Save - Saves your sketch. Serial Monitor - Opens the serial monitor. Auto Format - This formats your code nicely: i.e. indents it so that opening and closing curly braces line up, and that the statements inside curly braces are indented more. Archive Sketch - Archives a copy of the current sketch in.zip format. The archive is placed in the same directory as the sketch. Board - Select the board that you re using. Serial Port - This menu contains all the serial devices (real or virtual) on your machine. It should automatically refresh every time you open the top-level tools menu. Analog Pins Microcontroller Chip Power LED Digital Pins Power Pins Input LED Oscillator Power Input USB Connection Reset Button Made in Hackney, London
Animation Generator Animation Generator Toolbar Press i to invert your image Paint mode Erase mode Wish that stick man you just drew could jump and run...now he can! As the animation generator allows you to combine single frames you ve drawn in order to create an animation. Repeat this step until you are happy with your animation. You can skip between frames and edit them using the left and right keys. Hold shift and click with your mouse to erase. Copy Code Want to draw images for your gamer but don t want to have to code it? The Animation Generator allows you to create images using a piece of specially designed software which generates code from your drawings. Which you can then upload to your gamer. It also allows you to build animations for your Gamer with no coding required. Press s to save Press c to copy to clipboard Press + to add a blank frame Press Shift and f to duplicate the current frame Press - to remove the current frame Press x to start from scratch Left and Right keys navigate between frames Spacebar toggles playback Press h to toggle help bar Press backspace to clear Image Example Start by opening your GamerAnimPainter.pde file in Processing. Press open. Draw your image (run) and the sketch will Then hit c to Copy your code to your clipboard. Then head to Ardunio open File > Examples > Gamer > Alien. Delete existing code between the lines: Gamer gamer and void setup() then paste your copied code from the clipboard here and hit Upload. Animation Example This example will show you how to use the animator to create a stereo levels animation. Start by opening your GamerAnimGenerator.pde file in Processing. Press open. Draw your first frame (run) and the sketch will Save Save animation Clear all frames Previous frame Once you ve drawn all your frames, preview your animation by pressing the spacebar. Next frame Add blank frame Duplicate current frame Or... Press Shift and f. This will duplicate the current frame. Then draw the next frame. Finally hit c to Copy your code to your clipboard. Then head to Ardunio and open - File > Examples > Gamer > Animationexample and delete existing code where it states. Replace this with yours! Then paste your copied code from the clipboard here and hit Upload. Remove frame Made in Hackney, London Load Load animation Toggle playback
Design your animation Want to create an animation for your DIY Gamer but want to map it out before you start coding it or inputting it into our animation software? This worksheet is for you to print off and use as a template to sketch out frame by frame what you want your animation to look like. Example Use this worksheet to design and plan out the animation you want to create for your DIY Gamer. Sketch and make notes so you know exactly how your animation will work. Frame 1: Stationary alien. Frame 2: Alien mid-jump. Frame 3: Alien full jump. Frame 4: Alien mid-landing...
Cheat Keywords Inputs void setled(bool value); Board Pin Out Sheet Want to get more creative with your DIY Gamer Kit? Well here s a helping hand to get you on your way. A cheat sheet with code and Arduino layout for you to refer to whenever you re stuck in your electronic exploration. Make, Play, Code and Invent! Instead of trying to find out which input is plugged into which pin, you can use the following keywords as references to the pin numbers. For example, if you want to check if the up button is pressed, use ispressed(up); #define UP 0 #define LEFT 1 #define RIGHT 2 #define DOWN 3 #define START 4 #define LDR 5 Setup It s very important to call the begin() function in your Arduino sketch, specifically within your setup function. This makes sure that all pins are set to inputs or outputs and prepares the hardware. void begin(); Use these functions to check if buttons are pressed or held. You can also read the raw value of the light dependent resistor. bool ispressed(uint8_t input); Returns true if the button is pressed. (unique press!) bool isheld(uint8_t input); Returns true if the button is held. (continuous press!) int ldrvalue(); Returns the raw value of the LDR. void setldrthreshold(uint16_t threshold); If you treat the LDR as a button, this sets its trigger theshold. Outputs These functions help you write stuff to the display, as well as trigger the programmable red LED on the Gamer. Sets the programmable LED to either HIGH or LOW. void toggleled(); Toggles / flips the programmable LED s value. Variables You have full access to two variables. The 2 dimensional display array holds your world of pixels. Whenever you call updatedisplay() the display array is converted to the image array. Each row of the display is one byte. All of the rows live inside the image array. Most of the time, you will want to manipulate the display array, but if you re a smartypants and you want to play around with more low-level things, feel free to tweak the bytes in the image array. It s your fault if it breaks though! byte display[8][8]; byte image[8]; void setrefreshrate(uint16_t refreshrate); Sets the refresh rate of the display. void updatedisplay(); Converts your display array into binary and burns it to the display. void allon(); Turns on all of the pixels. void clear(); Clears everything on the display. void printimage(byte* img); Made Hackney, London Burns a byte image into the display.
Cheat Sheet gamer.image[5] = B01010000; This sheet will help you to get coding and animating your own images on the gamer. We wanted to help you get started, so we created the DIY Gamer alphabet for you to use. Copy the code next to the associated letter to create it on screen. Look at the code closely and you can see how it correlates with the pixels of the screen. Use this system to design your own letter-forms and illustrations! gamer.image[3] = B10000000; gamer.image[0] = B11110000; gamer.image[6] = B11110000; gamer.image[0] = B00100000; gamer.image[1] = B00100000; gamer.image[2] = B00100000; gamer.image[4] = B00100000; gamer.image[5] = B00100000; gamer.image[0] = B00001000; gamer.image[1] = B00001000; gamer.image[2] = B00001000; gamer.image[3] = B00001000; gamer.image[1] = B10010000; gamer.image[2] = B10100000; gamer.image[3] = B11000000; gamer.image[4] = B10100000; gamer.image[5] = B10010000; gamer.image[6] = B10000000; gamer.image[5] = B10011000; gamer.image[4] = B10100000; gamer.image[5] = B10010000; gamer.image[0] = B10101000; gamer.image[1] = B10101000; gamer.image[2] = B10101000; gamer.image[3] = B10101000; gamer.image[5] = B10101000; gamer.image[6] = B11011000; gamer.image[2] = B01010000; gamer.image[4] = B01010000; gamer.image[2] = B01010000; gamer.image[4] = B00100000; gamer.image[5] = B00100000; gamer.image[0] = B10000000; gamer.image[3] = B10000000; gamer.image[4] = B00001000; gamer.image[5] = B00001000; gamer.image[1] = B00001000; gamer.image[2] = B00010000; gamer.image[4] = B01000000; gamer.image[6] = B10000000; gamer.image[0] = B11011000; gamer.image[1] = B10101000; gamer.image[2] = B10101000; gamer.image[3] = B10101000; gamer.image[5] = B10101000; gamer.image[6] = B10101000; gamer.image[1] = B00100000; gamer.image[2] = B00100000; gamer.image[4] = B00100000; gamer.image[5] = B00100000; gamer.image[0] = B01110000; gamer.image[3] = B10000000; gamer.image[4] = B10011000; gamer.image[6] = B01110000; gamer.image[0] = B11001000; gamer.image[1] = B10101000; gamer.image[2] = B10101000; gamer.image[3] = B10101000; gamer.image[5] = B10101000; gamer.image[6] = B10011000; Made Hackney, London
Arduino Cheat Sheet Need a hand starting with your Arduino board and software? This sheet explains some of the basics to get you going on your coding adventure! Made Hackney, London Arduino Environment Software written using Arduino are called sketches. These sketches are written in the Arduino Integrated Development Environment (IDE). Sketches are saved with the file extension.ino. The IDE has features for cutting/pasting and for searching/ replacing text. The message area gives feedback while saving and exporting and also displays errors. The console displays text output by the Arduino environment including complete error messages and other information. The bottom righthand corner of the window displays the current board and serial port. The Toolbar Below are the toolbar functions you ll find when you open your Arduino software. Verify - Check your code for errors. Upload - Compiles your code and uploads it to the Arduino I/O board. New - Creates a new sketch. Open - Presents a menu of all the sketches in your sketchbook. Clicking one will open it within the current window. Save - Saves your sketch. Serial Monitor - Opens the serial monitor. Menus Edit Copy for Forum - Copies the code of your sketch to the clipboard in a form suitable for posting to the forum, complete with syntax colouring. Copy as HTML - Copies the code of your sketch to the clipboard as HTML, suitable for embedding in web pages. Sketch Verify/Compile - Checks your sketch for errors. Show Sketch Folder - Opens the current sketch folder. Add File - Adds a source file to the sketch (it will be copied from its current location). The new file appears in a new tab in the sketch window. Files can be removed from the sketch using the tab menu. Import Library - Adds a library to your sketch by inserting #include statements at the start of your code. Tools Auto Format - This formats your code nicely: i.e. indents it so that opening and closing curly braces line up, and that the statements inside curly braces are indented more. Archive Sketch - Archives a copy of the current sketch in.zip format. The archive is placed in the same directory as the sketch. Board - Select the board that you re using. Serial Port - This menu contains all the serial devices (real or virtual) on your machine. It should automatically refresh every time you open the top-level tools menu. Sketch A sketch is the name that Arduino uses for a program. It s the unit of code that is uploaded to and run on an Arduino board. Code The setup() function is called when a sketch starts. Use it to initialize variables, pin modes, start using libraries, etc. The setup function will only run once, after each powerup or reset of the Arduino board. After creating a setup() function, the loop() function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond as it runs. Code in the loop() section of your sketch is used to actively control the Arduino board. The code below won t actually do anything, but its structure is useful for copying and pasting to get you started on any sketch of your own. It also shows you how to make comments in your code. Any line that starts with two slashes (//) will not be read by the compiler, so you can write anything you want after it. Commenting your code like this can be particularly helpful in explaining, both to yourself and others, how your program functions step by step. void setup() { // put your setup code here, to run once: void loop() { // put your main code here, to run repeatedly: Arduino Layout The basic components on your Arduino board have been labelled below. These are the ones you will need to know about to get you started with Arduino. Input LED Digital Pins Reset Button Power LED USB Connection Microcontroller Chip Analog Pins Power Input Power Pins Oscillator
Image Painter Image Painter Toolbar Press backspace to clear the page Press i to invert your image Animation Generator Example This example will show you how to use the animator to create a stereo levels animation. Repeat this step until you are happy with your animation. You can skip between frames and edit them using the left and right keys. Want to draw images for your gamer but don t want to have to code it? The Image Painter allows you to create images using a piece of specially designed software which generates code from your drawings. Which you can then upload to your gamer. Hold shift and click with your mouse to erase. Press s to save Press c to copy to clipboard Example Wish that stick man you just drew could jump and run...now he can! The Animation Generator works very similarly to the Image Painter but allows you to combine single frames you ve drawn in order to create an animation. Start by opening your GamerAnimGenerator.pde file in Processing. Press open. Draw your first frame (run) and the sketch will Start by opening your GamerImagePainter.pde file in Processing. Press open. (run) and the sketch will Animation Generator Toolbar Draw your image Press i to invert your image Hold shift and click with your mouse to erase. Press s to save Press c to copy to clipboard Press + to add a blank frame Press Shift and f. This will duplicate the current frame. Then draw the next frame Press Shift and f to duplicate the current frame Press - to remove the current frame Once you ve drawn all your frames, preview your animation by pressing the spacebar. Made Hackney, London Then hit c to Copy your code to your clipboard. Then head to Ardunio open File > Examples > Gamer > Alien. Delete existing code between the lines: Gamer gamer and void setup() then paste your copied code from the clipboard here and hit Upload. Press x to start from scratch Left and Right keys navigate between frames Spacebar toggles playback Press h to toggle help bar Press backspace to clear Finally hit c to Copy your code to your clipboard. Then head to Ardunio and open - File > Examples > Gamer > Animationexample and delete existing code where it states. Replace this with yours! Then paste your copied code from the clipboard here and hit Upload.
Design your game Want to create an game for your DIY Gamer but want to map it out before you start coding it or inputting it into our animation software? These worksheets are for you to print off and use as templates to think about, design and sketch out frame by frame what you want your game to be. Use the spaces on this page to plan in detail your game. First things first! What is your game about? Is it a game with a spaceship, football game or puzzle game? Sketch out some ideas here... Ball, person or alien, every game needs characters. What are yours? What is the challenge or enemy in your game? What is the scoring system for when you crash your spaceship or solve a puzzle? Are there different levels to your game or does it endlessly scroll? What are the boundaries? What does your game look like/ what is the environment? Mars or Jupiter, Anfield or Wembley! How is the player going to interact with the game? What do the controls do? Will there be sound in your game? What will it be used for?
Design your game Use the boxes below to use bring your plans to life on your Gamer screen!
#include <Gamer.h> Gamer gamer; byte alien1[] = { B00000000, B00000000, B01111110, B01011010, B01111110, B00100100, B00100100, B01100110 ; byte alien2[] = { B01111110, B01011010, B01111110, B10100101, B11000011, B00000000, B00000000, B00000000 ; void setup() { gamer.begin(); gamer.printimage(alien1); void loop() { if(gamer.ispressed(up)) { gamer.printimage(frames[0]); //gamer.printimage(alien2); if(gamer.ispressed(down)) { gamer.printimage(alien1);