#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
int a=0;
int b=0;
const unsigned char number16x16_triangle[]=
{0x00,0x04,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x04,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,/*"三",0*/
0x20,0x10,0xE8,0x24,0x27,0x24,0x24,0xE4,0x24,0x34,0x2C,0x20,0xE0,0x00,0x00,0x00,0x80,0x60,0x1F,0x09,0x09,0x09,0x09,0x7F,
0x09,0x09,0x49,0x89,0x7F,0x00,0x00,0x00,/*"角",1*/
0x80,0x82,0x82,0xFE,0x82,0x82,0xFE,0x82,0x82,0x80,0x20,0x10,0x08,0x86,0x60,0x00,0x80,0x40,0x30,0x0F,0x00,0x00,0xFF,0x00,
0x00,0x80,0x84,0x42,0x21,0x10,0x0C,0x00};/*"形",2*/
void DisNumber0Snumberunittriangle(u8 pag ,u8 col)//三角形
{
/*u8 i,j;
for (i=0;i<2;i++)
{
SPI_lcd_WR_Byte(0xb0+pag+i,lcd_CMD);
SPI_lcd_WR_Byte((((col)&0xf0)>>4)|0x10,lcd_CMD);
SPI_lcd_WR_Byte(((col)&0x0f),lcd_CMD);
for(j=0;j<16;j++)
{
SPI_lcd_WR_Byte(number16x16_triangle[16*i+j],lcd_DATA);
}
j=0;
}*/
}
void setup() {
lcd.begin(16,2);
lcd.print("Hello World!");
pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(4,INPUT);
pinMode(5,INPUT);
pinMode(6,INPUT);
}
void loop() {
if (digitalRead(2) == 1)
{lcd.clear();
a++;
switch(a)
{
case 1:
lcd.print("scheme1");delay(500);
while(!digitalRead(2) == 1){
if (digitalRead(3) == 1)
{
lcd.clear(); lcd.print("Run: scheme1" );
}
}
case 2:
lcd.clear();
lcd.print("scheme2");delay(500);
while(!digitalRead(2) == 1){
if (digitalRead(3) == 1)
{
lcd.clear(); lcd.print("Run: scheme2");
}
}
case 3:
lcd.clear();
lcd.print("scheme3");delay(500);
while(!digitalRead(2) == 1){
if (digitalRead(3) == 1)
{
lcd.clear(); lcd.print("Run: scheme3");
}
}
case 4:
lcd.clear();
lcd.print("scheme4");delay(500);
while(!digitalRead(2) == 1){
if (digitalRead(3) == 1)
{
lcd.clear(); lcd.print("Run: scheme4");
}
}
case 5:
lcd.clear();
lcd.print("scheme5");delay(500);
while(!digitalRead(2) == 1){
if (digitalRead(3) == 1)
{
lcd.clear(); lcd.print("Run: scheme5");
}
}
case 6:
lcd.clear();
lcd.print("scheme6");delay(500);
while(!digitalRead(2) == 1){
if (digitalRead(3) == 1)
{
lcd.clear(); lcd.print("Run: scheme6");
}
}
case 7:
lcd.clear();
a=0;
lcd.print("");delay(500);
while(!digitalRead(2) == 1){;}
}
}
if (digitalRead(6) == 1)
{lcd.clear();
b++;
switch(b)
{
case 1:
lcd.print("mode1");delay(500);
while(!digitalRead(6) == 1){
if (digitalRead(4) == 1)
{
lcd.clear(); lcd.print("mode1--" );
}
if (digitalRead(5) == 1)
{
lcd.clear(); lcd.print("mode1++" );
}
}
case 2:
lcd.clear();
lcd.print("mode2");delay(500);
while(!digitalRead(6) == 1){
if (digitalRead(4) == 1)
{
lcd.clear(); lcd.print("mode2--" );
}
if (digitalRead(5) == 1)
{
lcd.clear(); lcd.print("mode2++" );
}
}
case 3:
lcd.clear();
lcd.print("mode3");delay(500);
while(!digitalRead(6) == 1){
if (digitalRead(4) == 1)
{
lcd.clear(); lcd.print("mode3--" );
}
if (digitalRead(5) == 1)
{
lcd.clear(); lcd.print("mode3++" );
}
}
case 4:
lcd.clear();
lcd.print("mode4");delay(500);
while(!digitalRead(6) == 1){
if (digitalRead(4) == 1)
{
lcd.clear(); lcd.print("mode4--" );
}
if (digitalRead(5) == 1)
{
lcd.clear(); lcd.print("mode4++" );
}
}
case 5:
lcd.clear();
lcd.print("mode5");delay(500);
while(!digitalRead(6) == 1){
if (digitalRead(4) == 1)
{
lcd.clear(); lcd.print("mode5--" );
}
if (digitalRead(5) == 1)
{
lcd.clear(); lcd.print("mode5++" );
}
}
case 6:
lcd.clear();
lcd.print("mode6");delay(500);
while(!digitalRead(6) == 1){
if (digitalRead(4) == 1)
{
lcd.clear(); lcd.print("mode6--" );
}
if (digitalRead(5) == 1)
{
lcd.clear(); lcd.print("mode6++" );
}
}
case 7:
lcd.clear();
b=0;
lcd.print("");delay(500);
while(!digitalRead(2) == 1){;}
}
}
/*
if (digitalRead(4) == 1)
{lcd.clear();
lcd.print("4");delay(500);
while(!digitalRead(4) == 0){;}}
if (digitalRead(5) == 1)
{lcd.clear();
lcd.print("5");delay(500);
while(!digitalRead(5) == 0){;}}
if (digitalRead(6) == 1)
{lcd.clear();
lcd.print("6");delay(500);
while(!digitalRead(6) == 0){;}}*/
}