順番に実行させたいのですが、flip2のみ実行されてしまい
解決方法が分からず困っておりますので、どなたか分かる方
教えて頂けないでしょうか。よろしくお願いいたします。
#include "mbed.h"
Ticker flipper;
BusOut Col(dp3,dp6,dp7,dp8,dp9,dp10,dp11,dp12);
BusOut Row(dp15,dp16,dp17,dp18,dp19,dp20,dp21,dp22);
void flip()
{
uint8_t pt[][8] = {
{0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, //パターン1
{0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00}, //パターン2
{0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00}, //パターン3
{0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00}, //パターン4
{0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x00}, //パターン5
{0x00,0x40,0x40,0x40,0x00,0x00,0x00,0x00}, //パターン6
{0x00,0x00,0x40,0x40,0x40,0x00,0x00,0x00}, //パターン7
{0x40,0x00,0x00,0x40,0x40,0x40,0x00,0x00}, //パターン8
{0x00,0x40,0x00,0x00,0x40,0x40,0x40,0x00}, //パターン9
};
static int col = 0;
static int puttern = 0;
static int change = 0;
Row = 0;
Col = pt[puttern][col];
Row = 1 << col;
col++;
col %=8;
change--;
if(change <= 0) {
// パターンを切り替える
puttern++;
puttern %= sizeof(pt) / sizeof(*pt);
// 次に切り替えるまでの処理回数をセットする
change = 100;
}
}
//{0x00,0x00,0x40,0x00,0x00,0x40,0x40,0x40}, //パターン10
void flip2()
{
uint8_t pt[][8] = {
{0x00,0x00,0x00,0x40,0x00,0x00,0x40,0x40}, //パターン11
{0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x40,}, //パターン12
{0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,}, //パターン13
{0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,}, //パターン14
{0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x40,}, //パターン15
{0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,}, //パターン16
{0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,}, //パターン17
{0x00,0x08,0x08,0x08,0x00,0x00,0x00,0x00,}, //パターン18
{0x00,0x00,0x08,0x08,0x08,0x00,0x00,0x00,}, //パターン19
{0x08,0x00,0x00,0x08,0x08,0x08,0x00,0x00,}, //パターン20
{0x00,0x08,0x00,0x00,0x08,0x08,0x08,0x00,}, //パターン21
{0x00,0x00,0x08,0x00,0x00,0x08,0x08,0x08,}, //パターン22
{0x00,0x00,0x00,0x08,0x00,0x00,0x08,0x08,}, //パターン23
{0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x08,}, //パターン24
{0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,}, //パターン25
{0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,}, //パターン26
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,}, //パターン27
};
static int col = 0;
static int puttern = 0;
static int change = 0;
Row = 0;
Col = pt[puttern][col];
Row = 1 << col;
col++;
col %=8;
change--;
if(change <= 0) {
// パターンを切り替える
puttern++;
puttern %= sizeof(pt) / sizeof(*pt);
// 次に切り替えるまでの処理回数をセットする
change = 100;
}
}
int main()
{
flipper.attach(&flip,0.002);
flipper.attach(&flip2,0.002);
while(1) {
}
}