Professional Documents
Culture Documents
1.1.0
1 Main Page 1
2 Individual Contributors 3
3 ArduBreakout 5
5 Tunes 9
6 Hierarchical Index 11
6.1 Class Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
8 File Index 15
8.1 File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
9.1.3.10 drawChar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
9.1.3.11 drawCircle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
9.1.3.12 drawCircleHelper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
9.1.3.13 drawFastHLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
9.1.3.14 drawFastVLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
9.1.3.15 drawLine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
9.1.3.16 drawPixel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
9.1.3.17 drawRect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
9.1.3.18 drawRoundRect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
9.1.3.19 drawSlowXYBitmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
9.1.3.20 drawTriangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
9.1.3.21 everyXFrames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
9.1.3.22 fillCircle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
9.1.3.23 fillCircleHelper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
9.1.3.24 fillRect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
9.1.3.25 fillRoundRect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
9.1.3.26 fillScreen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
9.1.3.27 fillTriangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
9.1.3.28 getBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
9.1.3.29 getPixel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
9.1.3.30 initRandomSeed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
9.1.3.31 nextFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
9.1.3.32 notPressed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
9.1.3.33 pressed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
9.1.3.34 rawADC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
9.1.3.35 setCursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
9.1.3.36 setFrameRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
9.1.3.37 setTextSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
9.1.3.38 setTextWrap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
9.1.3.39 start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
9.1.3.40 swap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
9.1.3.41 write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
9.1.4 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
9.1.4.1 audio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
9.1.4.2 cursor_x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
9.1.4.3 cursor_y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
9.1.4.4 eachFrameMillis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
9.1.4.5 frameCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
9.1.4.6 frameRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
9.1.4.7 lastFrameDurationMs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
9.1.4.8 lastFrameStart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
9.1.4.9 nextFrameStart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
9.1.4.10 post_render . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
9.1.4.11 sBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
9.1.4.12 textsize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
9.1.4.13 tunes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
9.1.4.14 wrap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
9.2 ArduboyAudio Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
9.2.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
9.2.2 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
9.2.2.1 begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
9.2.2.2 enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
9.2.2.3 off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
9.2.2.4 on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
9.2.2.5 saveOnOff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
9.2.3 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
9.2.3.1 audio_enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
9.3 ArduboyCore Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
9.3.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
9.3.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
9.3.2.1 ArduboyCore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
9.3.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
9.3.3.1 allPixelsOn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
9.3.3.2 blank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
9.3.3.3 boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
9.3.3.4 bootLCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
9.3.3.5 bootPins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
9.3.3.6 buttonsState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
9.3.3.7 flipHorizontal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
9.3.3.8 flipVertical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
9.3.3.9 getInput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
9.3.3.10 height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
9.3.3.11 idle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
9.3.3.12 invert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
9.3.3.13 LCDCommandMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
9.3.3.14 LCDDataMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
9.3.3.15 paint8Pixels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
9.3.3.16 paintScreen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
9.3.3.17 paintScreen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
9.3.3.18 safeMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
9.3.3.19 saveMuchPower . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
9.3.3.20 sendLCDCommand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
9.3.3.21 setRGBled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
9.3.3.22 slowCPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
9.3.3.23 width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
9.3.4 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
9.3.4.1 cspinmask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
9.3.4.2 csport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
9.3.4.3 dcpinmask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
9.3.4.4 dcport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
9.3.4.5 mosipinmask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
9.3.4.6 mosiport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
9.4 ArduboyTunes Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
9.4.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
9.4.2 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
9.4.2.1 closeChannels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
9.4.2.2 delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
9.4.2.3 initChannel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
9.4.2.4 playing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
9.4.2.5 playNote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
9.4.2.6 playScore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
9.4.2.7 soundOutput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
9.4.2.8 step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
9.4.2.9 stopNote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
9.4.2.10 stopScore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
9.4.2.11 tone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
9.5 Print Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
10 File Documentation 41
10.1 Arduboy/CONTRIBUTORS.md File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
10.2 Arduboy/examples/ArduBreakout/ArduBreakout.ino File Reference . . . . . . . . . . . . . . . . . 41
10.3 Arduboy/examples/ArduBreakout/breakout_bitmaps.cpp File Reference . . . . . . . . . . . . . . . 41
10.3.1 Variable Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
10.3.1.1 arrow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
10.3.1.2 fire . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
10.3.1.3 title . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
10.4 Arduboy/examples/ArduBreakout/breakout_bitmaps.h File Reference . . . . . . . . . . . . . . . . 42
10.4.1 Variable Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
10.4.1.1 arrow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
10.4.1.2 fire . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
10.4.1.3 title . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
10.5 Arduboy/examples/ArduBreakout/README.md File Reference . . . . . . . . . . . . . . . . . . . 42
10.6 Arduboy/examples/Performance/README.md File Reference . . . . . . . . . . . . . . . . . . . . 42
10.7 Arduboy/examples/Tunes/README.md File Reference . . . . . . . . . . . . . . . . . . . . . . . 43
10.8 Arduboy/README.md File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
10.9 Arduboy/examples/Buttons/Buttons.ino File Reference . . . . . . . . . . . . . . . . . . . . . . . . 43
10.9.1 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
10.9.1.1 CHAR_HEIGHT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
10.9.1.2 CHAR_WIDTH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
10.9.1.3 NUM_CHARS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
10.9.1.4 X_MAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
10.9.1.5 Y_MAX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
10.9.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
10.9.2.1 loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
10.9.2.2 setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
10.9.3 Variable Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
10.9.3.1 arduboy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
10.9.3.2 text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
10.9.3.3 x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
10.9.3.4 y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
10.10Arduboy/examples/HelloWorld/HelloWorld.ino File Reference . . . . . . . . . . . . . . . . . . . . 45
10.10.1 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
10.10.1.1 loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
10.10.1.2 setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
10.10.2 Variable Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
10.10.2.1 arduboy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
10.11Arduboy/examples/Tunes/Tunes.ino File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . 45
10.11.1 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
10.11.1.1 loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
10.11.1.2 setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
10.11.2 Variable Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
10.11.2.1 arduboy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
10.11.2.2 score . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
10.11.2.3 x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
10.11.2.4 y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
10.12Arduboy/src/ab_logo.c File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
10.12.1 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
10.12.1.1 ARDUBOY_LOGO_CREATED . . . . . . . . . . . . . . . . . . . . . . . . . . 47
10.12.2 Variable Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
10.12.2.1 arduboy_logo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
10.18.1.33RED_LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
10.18.1.34RIGHT_BUTTON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
10.18.1.35RST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
10.18.1.36RX_LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
10.18.1.37TX_LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
10.18.1.38UP_BUTTON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
10.18.1.39WHITE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
10.18.1.40WIDTH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
10.19Arduboy/src/glcdfont.c File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
10.19.1 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
10.19.1.1 FONT5X7_H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
10.19.2 Variable Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
10.19.2.1 PROGMEM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Main Page
This documentation provides provides instructions for installing and using the Arduboy Library.
The Arduboy Library provides a programming interface for the creation of games and applications that run on the
Arduboy handheld device. The Arduboy is supported by the Arduino platform and is powered by an Atmel A←-
Tmega32u4 MCU.
More information can be found at https://arduboy.com.
To use the Arduboy library, it must be installed and then included in your project.
There are several ways to install the Arduboy Library v1.1 for use in your projects. The recommended method, and
easiest to use when getting started, or when making simple apps, is through the Arduino IDE.
After installing the Arduino IDE, the Arduboy Library can be added using IDE's built in Library Manager.
The Library Manager can be found in the Arduino IDE's menu bar in the Sketch drop down menu, Sketch >
Include Library > Manage Libraries....
After opening the Library Manager, search for "Arduboy" in the search field, or find the library in the other category.
Download an Archive
Archived versions of the 1.1.0 release of the Arduboy Library can be downloaded and uncompressed. See the
sub-section Where to Install, found at the bottom of this section.
Install the library by cloning its repository. This will put you on the master branch, which is the newest version of
the library.
Where to Install
The library should be installed into your user's home Arduino libraries directory. Refer to the following list for
the location of the Arduino libraries folder.
##### Linux
1 /home/username/Documents/Arduino/libraries
##### Mac
1 /Users/username/Documents/Arduino/libraries
##### Windows
1 C:\Users\username\My Documents\Arduino\libraries
If you don't find the libraries folder in one of the above locations, you can determine its location using the
navigation menu File > Preferences. In the Settings tab will be a Sketchbook location: field.
The libraries folder will be in the folder set in this field.
To use the Arduboy library in your own sketches, include the Arduboy.h header file. To do so, add the following
line to the top of your .ino file.
#include <Arduboy.h>
You can have the Arduino IDE add #include "Arduboy.h" to your sketch automatically by using the naviga-
tion menu Sketch > Include Library > Arduboy.
Board Selection
Examples
Playing Examples
Find and play an example by opening it through the Arduino IDE, compiling, and uploading the example to the
Arduboy. Examples can be found in the Arduino IDE in the navigation menu under, File > Examples >
Arduboy > Example_Name.
To run this library on a development Arduboy board, edit src/core/core.h so that #define AB_DEVKIT
is uncommented and #define ARDUBOY_10 is commented out.
Sketches that include copies of the Arduboy library may not compile if the Arduboy library has been installed system
wide. In these cases the Arduino compiler will try and link the system Arduboy library source with the local header
file, which can cause compilation errors if the local library source differs from the system's Arduboy source.
To compile sketches that have included copies of the Aruboy Library,
• Remove the local Arduboy.cpp and Arduboy.h files and try recompiling. This will only work in some cases.
OR,
• Rename Arduboy.h to CustomArduboy.h (or a similar name) and add, #include "Custom←-
Arduboy.h" to the sketch's .ino file.
Individual Contributors
Contributors
• arduboychris - arduboychris
• Ross - rogosher
• Andrew - ace-dent
• NoelAbercrombie
ArduBreakout
An example using the Arduboy Library that simple prints "Hello, World!" to the screen.
10 Hello World Example
Tunes Example
Hierarchical Index
File Index
#include <Arduboy.h>
Inheritance diagram for Arduboy:
Collaboration diagram for Arduboy:
• Arduboy ()
• boolean pressed (uint8_t buttons)
Returns true if the button mask passed in is pressed.
• boolean notPressed (uint8_t buttons)
Returns true if the button mask passed in not pressed.
• void begin ()
Initializes the hardware.
• void beginNoLogo ()
Initializes the hardware (but with no boot logo)
• void start ()
• void bootLogo ()
Scrolls in the Arduboy logo.
• void bootUtils ()
Boot utils such as flashlight, etc.
• void clear ()
Clears display.
• void clearDisplay ()
• void display ()
Copies the contents of the screen buffer to the screen.
• void drawPixel (int x, int y, uint8_t color)
Sets a single pixel on the screen buffer to white or black.
• uint8_t getPixel (uint8_t x, uint8_t y)
• void drawCircle (int16_t x0, int16_t y0, uint8_t r, uint8_t color)
Draw a circle of a defined radius.
• void drawCircleHelper (int16_t x0, int16_t y0, uint8_t r, uint8_t cornername, uint8_t color)
Draws one or more "corners" of a circle.
• void fillCircle (int16_t x0, int16_t y0, uint8_t r, uint8_t color)
Draws a filled-in circle.
20 Data Structure Documentation
• void fillCircleHelper (int16_t x0, int16_t y0, uint8_t r, uint8_t cornername, int16_t delta, uint8_t color)
Draws one or both vertical halves of a filled-in circle.
• void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint8_t color)
Draws a line between two points.
• void drawRect (int16_t x, int16_t y, uint8_t w, uint8_t h, uint8_t color)
Draws a rectangle of a width and height.
• void drawFastVLine (int16_t x, int16_t y, uint8_t h, uint8_t color)
Draws vertical line.
• void drawFastHLine (int16_t x, int16_t y, uint8_t w, uint8_t color)
Draws a horizontal line.
• void fillRect (int16_t x, int16_t y, uint8_t w, uint8_t h, uint8_t color)
Draws a filled-in rectangle.
• void fillScreen (uint8_t color)
Fills the screen buffer with white or black.
• void drawRoundRect (int16_t x, int16_t y, uint8_t w, uint8_t h, uint8_t r, uint8_t color)
Draws a rectangle with rounded edges.
• void fillRoundRect (int16_t x, int16_t y, uint8_t w, uint8_t h, uint8_t r, uint8_t color)
Draws a filled-in rectangle with rounded edges.
• void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color)
Draws the outline of a triangle.
• void fillTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color)
Draws a filled-in triangle.
• void drawBitmap (int16_t x, int16_t y, const uint8_t ∗bitmap, uint8_t w, uint8_t h, uint8_t color)
Draws a bitmap from program memory to a specific X/Y.
• void drawSlowXYBitmap (int16_t x, int16_t y, const uint8_t ∗bitmap, uint8_t w, uint8_t h, uint8_t color)
Draws images that are bit-oriented horizontally.
• void drawChar (int16_t x, int16_t y, unsigned char c, uint8_t color, uint8_t bg, uint8_t size)
Draws an ASCII character at a point.
• void setCursor (int16_t x, int16_t y)
Sets the location of the screen cursor.
• void setTextSize (uint8_t s)
Set text size.
• void setTextWrap (boolean w)
Sets whether text will wrap at screen edges.
• unsigned char ∗ getBuffer ()
• virtual size_t write (uint8_t)
Writes a single ASCII character to the screen.
• void initRandomSeed ()
Seeds the random number generator with entropy from the temperature, voltage reading, and microseconds since
boot.
• void swap (int16_t &a, int16_t &b)
Swap the references of two pointers.
• void setFrameRate (uint8_t rate)
• bool nextFrame ()
• bool everyXFrames (uint8_t frames)
• int cpuLoad ()
Returns the load on the CPU as a percentage.
• uint16_t rawADC (byte adc_bits)
useful for getting raw approximate voltage values
Data Fields
• ArduboyTunes tunes
• ArduboyAudio audio
• uint8_t frameRate
• uint16_t frameCount
• uint8_t eachFrameMillis
• long lastFrameStart
• long nextFrameStart
• bool post_render
• uint8_t lastFrameDurationMs
Protected Attributes
9.1.2.1 Arduboy::Arduboy ( )
Clears display.
Definition at line 167 of file Arduboy.cpp.
References BLACK, and fillScreen().
Referenced by bootLogo(), clearDisplay(), displayHighScores(), enterInitials(), intro(), loop(), and titleScreen().
Here is the call graph for this function:
Here is the caller graph for this function:
This is based on how much of the time your app is spends rendering frames. This number can be higher than 100
if your app is rendering really slowly.
Definition at line 133 of file Arduboy.cpp.
References eachFrameMillis, and lastFrameDurationMs.
9.1.3.9 void Arduboy::drawBitmap ( int16_t x, int16_t y, const uint8_t ∗ bitmap, uint8_t w, uint8_t h, uint8_t color )
9.1.3.10 void Arduboy::drawChar ( int16_t x, int16_t y, unsigned char c, uint8_t color, uint8_t bg, uint8_t size )
9.1.3.11 void Arduboy::drawCircle ( int16_t x0, int16_t y0, uint8_t r, uint8_t color )
9.1.3.12 void Arduboy::drawCircleHelper ( int16_t x0, int16_t y0, uint8_t r, uint8_t cornername, uint8_t color )
9.1.3.15 void Arduboy::drawLine ( int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint8_t color )
9.1.3.18 void Arduboy::drawRoundRect ( int16_t x, int16_t y, uint8_t w, uint8_t h, uint8_t r, uint8_t color )
9.1.3.19 void Arduboy::drawSlowXYBitmap ( int16_t x, int16_t y, const uint8_t ∗ bitmap, uint8_t w, uint8_t h, uint8_t color )
9.1.3.20 void Arduboy::drawTriangle ( int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color )
9.1.3.22 void Arduboy::fillCircle ( int16_t x0, int16_t y0, uint8_t r, uint8_t color )
9.1.3.23 void Arduboy::fillCircleHelper ( int16_t x0, int16_t y0, uint8_t r, uint8_t cornername, int16_t delta, uint8_t color )
9.1.3.25 void Arduboy::fillRoundRect ( int16_t x, int16_t y, uint8_t w, uint8_t h, uint8_t r, uint8_t color )
9.1.3.27 void Arduboy::fillTriangle ( int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color )
Seeds the random number generator with entropy from the temperature, voltage reading, and microseconds since
boot.
This method is still most effective when called semi-randomly such as after a user hits a button to start a game or
other semi-random events
Definition at line 138 of file Arduboy.cpp.
References ADC_TEMP, ADC_VOLTAGE, and rawADC().
Here is the call graph for this function:
As mentioned in drawChar(), individual ASCII characters are 6x8 pixels (5x7 with spacing on two edges). The size
is a pixel multiplier, so a size of 2 means each character will be 12x16, etc.
Definition at line 696 of file Arduboy.cpp.
References textsize.
Referenced by setup(), and titleScreen().
Here is the caller graph for this function:
• Arduboy/src/Arduboy.h
• Arduboy/src/Arduboy.cpp
#include <audio.h>
Collaboration diagram for ArduboyAudio:
• Arduboy/src/audio/audio.h
• Arduboy/src/audio/audio.cpp
#include <core.h>
Inheritance diagram for ArduboyCore:
Collaboration diagram for ArduboyCore:
• ArduboyCore ()
• void setRGBled (uint8_t red, uint8_t green, uint8_t blue)
set the light output of the RGB LEB
9.3.2.1 ArduboyCore::ArduboyCore ( )
Hi Low
DevKit 00000000 - reserved -DLU-RAB D down U up 1.0 00000000 L left URLDAB– R right
Of course you shouldn't worry about bits (they may change with future hardware revisions) and should instead use
the button defines: LEFT_BUTTON, A_BUTTON, UP_BUTTON, etc.
• https://www.adafruit.com/datasheets/SSD1306.pdf
• http://www.eimodule.com/download/SSD1306-OLED-Controller.pdf
Safe mode.
Safe Mode is engaged by holding down both the LEFT button and UP button when plugging the device into USB. It
puts your device into a tight loop and allows it to be reprogrammed even if you have uploaded a very broken sketch
that interferes with the normal USB triggered auto-reboot functionality of the device.
This is most useful on Devkits because they lack a built-in reset button.
Definition at line 176 of file core.cpp.
References blank().
Referenced by boot().
Here is the call graph for this function:
Here is the caller graph for this function:
Referenced by boot().
Here is the caller graph for this function:
• Arduboy/src/core/core.h
• Arduboy/src/core/core.cpp
#include <audio.h>
Collaboration diagram for ArduboyTunes:
Delay in milliseconds.
Referenced by loop().
Here is the call graph for this function:
Here is the caller graph for this function:
• Arduboy/src/audio/audio.h
• Arduboy/src/audio/audio.cpp
• Arduboy/src/Arduboy.h
File Documentation
#include "Arduboy.h"
#include "breakout_bitmaps.h"
#include "pins_arduino.h"
Include dependency graph for ArduBreakout.ino:
#include "breakout_bitmaps.h"
Include dependency graph for breakout_bitmaps.cpp:
Variables
Initial value:
=
{
5,5,
0x20,
0x10,
0xF8,
0x10,
0x20,
}
Initial value:
=
{
57,8,
0xF8,0x00,0x00,0x00,0x3D,0xEF,0x8F,0x80,
0xCC,0x00,0x00,0x00,0x60,0xCC,0xD8,0x00,
0xCC,0x00,0x00,0x00,0x60,0xCC,0xD8,0x00,
0xF9,0x67,0x1E,0x78,0x78,0xCF,0x9F,0x00,
0xC1,0x8C,0xA0,0x80,0x60,0xCC,0xD8,0x00,
0xC1,0x8F,0x1C,0x70,0x60,0xCC,0xD8,0x00,
0xC1,0x8C,0x02,0x08,0x60,0xCC,0xDF,0x80,
0xC1,0x87,0xBC,0xF0,0x61,0xEC,0xCF,0x80,
}
#include <avr/pgmspace.h>
Include dependency graph for breakout_bitmaps.h: This graph shows which files directly or indirectly include this
file:
Variables
#include "Arduboy.h"
Include dependency graph for Buttons.ino:
Macros
• #define CHAR_WIDTH 6
• #define CHAR_HEIGHT 8
• #define NUM_CHARS (sizeof(text) - 1)
• #define X_MAX (WIDTH - (NUM_CHARS ∗ CHAR_WIDTH) + 1)
• #define Y_MAX (HEIGHT - CHAR_HEIGHT)
Functions
• void setup ()
• void loop ()
Variables
• Arduboy arduboy
• char text [ ] = "Press Buttons!"
• byte x
• byte y
10.9.3.3 byte x
10.9.3.4 byte y
#include "Arduboy.h"
Include dependency graph for HelloWorld.ino:
Functions
• void setup ()
• void loop ()
Variables
• Arduboy arduboy
#include "Arduboy.h"
Include dependency graph for Tunes.ino:
Functions
• void setup ()
• void loop ()
Variables
10.11.2.3 int x = 0
10.11.2.4 int y = 0
#include <avr/pgmspace.h>
Include dependency graph for ab_logo.c: This graph shows which files directly or indirectly include this file:
Macros
• #define ARDUBOY_LOGO_CREATED
Variables
Initial value:
= {
0xF0, 0xF8, 0x9C, 0x8E, 0x87, 0x83, 0x87, 0x8E, 0x9C, 0xF8,
0xF0, 0x00, 0x00, 0xFE, 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03,
0x07, 0x0E, 0xFC, 0xF8, 0x00, 0x00, 0xFE, 0xFF, 0x03, 0x03,
0x03, 0x03, 0x03, 0x07, 0x0E, 0xFC, 0xF8, 0x00, 0x00, 0xFF,
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
0x00, 0x00, 0xFE, 0xFF, 0x83, 0x83, 0x83, 0x83, 0x83, 0xC7,
0xEE, 0x7C, 0x38, 0x00, 0x00, 0xF8, 0xFC, 0x0E, 0x07, 0x03,
0x03, 0x03, 0x07, 0x0E, 0xFC, 0xF8, 0x00, 0x00, 0x3F, 0x7F,
0xE0, 0xC0, 0x80, 0x80, 0xC0, 0xE0, 0x7F, 0x3F, 0xFF, 0xFF,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xFF, 0xFF, 0x00,
0x00, 0xFF, 0xFF, 0x0C, 0x0C, 0x0C, 0x0C, 0x1C, 0x3E, 0x77,
0xE3, 0xC1, 0x00, 0x00, 0x7F, 0xFF, 0xC0, 0xC0, 0xC0, 0xC0,
0xC0, 0xE0, 0x70, 0x3F, 0x1F, 0x00, 0x00, 0x1F, 0x3F, 0x70,
0xE0, 0xC0, 0xC0, 0xC0, 0xE0, 0x70, 0x3F, 0x1F, 0x00, 0x00,
0x7F, 0xFF, 0xC1, 0xC1, 0xC1, 0xC1, 0xC1, 0xE3, 0x77, 0x3E,
0x1C, 0x00, 0x00, 0x1F, 0x3F, 0x70, 0xE0, 0xC0, 0xC0, 0xC0,
0xE0, 0x70, 0x3F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00
#include "Arduboy.h"
#include "glcdfont.c"
#include "ab_logo.c"
Include dependency graph for Arduboy.cpp:
#include "core/core.h"
#include <SPI.h>
#include <Print.h>
#include <limits.h>
#include "audio/audio.h"
Include dependency graph for Arduboy.h: This graph shows which files directly or indirectly include this file:
Data Structures
• class Arduboy
Macros
• #define EEPROM_VERSION 0
• #define EEPROM_BRIGHTNESS 1
• #define EEPROM_AUDIO_ON_OFF 2
• #define EEPROM_STORAGE_SPACE_START 16
• #define PIXEL_SAFE_MODE
• #define ADC_VOLTAGE (_BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1))
• #define ADC_TEMP (_BV(REFS0) | _BV(REFS1) | _BV(MUX2) | _BV(MUX1) | _BV(MUX0))
#include "Arduboy.h"
#include "audio.h"
Include dependency graph for audio.cpp:
Functions
• ISR (TIMER1_COMPA_vect)
• ISR (TIMER3_COMPA_vect)
Variables
Initial value:
= {
16,17,18,19,21,22,23,24,26,28,29,31,33,35,37,39,41,44,46,49,52,55,58,62,65,
69,73,78,82,87,92,98,104,110,117,123,131,139,147,156,165,175,185,196,208,220,
233,247
}
Initial value:
= {
262,277,294,311,330,349,370,392,415,440,466,494,523,554,587,622,659,
698,740,784,831,880,932,988,1047,1109,1175,1245,1319,1397,1480,1568,1661,1760,
1865,1976,2093,2217,2349,2489,2637,2794,2960,3136,3322,3520,3729,3951,4186,
4435,4699,4978,5274,5588,5920,6272,6645,7040,7459,7902,8372,8870,9397,9956,
10548,11175,11840,12544,13290,14080,14917,15804,16744,17740,18795,19912,21096,
22351,23680,25088 }
#include <Arduino.h>
#include <EEPROM.h>
#include <avr/pgmspace.h>
#include <avr/power.h>
Include dependency graph for audio.h: This graph shows which files directly or indirectly include this file:
Data Structures
• class ArduboyAudio
• class ArduboyTunes
Macros
• #define AVAILABLE_TIMERS 2
• #define TUNE_OP_PLAYNOTE 0x90 /∗ play a note: low nibble is generator #, note is next byte ∗/
• #define TUNE_OP_STOPNOTE 0x80 /∗ stop a note: low nibble is generator # ∗/
• #define TUNE_OP_RESTART 0xe0 /∗ restart the score from the beginning ∗/
• #define TUNE_OP_STOP 0xf0 /∗ stop playing ∗/
10.16.1.2 #define TUNE_OP_PLAYNOTE 0x90 /∗ play a note: low nibble is generator #, note is next byte ∗/
10.16.1.3 #define TUNE_OP_RESTART 0xe0 /∗ restart the score from the beginning ∗/
#include "core.h"
Include dependency graph for core.cpp:
Macros
Variables
Initial value:
= {
PIN_LEFT_BUTTON, INPUT_PULLUP,
PIN_RIGHT_BUTTON, INPUT_PULLUP,
PIN_UP_BUTTON, INPUT_PULLUP,
PIN_DOWN_BUTTON, INPUT_PULLUP,
PIN_A_BUTTON, INPUT_PULLUP,
PIN_B_BUTTON, INPUT_PULLUP,
DC, OUTPUT,
CS, OUTPUT,
RST, OUTPUT,
0
}
#include <avr/power.h>
#include <SPI.h>
#include <avr/sleep.h>
#include <limits.h>
Include dependency graph for core.h: This graph shows which files directly or indirectly include this file:
Data Structures
• class ArduboyCore
Macros
• #define ARDUBOY_10
defaults to Arduboy Release 1.0 if not using a boards.txt file
• #define CS 12
• #define DC 4
• #define RST 6
• #define RED_LED 10
• #define GREEN_LED 11
• #define BLUE_LED 9
• #define TX_LED 30
• #define RX_LED 17
• #define PIN_LEFT_BUTTON A2
• #define PIN_RIGHT_BUTTON A1
• #define PIN_UP_BUTTON A0
• #define PIN_DOWN_BUTTON A3
• #define PIN_A_BUTTON 7
• #define PIN_B_BUTTON 8
• #define LEFT_BUTTON _BV(5)
• #define RIGHT_BUTTON _BV(6)
• #define UP_BUTTON _BV(7)
• #define DOWN_BUTTON _BV(4)
• #define A_BUTTON _BV(3)
• #define B_BUTTON _BV(2)
• #define PIN_SPEAKER_1 5
• #define PIN_SPEAKER_2 13
• #define PIN_SPEAKER_1_PORT &PORTC
• #define PIN_SPEAKER_2_PORT &PORTC
• #define PIN_SPEAKER_1_BITMASK _BV(6)
• #define PIN_SPEAKER_2_BITMASK _BV(7)
• #define OLED_PIXELS_INVERTED 0xA7
• #define OLED_PIXELS_NORMAL 0xA6
// #define ARDUBOY_10
#define AB_DEVKIT
10.18.1.7 #define CS 12
10.18.1.8 #define DC 4
#include <avr/io.h>
#include <avr/pgmspace.h>
Include dependency graph for glcdfont.c: This graph shows which files directly or indirectly include this file:
Macros
• #define FONT5X7_H
Variables