在接线编程语言(Arduino)中可以存储阵列中的位图吗?
boolean triangleMap[DISPLAY_HEIGHT][DISPLAY_WIDTH] = {
{0,0,0,1,1,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{1,1,1,1,1,1,1,1}
};
boolean squareMap[DISPLAY_HEIGHT][DISPLAY_WIDTH] = {
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1}
};
boolean symbols[] = {triangleMap, squareMap};
??? symbols [] = {triangleMap,squareMap};
错误:从'boolean()[8] {aka unsigned char ()[8]}'到'布尔{aka unsigned char}'[-fpermissive]
我不知道是否可以在 symbols 数组中存储 triangleMap 和 squareMap 位图?
非常感谢。
答案 0 :(得分:1)
您没有使用正确的类型。
boolean symbols[]
的意思是“我想要一个布尔数组”,而你想要的是“一系列布尔矩阵。所以这个
boolean symbols[][DISPLAY_HEIGHT][DISPLAY_WIDTH] = {triangleMap, squareMap};
应该有效
答案 1 :(得分:0)
抱歉,这不起作用:
字节符号[] [DISPLAY_HEIGHT] [DISPLAY_WIDTH] = {triangleMap, squareMap};
但是,这项工作:
byte symbols[][DISPLAY_HEIGHT][DISPLAY_WIDTH] ={
{ //triangle
{0,0,0,1,1,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{1,1,1,1,1,1,1,1}
},
{//square
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1}
},
{//cycle
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,1,0,0,0},
{0,0,0,1,1,1,0,0},
{0,0,0,0,1,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0}
}
};
非常感谢。