fork download
  1. // ルーレットが完成
  2.  
  3. /* pin assign
  4. * Digital_0 serial.begin で使用?(RX)
  5. * Digital_1 serial.begin で使用?(TX)
  6. * Digital_2 SW(interrputing)
  7. * Digital_3 DATA (NJU3711)
  8. * Digital_4 STR (NJU3711)
  9. * Digital_5 CK (NJU3711)
  10. * Digital_6 Kathode_1 (Tr)
  11. * Digital_7 Kathode_2 (Tr)
  12. * Digital_8 Kathode_3 (Tr)
  13. * Digital_9 Kathode_4 (Tr)
  14. * Digital_10 Kathode_5 (Tr)
  15. * Digital_11 Kathode_6 (Tr)
  16. * Digital_12 Kathode_7 (Tr)
  17. * Digital_13 Kathode_8 (Tr)
  18. */
  19.  
  20. /**************************************************
  21. *   端子、定数の定義 と ヘッダのインクルード *
  22. ***************************************************/
  23. #include <math.h> // sin, cos
  24.  
  25. #define DATA 3
  26. #define STR 4 //
  27. #define CK 5
  28. #define WIDTH_ 8 // マトリクスLEDのドット数
  29. #define HIGH_ 8 //
  30. #define Y0 6 // Y軸0~7列目に対応するピンを定義
  31. #define Y1 7 //
  32. #define Y2 8 //
  33. #define Y3 9 //
  34. #define Y4 10 //
  35. #define Y5 11 //
  36. #define Y6 12 //
  37. #define Y7 13 //
  38.  
  39. #define UPBUTTON 14
  40. #define DOWNBUTTON 15
  41. #define LEFTBUTTON 16
  42. #define RIGHTBUTTON 17
  43.  
  44. #define MODENUM 3 // 登録モードの数
  45.  
  46. #define MENU 0 // メニュー
  47. #define ROULETTE 1 // ルーレット(ツール)
  48. #define HAYAOSHI 2 // 早押し(ゲーム)
  49.  
  50. //#define M_PI 3.14159265358979323846
  51. #define SIN(x) sin(x * (M_PI/180))
  52. #define COS(x) cos(x * (M_PI/180))
  53.  
  54. /**************************************************
  55. *       グローバル変数 *
  56. ***************************************************/
  57. const char zero[HIGH_][WIDTH_] = { // 0
  58. {0,0,1,1,1,1,0,0},
  59. {0,1,0,0,0,0,1,0},
  60. {0,1,0,0,0,0,1,0},
  61. {0,1,0,0,0,0,1,0},
  62. {0,1,0,0,0,0,1,0},
  63. {0,1,0,0,0,0,1,0},
  64. {0,1,0,0,0,0,1,0},
  65. {0,0,1,1,1,1,0,0}
  66. };
  67. const char one[HIGH_][WIDTH_] = { // 1
  68. {0,0,0,0,0,0,0,0},
  69. {0,0,0,0,0,0,1,0},
  70. {0,0,0,0,0,0,1,0},
  71. {0,0,0,0,0,0,1,0},
  72. {0,0,0,0,0,0,1,0},
  73. {0,0,0,0,0,0,1,0},
  74. {0,0,0,0,0,0,1,0},
  75. {0,0,0,0,0,0,0,0}
  76. };
  77. const char two[HIGH_][WIDTH_] = { // 2
  78. {0,0,1,1,1,1,0,0},
  79. {0,0,0,0,0,0,1,0},
  80. {0,0,0,0,0,0,1,0},
  81. {0,0,0,0,0,0,1,0},
  82. {0,0,1,1,1,1,0,0},
  83. {0,1,0,0,0,0,0,0},
  84. {0,1,0,0,0,0,0,0},
  85. {0,0,1,1,1,1,0,0}
  86. };
  87. const char three[HIGH_][WIDTH_] = { // 3
  88. {0,0,1,1,1,1,0,0},
  89. {0,0,0,0,0,0,1,0},
  90. {0,0,0,0,0,0,1,0},
  91. {0,0,0,0,0,0,1,0},
  92. {0,0,1,1,1,1,0,0},
  93. {0,0,0,0,0,0,1,0},
  94. {0,0,0,0,0,0,1,0},
  95. {0,0,1,1,1,1,0,0}
  96. };
  97.  
  98. const char yajirusi[HIGH_][WIDTH_] = { // 矢印
  99. {0,0,0,1,1,0,0,0},
  100. {0,0,1,1,1,1,0,0},
  101. {0,1,0,1,1,0,1,0},
  102. {1,0,0,1,1,0,0,1},
  103. {0,0,0,1,1,0,0,0},
  104. {0,0,0,1,1,0,0,0},
  105. {0,0,0,1,1,0,0,0},
  106. {0,0,0,1,1,0,0,0}
  107. };
  108.  
  109. const char A[HIGH_][WIDTH_] = { // A
  110. {0,0,0,0,0,0,0,0},
  111. {0,1,1,1,1,1,1,0},
  112. {0,1,0,0,0,0,1,0},
  113. {0,1,0,0,0,0,1,0},
  114. {0,1,1,1,1,1,1,0},
  115. {0,1,0,0,0,0,1,0},
  116. {0,1,0,0,0,0,1,0},
  117. {0,1,0,0,0,0,1,0}
  118. };
  119.  
  120. const char M[HIGH_][WIDTH_] = { // M
  121. {0,0,0,0,0,0,0,0},
  122. {0,1,1,0,0,1,1,0},
  123. {0,1,0,1,1,0,1,0},
  124. {0,1,0,1,1,0,1,0},
  125. {0,1,0,1,1,0,1,0},
  126. {0,1,0,0,0,0,1,0},
  127. {0,1,0,0,0,0,1,0},
  128. {0,1,0,0,0,0,1,0}
  129. };
  130.  
  131. char ground[HIGH_][WIDTH_] = { // グラウンド
  132. {0,0,0,0,0,0,0,0},
  133. {0,0,0,0,0,0,0,0},
  134. {0,0,0,0,0,0,0,0},
  135. {0,0,0,0,0,0,0,0},
  136. {0,0,0,0,0,0,0,0},
  137. {0,0,0,0,0,0,0,0},
  138. {0,0,0,0,0,0,0,0},
  139. {0,0,0,0,0,0,0,0}
  140. };
  141.  
  142. volatile int flag = 0; // メニュートップ画面?で使用したような
  143. volatile int permission_sw = 0; // スイッチの入力の禁止と許可を制御(1:許可)
  144. volatile unsigned long time = 0; // 起動後の時間を記録する変数
  145. volatile int state; // メニューの選択画面の状態を記憶
  146. volatile int i_hayaosi = 0; // 早押:何個目の表示かを記憶する
  147. volatile int content_haya = 0; // 早押:状態を記憶(クリア・ミス入力)
  148. // 0:初期値, 1:クリア, 2:ミス
  149. int muki[10]; // 早押:ランダムな矢印の向きを記憶
  150.  
  151. /**************************************************
  152. *     GPIO等の初期設定 *
  153. ***************************************************/
  154. void setup()
  155. {
  156. pinMode(DATA, OUTPUT); // DATA
  157. pinMode(CK, OUTPUT); // CK
  158. pinMode(STR, OUTPUT); // STR
  159. pinMode(0, INPUT); // RX
  160. pinMode(1, OUTPUT); // TX
  161. pinMode(2, INPUT); // 変化割り込み 左右スイッチの論理和
  162.  
  163. pinMode(Y0, OUTPUT); // LEDアノード側制御ピン
  164. pinMode(Y1, OUTPUT); //
  165. pinMode(Y2, OUTPUT); //
  166. pinMode(Y3, OUTPUT); //
  167. pinMode(Y4, OUTPUT); //
  168. pinMode(Y5, OUTPUT); //
  169. pinMode(Y6, OUTPUT); //
  170. pinMode(Y7, OUTPUT); //
  171.  
  172. pinMode(14, INPUT); // スイッチ(上)
  173. pinMode(15, INPUT); // スイッチ(下)
  174. pinMode(16, INPUT); // スイッチ(左)
  175. pinMode(17, INPUT); // スイッチ(右)
  176. pinMode(18, INPUT); // ランダム関数の種
  177.  
  178. //-- 変化割り込みの初期設定
  179. attachInterrupt(0, interrupt, RISING); // 2番ピンを割り込みで使用
  180. permission_sw = 1; // 割り込みを許可
  181. //--
  182.  
  183. //-- シフトレジスタの初期設定
  184. digitalWrite(STR, HIGH); // シフトレジスタを出力しない
  185. digitalWrite(DATA, LOW); // シフトレジスタ データを0クリア
  186. clock(); clock(); clock(); clock();//
  187. clock(); clock(); clock(); clock();//
  188. digitalWrite(STR, LOW); // シフトレジスタを出力する
  189. //--
  190. //time = millis(); // プログラム開始時間を記録
  191. Serial.begin(9600);
  192.  
  193. startup(); // 起動時にAMAと図々しく表示
  194. roll(ground, zero, 0); // 起動直後のメニューは0を表示
  195. state = 0; // 表示が0であることを記憶
  196. }
  197.  
  198. /**************************************************
  199. *       loop関数 *
  200. ***************************************************/
  201. void loop()
  202. {
  203. switch(state){
  204. case MENU:
  205. menu(); //メニューを実行
  206. break;
  207. case ROULETTE:
  208. roulette(); // ルーレットを実行
  209. break;
  210. case HAYAOSHI:
  211. hayaoshi(); // 早押しゲームを実行
  212. flag = 0; // メニュー画面をループするようフラグを立てる
  213. state = MENU; // メニュー画面へ移行
  214. i_hayaosi = 0; // ゲームのプレイ情報を初期化
  215. content_haya = 0;
  216. break;
  217. default:
  218. break;
  219. }
  220. }
  221.  
  222. /**************************************************
  223. *       ユーザー定義関数 *
  224. ***************************************************/
  225.  
  226. //================= メ ニ ュ ー ===================
  227. void menu()
  228. {
  229. static int state1 = 0; // 初期状態は'0'を表示しているので0を代入
  230. while(flag == 0){ // メニューが選択されない限りループ
  231. if(state1 != state){ // 現在の表示データと異なる場合
  232. switch(state){
  233. case 0: // メニュー0ならば
  234. state1 = 0; // 現在の数字を '0' に変更
  235. roll(ground, zero, 0);// 表示データを '0' に変更
  236. break;
  237. case 1:
  238. state1 = 1; // 現在の数字を '1' に変更
  239. roll(ground, one, 0); // 表示データを '1' に変更
  240. break;
  241. case 2:
  242. state1 = 2; // 現在の数字を '2' に変更
  243. roll(ground, two, 0); // 表示データを '2' に変更
  244. break;
  245. }
  246. }
  247. draw_ground(); // 選択中の番号を表示する
  248. }
  249.  
  250. return;
  251. }
  252.  
  253. //================= 起 動 時 の エ フ ェ ク ト ===================
  254.  
  255. void startup()
  256. {
  257. int angle = 0;
  258. unsigned long time, margin;
  259.  
  260. for(angle = 0; angle <= 360; angle+=10){
  261. roll(ground, A, angle);
  262. draw_ground();
  263. }
  264.  
  265. time = millis();
  266. while(1){
  267. margin = millis() - time;
  268. if(margin > 500) break;
  269. draw_ground();
  270. }
  271.  
  272. for(angle = 0; angle <= 360; angle+=10){
  273. roll(ground, M, angle);
  274. draw_ground();
  275. }
  276.  
  277. time = millis();
  278. while(1){
  279. margin = millis() - time;
  280. if(margin > 500) break;
  281. draw_ground();
  282. }
  283.  
  284. for(angle = 0; angle <= 360; angle+=10){
  285. roll(ground, A, angle);
  286. draw_ground();
  287. }
  288.  
  289. time = millis();
  290. while(1){
  291. margin = millis() - time;
  292. if(margin > 500) break;
  293. draw_ground();
  294. }
  295. }
  296.  
  297. //=============== ル ー レ ッ ト の 処 理 ===================
  298. void roulette()
  299. {
  300. int angle;
  301. int i, time_r;
  302. int margin;
  303.  
  304. permission_sw = 0; // スイッチ入力を禁止
  305. randomSeed(analogRead(18)); // ランダム関数の種まき
  306. angle = 90 * random(0, 4); // 停止角度を決める(90~360)
  307. time_r = millis();
  308. roll(ground, yajirusi, 0);
  309. time_r = millis();
  310.  
  311. while(1){ // 2秒間めちゃくちゃな表示
  312. margin = millis() - time_r;
  313. if(margin > 2000) break; // 2秒以上経過で結果表示へ移行
  314. delayMicroseconds(10);
  315. roll(ground, yajirusi, 90 * random(0,4));
  316. draw_ground();
  317. }
  318. roll(ground, yajirusi, angle);
  319.  
  320. for(i = 0; i < 100; i++){ // 決定した状態をしばらく表示
  321. delayMicroseconds(100);
  322. draw_ground();
  323. }
  324. flag = 0; // メニュー画面をループするようフラグを立てる
  325. state = MENU; // メニュー画面へ移行
  326. permission_sw = 1; // スイッチ入力を許可
  327. return;
  328. }
  329.  
  330. //=============== 早 押 し ゲ ー ム の 処 理 ===================
  331. void hayaoshi()
  332. {
  333. int i;
  334. unsigned long time_haya, margin;
  335. permission_sw = 0; // スイッチ入力を禁止
  336. randomSeed(analogRead(18)); // ランダム関数の種まき
  337. //-- 矢印を決めるパラメータを10個得る
  338. for(i = 0; i < 5; i++){
  339. muki[i] = random(0, 4); // 0~3の値を得る
  340. }
  341.  
  342. //-- 開始までのカウント処理
  343. time_haya = millis(); // 現在の時間を記録
  344. while(1){
  345. margin = millis() - time_haya; // 経過時間を得る(ms)
  346. if(margin > 3000){ // 3秒以上経過
  347. break; // ゲームへ移行
  348. }else if(margin > 2000){ // 2秒以上経過(1を表示)
  349. roll(ground, one, 0);
  350. }else if(margin > 1000){ // 1秒以上経過(2を表示)
  351. roll(ground, two, 0); // 表示データに2をセット
  352. }else{ // 0秒以上経過(3を表示)
  353. roll(ground, three, 0); // 表示データに3をセット
  354. }
  355. draw_ground(); //
  356. }
  357. permission_sw = 1; // スイッチ入力を許可
  358.  
  359. //-- ゲーム開始
  360. time_haya = millis(); // ゲーム開始の時間を得る
  361. roll(ground, yajirusi, muki[i_hayaosi] * 90); // 最初の矢印を表示
  362.  
  363. while(1){ // このループ内でゲームを処理する
  364. draw_ground();
  365.  
  366. if(content_haya == 1){ // ゲームクリアの場合
  367. //gameclear(); // クリアした時間を出力 引数はタイム
  368. margin = millis() - time_haya; //クリアまでの経過時間を算出
  369. Serial.println(margin);
  370. break;
  371. }
  372. else if(content_haya == 2){ // ゲーム失敗の場合
  373. //gameretired(); // 失敗の表示
  374. break;
  375. }
  376. }
  377. }
  378.  
  379. //=================== スイッチ 割 り 込 み 処 理 ===================
  380. void interrupt()
  381. {
  382. static int angle = 0;
  383. unsigned long time2 = millis();
  384. if(permission_sw == 0) return; // スイッチ入力が許可されていなければリターン
  385. if(time2 - time < 200) return; // 前回の割り込み時間から100ms以上経過しているか
  386.  
  387. if(digitalRead(UPBUTTON)){ //-----上ボタンが押されたならば-----
  388. // メニュー表示中の処理
  389. if(flag != 1 && state != 0){ // メニュー画面以外のゲームが終了していれば実行
  390. // 選択中のメニューを決定する
  391. flag = 1; // メニュー画面を抜けるフラグを立てる
  392. return;
  393. }else if(state == HAYAOSHI){ // ○早押しゲームでの処理
  394. if(muki[i_hayaosi] == 0){
  395. i_hayaosi += 1; // 次の矢印のパラメータへ加算
  396. roll(ground, yajirusi, muki[i_hayaosi] * 90); //矢印を次の矢印に更新
  397. if(i_hayaosi == 5) content_haya = 1; // ゲームクリアを教える
  398. }else{
  399. content_haya = 2; // ゲーム失敗を教える
  400. }
  401. }
  402. }else if(digitalRead(DOWNBUTTON)){ //-----下ボタンが押されたならば-----
  403. if( flag == 0 ) return; // メニュー画面上での入力は無効
  404.  
  405. if( state == HAYAOSHI){ // ○早押しゲームでの処理
  406. if(muki[i_hayaosi] == 2){
  407. i_hayaosi ++; // 次の矢印のパラメータへ加算
  408. roll(ground, yajirusi, muki[i_hayaosi] * 90); //矢印を次の矢印に更新
  409. if(i_hayaosi == 5) content_haya = 1; // ゲームクリアを教える
  410. }else{
  411. content_haya = 2; // ゲーム失敗を教える
  412. }
  413. }
  414. }else if(digitalRead(LEFTBUTTON)){ //-----左ボタンが押されたならば-----
  415. if(state > 0 && flag == 0){ // メニュー表示中の処理
  416. state --; // メニューを-1する
  417. }else if(state == HAYAOSHI && flag == 1){ // ○早押しゲームでの処理
  418. if(muki[i_hayaosi] == 3){
  419. i_hayaosi ++; // 次の矢印のパラメータへ加算
  420. roll(ground, yajirusi, muki[i_hayaosi] * 90); //矢印を次の矢印に更新
  421. if(i_hayaosi == 5) content_haya = 1; // ゲームクリアを教える
  422. }else{
  423. content_haya = 2; // ゲーム失敗を教える
  424. }
  425. }
  426. }else if(digitalRead(RIGHTBUTTON)){ //-----右ボタンが押されたならば-----
  427. if(state < MODENUM-1 && flag == 0){ // メニュー表示中の処理
  428. state ++; // メニューを+1する
  429. }else if(state == HAYAOSHI && flag == 1){ // ○早押しゲームでの処理
  430. if(muki[i_hayaosi] == 1){
  431. i_hayaosi ++; // 次の矢印のパラメータへ加算
  432. roll(ground, yajirusi, muki[i_hayaosi] * 90); //矢印を次の矢印に更新
  433. if(i_hayaosi == 5) content_haya = 1; // ゲームクリアを教える
  434. }else{
  435. content_haya = 2; // ゲーム失敗を教える
  436. }
  437. }
  438. }
  439. time = time2;
  440. }
  441.  
  442. //===================ground配列をマトリクスLEDに描画===================
  443. void draw_ground()
  444. {
  445. for(int i = 0; i < 8; i++){ // 8列分列アノード側をシフトさせる。
  446. if(i==0){ // 1列目が参照されていたならば
  447. digitalWrite(DATA, HIGH); // HIGHをセットしてシフト
  448. clock();
  449. }else{ // 2列目以降が参照されていたならば
  450. digitalWrite(DATA, LOW); // 順次LOWをセットしてシフト
  451. clock();
  452. }
  453. digitalWrite(Y0, (ground[0][i]==1)?HIGH:LOW);
  454. digitalWrite(Y1, (ground[1][i]==1)?HIGH:LOW);
  455. digitalWrite(Y2, (ground[2][i]==1)?HIGH:LOW);
  456. digitalWrite(Y3, (ground[3][i]==1)?HIGH:LOW);
  457. digitalWrite(Y4, (ground[4][i]==1)?HIGH:LOW);
  458. digitalWrite(Y5, (ground[5][i]==1)?HIGH:LOW);
  459. digitalWrite(Y6, (ground[6][i]==1)?HIGH:LOW);
  460. digitalWrite(Y7, (ground[7][i]==1)?HIGH:LOW);
  461. delay(2);
  462. wipe_out_shadow(); // 列を切り替える前に表示を消すことで残像処理
  463. }
  464. }
  465.  
  466. //===================シフトレジスタへのクロック処理===================
  467. void clock()
  468. {
  469. digitalWrite(CK, LOW);
  470. delayMicroseconds(5);
  471. digitalWrite(CK, HIGH);
  472. delayMicroseconds(5);
  473. digitalWrite(CK, LOW);
  474. }
  475.  
  476. //===================ドットマトリクスLEDの残像処理===================
  477. void wipe_out_shadow()
  478. {
  479. digitalWrite(Y0, LOW);
  480. digitalWrite(Y1, LOW);
  481. digitalWrite(Y2, LOW);
  482. digitalWrite(Y3, LOW);
  483. digitalWrite(Y4, LOW);
  484. digitalWrite(Y5, LOW);
  485. digitalWrite(Y6, LOW);
  486. digitalWrite(Y7, LOW);
  487. }
  488.  
  489. //======引数の表示データを任意の角度に回転してground配列にセット=====
  490. void roll(char to[][8], const char from[][8], int angle)
  491. {
  492. int x, y;
  493. double x1 = 0.0, y1 = 0.0;
  494. if(angle == 0){ // 回転角度が0なら回転処理は行わない
  495. for (y = 0; y < 8; y++){
  496. for (x = 0; x < 8; x++){
  497. to[y][x] = from[y][x];
  498. }
  499. }
  500. }else{ // 回転処理
  501. for (y = 0; y < 8; y++){
  502. for (x = 0; x < 8; x++){
  503. x1 = ((x - 3.5) * COS(angle) - (y - 3.5) * SIN(angle));
  504. y1 = ((x - 3.5) * SIN(angle) + (y - 3.5) * COS(angle));
  505. x1 = x1 + 3.5; // ずらした座標を修正
  506. y1 = y1 + 3.5; //
  507.  
  508. if (from[y][x] == 1){
  509. if ((int)(x1 + 0.5) < WIDTH_ && (int)(y1 + 0.5) < HIGH_) to[(int)(y1 + 0.5)][(int)(x1 + 0.5)] = 1;
  510. }else{
  511. if ((int)(x1 + 0.5) < WIDTH_ && (int)(y1 + 0.5) < HIGH_) to[(int)(y1 + 0.5)][(int)(x1 + 0.5)] = 0;
  512. }
  513. }
  514. }
  515. }
  516. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function 'setup':
prog.c:156:3: warning: implicit declaration of function 'pinMode' [-Wimplicit-function-declaration]
   pinMode(DATA, OUTPUT);  // DATA
   ^
prog.c:156:17: error: 'OUTPUT' undeclared (first use in this function)
   pinMode(DATA, OUTPUT);  // DATA
                 ^
prog.c:156:17: note: each undeclared identifier is reported only once for each function it appears in
prog.c:159:14: error: 'INPUT' undeclared (first use in this function)
   pinMode(0, INPUT);      // RX
              ^
prog.c:179:3: warning: implicit declaration of function 'attachInterrupt' [-Wimplicit-function-declaration]
   attachInterrupt(0, interrupt, RISING);  // 2番ピンを割り込みで使用
   ^
prog.c:179:22: error: 'interrupt' undeclared (first use in this function)
   attachInterrupt(0, interrupt, RISING);  // 2番ピンを割り込みで使用
                      ^
prog.c:179:33: error: 'RISING' undeclared (first use in this function)
   attachInterrupt(0, interrupt, RISING);  // 2番ピンを割り込みで使用
                                 ^
prog.c:184:3: warning: implicit declaration of function 'digitalWrite' [-Wimplicit-function-declaration]
   digitalWrite(STR, HIGH);           // シフトレジスタを出力しない
   ^
prog.c:184:21: error: 'HIGH' undeclared (first use in this function)
   digitalWrite(STR, HIGH);           // シフトレジスタを出力しない
                     ^
prog.c:185:22: error: 'LOW' undeclared (first use in this function)
   digitalWrite(DATA, LOW);           // シフトレジスタ データを0クリア
                      ^
prog.c:186:3: warning: implicit declaration of function 'clock' [-Wimplicit-function-declaration]
   clock(); clock(); clock(); clock();//
   ^
prog.c:191:3: error: 'Serial' undeclared (first use in this function)
   Serial.begin(9600);
   ^
prog.c:193:3: warning: implicit declaration of function 'startup' [-Wimplicit-function-declaration]
   startup();       // 起動時にAMAと図々しく表示
   ^
prog.c:194:3: warning: implicit declaration of function 'roll' [-Wimplicit-function-declaration]
   roll(ground, zero, 0);             // 起動直後のメニューは0を表示
   ^
prog.c: In function 'loop':
prog.c:205:7: warning: implicit declaration of function 'menu' [-Wimplicit-function-declaration]
       menu();      //メニューを実行
       ^
prog.c:208:7: warning: implicit declaration of function 'roulette' [-Wimplicit-function-declaration]
       roulette();  // ルーレットを実行
       ^
prog.c:211:7: warning: implicit declaration of function 'hayaoshi' [-Wimplicit-function-declaration]
       hayaoshi();                // 早押しゲームを実行
       ^
prog.c: At top level:
prog.c:227:6: warning: conflicting types for 'menu'
 void menu()
      ^
prog.c:205:7: note: previous implicit declaration of 'menu' was here
       menu();      //メニューを実行
       ^
prog.c: In function 'menu':
prog.c:247:5: warning: implicit declaration of function 'draw_ground' [-Wimplicit-function-declaration]
     draw_ground();              // 選択中の番号を表示する
     ^
prog.c: At top level:
prog.c:255:6: warning: conflicting types for 'startup'
 void startup()
      ^
prog.c:193:3: note: previous implicit declaration of 'startup' was here
   startup();       // 起動時にAMAと図々しく表示
   ^
prog.c: In function 'startup':
prog.c:265:3: warning: implicit declaration of function 'millis' [-Wimplicit-function-declaration]
   time = millis();
   ^
prog.c: At top level:
prog.c:298:6: warning: conflicting types for 'roulette'
 void roulette()
      ^
prog.c:208:7: note: previous implicit declaration of 'roulette' was here
       roulette();  // ルーレットを実行
       ^
prog.c: In function 'roulette':
prog.c:305:3: warning: implicit declaration of function 'randomSeed' [-Wimplicit-function-declaration]
   randomSeed(analogRead(18));     // ランダム関数の種まき
   ^
prog.c:305:3: warning: implicit declaration of function 'analogRead' [-Wimplicit-function-declaration]
prog.c:306:3: warning: implicit declaration of function 'random' [-Wimplicit-function-declaration]
   angle = 90 * random(0, 4);      // 停止角度を決める(90~360)
   ^
prog.c:314:5: warning: implicit declaration of function 'delayMicroseconds' [-Wimplicit-function-declaration]
     delayMicroseconds(10);
     ^
prog.c: At top level:
prog.c:331:6: warning: conflicting types for 'hayaoshi'
 void hayaoshi()
      ^
prog.c:211:7: note: previous implicit declaration of 'hayaoshi' was here
       hayaoshi();                // 早押しゲームを実行
       ^
prog.c: In function 'hayaoshi':
prog.c:369:7: error: 'Serial' undeclared (first use in this function)
       Serial.println(margin);
       ^
prog.c: In function 'interrupt':
prog.c:387:3: warning: implicit declaration of function 'digitalRead' [-Wimplicit-function-declaration]
   if(digitalRead(UPBUTTON)){          //-----上ボタンが押されたならば-----
   ^
prog.c:382:14: warning: unused variable 'angle' [-Wunused-variable]
   static int angle = 0;
              ^
prog.c: At top level:
prog.c:443:6: warning: conflicting types for 'draw_ground'
 void draw_ground()
      ^
prog.c:247:5: note: previous implicit declaration of 'draw_ground' was here
     draw_ground();              // 選択中の番号を表示する
     ^
prog.c: In function 'draw_ground':
prog.c:445:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   for(int i = 0; i < 8; i++){      // 8列分列アノード側をシフトさせる。
   ^
prog.c:445:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
prog.c:447:26: error: 'HIGH' undeclared (first use in this function)
       digitalWrite(DATA, HIGH);    // HIGHをセットしてシフト
                          ^
prog.c:450:26: error: 'LOW' undeclared (first use in this function)
       digitalWrite(DATA, LOW);     // 順次LOWをセットしてシフト
                          ^
prog.c:461:5: warning: implicit declaration of function 'delay' [-Wimplicit-function-declaration]
     delay(2);
     ^
prog.c:462:5: warning: implicit declaration of function 'wipe_out_shadow' [-Wimplicit-function-declaration]
     wipe_out_shadow();              // 列を切り替える前に表示を消すことで残像処理
     ^
prog.c: At top level:
prog.c:467:6: warning: conflicting types for 'clock'
 void clock()
      ^
prog.c:186:3: note: previous implicit declaration of 'clock' was here
   clock(); clock(); clock(); clock();//
   ^
prog.c: In function 'clock':
prog.c:469:20: error: 'LOW' undeclared (first use in this function)
   digitalWrite(CK, LOW);
                    ^
prog.c:471:20: error: 'HIGH' undeclared (first use in this function)
   digitalWrite(CK, HIGH);
                    ^
prog.c: At top level:
prog.c:477:6: warning: conflicting types for 'wipe_out_shadow'
 void wipe_out_shadow()
      ^
prog.c:462:5: note: previous implicit declaration of 'wipe_out_shadow' was here
     wipe_out_shadow();              // 列を切り替える前に表示を消すことで残像処理
     ^
prog.c: In function 'wipe_out_shadow':
prog.c:479:22: error: 'LOW' undeclared (first use in this function)
     digitalWrite(Y0, LOW);
                      ^
prog.c: At top level:
prog.c:490:6: warning: conflicting types for 'roll'
 void roll(char to[][8], const char from[][8], int angle)
      ^
prog.c:194:3: note: previous implicit declaration of 'roll' was here
   roll(ground, zero, 0);             // 起動直後のメニューは0を表示
   ^
stdout
Standard output is empty