这应该对你来说很容易,但这对我来说是一种痛苦。我想从16到0计数,并在每一步显示和图像。
问题是它对Arduino来说太大了,我知道我可以改善其他条件,我尝试使用数组,但无法弄清楚如何:(
也许你可以帮助我实际的代码是以下一个(由于帖子的长度,我删除了一些图像的定义)
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
static const unsigned char PROGMEM logo16[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x00, 0x07, 0xFF, 0xFF, 0xFE, 0x00, 0x0F, 0xFF, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0x80, 0x20,
0x01, 0x00, 0x3F, 0xFF, 0xFF, 0xFF, 0xC0, 0x0F, 0xFF, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x20,
0x01, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0xE0, 0x1F, 0xFF, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x20,
0x01, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x1F, 0xFF, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x20,
0x01, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x3F, 0xFF, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x20,
0x01, 0x01, 0xFE, 0x00, 0x00, 0x07, 0xF8, 0x3F, 0x1F, 0x07, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x7F, 0x1F, 0x07, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x7E, 0x1F, 0x07, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0xFC, 0x1F, 0x07, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x1F, 0x07, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x1F, 0x07, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x20,
0x01, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x1F, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x20,
0x01, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x1F, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x20,
0x01, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x1F, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x20,
0x01, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x1F, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x20,
0x01, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x1F, 0x07, 0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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static const unsigned char PROGMEM logo00[] = {
0xFC, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F,
0xFC, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F,
0xFC, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F,
0xFC, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F,
0xFC, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F,
0xFC, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF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F, 0xFF, 0xFF, 0xFF, 0x8F,
0xFC, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F,
0xFC, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F
};
#define SSD1306_LCDHEIGHT 64
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
const int buttonPin = 2;
int buttonPushCounter = 0;
int buttonState = 0;
int lastButtonState = 0;
void setup() {
Serial.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.display();
delay(2000);
display.clearDisplay();
pinMode(buttonPin,INPUT);
display.drawBitmap(0,-15, logo16, 128,64,WHITE);
display.display();
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState != lastButtonState) {
if (buttonState == HIGH) {
buttonPushCounter++;
if (buttonPushCounter==1) {
display.clearDisplay();
display.drawBitmap(0,-15, logo16, 128,64,WHITE);
display.display();
delay(200);
}
else if (buttonPushCounter==2) {
display.clearDisplay();
display.drawBitmap(0,-15, logo15, 128,64,WHITE);
display.display();
delay(200);
}
else if (buttonPushCounter==3) {
display.clearDisplay();
display.drawBitmap(0,-15, logo14, 128,64,WHITE);
display.display();
delay(200);
}
else if (buttonPushCounter==4) {
display.clearDisplay();
display.drawBitmap(0,-15, logo13, 128,64,WHITE);
display.display();
delay(200);
}
else if (buttonPushCounter==5) {
display.clearDisplay();
display.drawBitmap(0,-15, logo12, 128,64,WHITE);
display.display();
delay(200);
}
else if (buttonPushCounter==6) {
display.clearDisplay();
display.drawBitmap(0,-15, logo11, 128,64,WHITE);
display.display();
delay(200);
}
else if (buttonPushCounter==7) {
display.clearDisplay();
display.drawBitmap(0,-15, logo10, 128,64,WHITE);
display.display();
delay(200);
}
else if (buttonPushCounter==8) {
display.clearDisplay();
display.drawBitmap(0,-15, logo09, 128,64,WHITE);
display.display();
delay(200);
}
else if (buttonPushCounter==9) {
display.clearDisplay();
display.drawBitmap(0,-15, logo08, 128,64,WHITE);
display.display();
delay(200);
}
else if (buttonPushCounter==10) {
display.clearDisplay();
display.drawBitmap(0,-15, logo07, 128,64,WHITE);
display.display();
delay(200);
}
else if (buttonPushCounter==11) {
display.clearDisplay();
display.drawBitmap(0,-15, logo06, 128,64,WHITE);
display.display();
delay(200);
}
else if (buttonPushCounter==12) {
display.clearDisplay();
display.drawBitmap(0,-15, logo05, 128,64,WHITE);
display.display();
delay(200);
}
else if (buttonPushCounter==13) {
display.clearDisplay();
display.drawBitmap(0,-15, logo04, 128,64,WHITE);
display.display();
delay(200);
}
else if (buttonPushCounter==14) {
display.clearDisplay();
display.drawBitmap(0,-15, logo03, 128,64,WHITE);
display.display();
delay(200);
}
else if (buttonPushCounter==15) {
display.clearDisplay();
display.drawBitmap(0,-15, logo02, 128,64,WHITE);
display.display();
delay(200);
}
else if (buttonPushCounter==16) {
display.clearDisplay();
display.drawBitmap(0,-15, logo01, 128,64,WHITE);
display.display();
delay(200);
}
else if (buttonPushCounter==17) {
display.clearDisplay();
display.drawBitmap(0,-15, logo00, 128,64,WHITE);
display.display();
delay(200);
display.clearDisplay();
display.drawBitmap(0,-15, logo00, 128,64,WHITE);
display.display();
delay(200);
display.clearDisplay();
display.drawBitmap(0,-15, logo00, 128,64,WHITE);
display.display();
delay(200);
display.clearDisplay();
display.drawBitmap(0,-15, logo00, 128,64,WHITE);
display.display();
delay(200);
}
}
else {
delay(50);
}
lastButtonState = buttonState;
}
}
答案 0 :(得分:0)
您可以为徽标定义数组数组。然后,您可以通过索引访问单独的徽标。以下(简化)代码显示了如何定义和访问此类数组:
public class ColumnInfo
{
public string ColumnName { get; set; }
public string DatabaseType { get; set; }
}
public static IEnumerable<ColumnInfo> GetColumnsInfo(Type linqTableClass)
{
Debug.WriteLine(string.Format("Table: {0}", linqTableClass.Name));
/// In-Case this has to grow in the future. Using a list for the arg names to search for.
/// The primary arg should be in position 0 of the array.
string dbTypeArgName = "DbType";
string fldPrimayName = "Storage";
string fldSecondaryName = "Name";
List<string> fldArgnames = new List<string>() { fldPrimayName, fldSecondaryName };
foreach (var fld in linqTableClass.GetProperties())
{
Debug.WriteLine(string.Format("Field Name: {0}", fld.Name));
foreach (var attr in fld.GetCustomAttributesData().Cast<CustomAttributeData>()
.Where(r => r.AttributeType == typeof(ColumnAttribute))
.Where(a => a.NamedArguments
.Select(n => n.MemberName)
.Intersect(fldArgnames)
.Any()))
{
var fldName = attr.NamedArguments.Where(r => r.MemberName == fldSecondaryName).Count() != 0
? attr.NamedArguments.Where(r => r.MemberName == fldSecondaryName).SingleOrDefault().TypedValue.Value.ToString()
: fld.Name;
var fldType = attr.NamedArguments
.Where(r => r.MemberName == dbTypeArgName)
.Select(r => r.TypedValue.Value.ToString())
.SingleOrDefault();
Debug.WriteLine(string.Format("\tTable Field Name {0} Table Type {1}", fldName, fldType));
yield return new ColumnInfo()
{
ColumnName = fldName,
DatabaseType = fldType,
};
}
}
}
希望它有所帮助。