<< 雛形 | top | 画像を表示する -Arduboy- >>

スポンサーサイト

一定期間更新がないため広告を表示しています

スポンサードリンク | - | | - | - |

ボタン判定

#include "Arduboy.h"

// make an instance of arduboy used for many functions
Arduboy arduboy;

 

// This function runs once in your game.
// use it for anything that needs to be set only once in your game.
void setup() {
  // initiate arduboy instance
  arduboy.begin();

  // here we set the framerate to 15, we do not need to run at
  // default 60 and it saves us battery life
  arduboy.setFrameRate(15);
}


// our main game loop, this runs once every cycle/frame.
// this is where our game logic goes.
void loop() {
  // pause render until it's time for the next frame
  if (!(arduboy.nextFrame()))
    return;

  // first we clear our screen to black
  arduboy.clear();

  // we set our cursor 5 pixels to the right and 10 down from the top
  // (positions start at 0, 0) 
  arduboy.setCursor(4, 9);

  // then we print to screen what is in the Quotation marks ""
  if( arduboy.pressed(A_BUTTON) == true ) 
  {
    arduboy.print(F("A!"));
  }
  else if(arduboy.pressed(B_BUTTON) == true)
  {
    arduboy.print("B!");
  }
  else arduboy.print("xxx");
    

  // then we finaly we tell the arduboy to display what we just wrote to the display
  arduboy.display();
}

 

ジャジャガッチ | Arduboy | 07:20 | comments(0) | trackbacks(0) |

スポンサーサイト

スポンサードリンク | - | 07:20 | - | - |
Comment









Trackback
URL:

08
--
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--
>>
<<
--
PR
RECOMMEND
RECENT COMMENT
MOBILE
qrcode
OTHERS
Since 2013/09/17
LATEST ENTRY
CATEGORY
ARCHIVE
LINKS
PROFILE
SEARCH