Arduino-ILI9341驱动-SPI接口TFTLCD实现触摸功能系列之触控开关二
1.概述
这篇文章在触摸屏上绘制一个开关,通过点击开关实现控制灯的开关功能。
2.硬件
硬件连接参考第一篇文章介绍
Arduino-ILI9341驱动-SPI接口TFTLCD实现触摸功能系列之获取触控坐标一
3.实现触控开关效果
3.1.完整代码
首先给出实现点击屏幕实现开关状态改变的完整代码,然后在详细说明实现思路以及代码中每个部分的作用。
1.图标位图
在代码中开关图标是十六进制的位图,因此在字体取模软件PCtoLCD2002软件绘制开关图形即可,下面是绘制好的代码。
在主程序同路径下新建一个switch.c
文件然后将下面的内容复制到该文件中。
#ifdef __AVR__
#include <avr/pgmspace.h>
#elif defined(ESP8266)
#include <pgmspace.h>
#else
#define PROGMEM
#endif
const unsigned char switch_off_1[450] PROGMEM =
{ /* 0X00,0X10,0X0F,0X00,0X0F,0X00,0X01,0X1B, */
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0X79,0XCE,0XD7,0XBD,0X96,0XB5,0X96,0XB5,0X96,0XB5,
0XD7,0XBD,0X79,0XCE,0X9E,0XF7,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XB6,0XB5,0X38,0XC6,0X3C,0XE7,0X9E,0XF7,0X9E,0XF7,0X9E,0XF7,0X3C,0XE7,
0X38,0XC6,0XB6,0XB5,0X5D,0XEF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XB6,0XB5,
0X79,0XCE,0XBE,0XF7,0XDB,0XD6,0X39,0XC6,0X39,0XC6,0X39,0XC6,0XDB,0XDE,0XBE,0XF7,
0X79,0XCE,0X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,0XFF,0XFF,0XC7,0X39,0X28,0X42,0X08,0X42,0X28,0X42,0X30,0X84,
0X31,0X84,0X55,0XA5,0XFF,0XFF,0X9E,0XF7,0X92,0X8C,0X10,0X84,0X51,0X84,0X72,0X8C,
0XFF,0XFF,0XFF,0XFF,0X71,0X8C,0X51,0X84,0X10,0X84,0X92,0X94,0X9E,0XF7,0XFF,0XFF,
0X34,0XA5,0X31,0X84,0X10,0X84,0X28,0X42,0X08,0X42,0X28,0X42,0XC7,0X39,0X10,0X84,
0XFF,0XFF,0X28,0X42,0X49,0X4A,0X49,0X4A,0X28,0X42,0XEB,0X5A,0X30,0X84,0XDB,0XDE,
0XFF,0XFF,0XB6,0XB5,0XEF,0X7B,0X51,0X84,0X31,0X84,0X30,0X84,0X18,0XBE,0XF7,0XBD,
0X30,0X84,0X31,0X84,0X51,0X84,0XEF,0X7B,0XB7,0XB5,0XFF,0XFF,0XBA,0XD6,0X10,0X84,
0XEB,0X5A,0X28,0X42,0X49,0X4A,0X49,0X4A,0X28,0X42,0X2C,0X63,0XFF,0XFF,0X69,0X4A,
0X69,0X4A,0X69,0X4A,0X69,0X4A,0X49,0X4A,0X6D,0X6B,0XDF,0XFF,0XDF,0XFF,0X71,0X8C,
0X10,0X84,0X30,0X84,0X31,0X84,0X30,0X84,0XEF,0X7B,0XF0,0X7B,0X30,0X84,0X30,0X84,
0X30,0X84,0X10,0X7C,0X72,0X8C,0XFF,0XFF,0XBE,0XF7,0X4D,0X6B,0X49,0X4A,0X69,0X4A,
0X69,0X4A,0X69,0X4A,0X69,0X4A,0XEB,0X5A,0XFF,0XFF,0XAA,0X52,0XAA,0X52,0XAA,0X52,
0XAA,0X52,0X69,0X4A,0X4D,0X6B,0XFF,0XFF,0X5D,0XEF,0X10,0X84,0X10,0X84,0X10,0X84,
0X10,0X84,0X10,0X84,0X10,0X84,0X10,0X84,0X10,0X84,0X10,0X84,0X10,0X84,0X10,0X84,
0X10,0X84,0X7D,0XEF,0XFF,0XFF,0X2C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FF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
};
2.程序代码
#include <LCDWIKI_GUI.h> //Core graphics library
#include <LCDWIKI_SPI.h> //Hardware-specific library
#include <LCDWIKI_TOUCH.h> //touch screen library
#include "switch_font.c"
//定义TFT屏幕引脚
#define MODEL ILI9341
#define CS A5
#define RST A4
#define CD A3
#define MOSI 11
#define SCK 13
#define LED A0
#define MISO 12
// 定义TFT屏幕触控引脚
#define TCLK 3
#define TCS 2
#define TDIN 5
#define TDOUT 4
#define TIRQ 6
// 定义触控x和y轴后返回值的变量
uint16_t px, py;
// 定义颜色
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
// 定义开关变量初始值
boolean switch_flag_1 = true;
// 创造LCD对象
LCDWIKI_SPI my_lcd(MODEL, CS, CD, MISO, MOSI, RST, SCK, LED); //model,cs,dc,miso,mosi,reset,sck,led
// 创建触控对象
LCDWIKI_TOUCH my_touch(TCS, TCLK, TDOUT, TDIN, TIRQ); //tcs,tclk,tdout,tdin,tirq
/***************************************************************
* @brief 判断px和py触控的x轴和y轴坐标位置是否在矩形范围内
* @param x1:x轴坐标起点位置;x2:x轴终点位置;y1:y轴起点位置;y2:y轴终点位置;
* @param px:触控的x轴坐标;py:触控的y轴坐标
* @note 备注
**************************************************************/
boolean is_pressed(int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t px, int16_t py) {
if ((px > x1 && px < x2) && (py > y1 && py < y2)) {
return true;
} else {
return false;
}
}
/***************************************************************
* @brief 显示文本
* @param *str:文本内容;x,y:文本显示的x和y轴坐标位置;csize:字号;fc:文本颜色;bc:文本背景颜色;mode:文本模式
* @param
* @note
**************************************************************/
void show_string(uint8_t *str, int16_t x, int16_t y, uint8_t csize, uint16_t fc, uint16_t bc, boolean mode) {
my_lcd.Set_Text_Mode(mode);
my_lcd.Set_Text_Size(csize);
my_lcd.Set_Text_colour(fc);
my_lcd.Set_Text_Back_colour(bc);
my_lcd.Print_String(str, x, y);
}
/***************************************************************
* @brief 显示开关图标
* @param x1, y1, x2, y2设置图标可显示区域的窗口大小
* @param *color_buf:图标, int16_t buf_size:图标尺寸,
* @note
**************************************************************/
void show_picture(const uint8_t *color_buf, int16_t buf_size, int16_t x1, int16_t y1, int16_t x2, int16_t y2) {
my_lcd.Set_Addr_Window(x1, y1, x2, y2);
my_lcd.Push_Any_Color(color_buf, buf_size, 1, 1);
}
void setup() {
// 打开串口
Serial.begin(9600);
// 创建LCDWIKI_SPI对象
my_lcd.Init_LCD();
// 设置屏幕显示方向
my_lcd.Set_Rotation(0);
//创建LCDWIKI_TOUCH对象
my_touch.TP_Init(my_lcd.Get_Rotation(), my_lcd.Get_Display_Width(), my_lcd.Get_Display_Height());
// 设置触控方向
my_touch.TP_Set_Rotation(3);
//设置背景颜色
my_lcd.Fill_Screen(WHITE);
my_lcd.Set_Draw_color(192, 192, 192);
my_lcd.Draw_Fast_HLine(0, 3, my_lcd.Get_Display_Width());
// 绘制开关背景图形
show_picture(switch_on_2, sizeof(switch_on_2) / 2, 5, 5, 34, 34);
// 绘制开关文本内容和属性
show_string("switch is on ", 60, 11, 2, GREEN, BLACK, 1);
}
void loop() {
px = 0;
py = 0;
my_touch.TP_Scan(0);
/*
my_touch.TP_Get_State() & TP_PRES_DOWN 是一个位运算表达式,
它使用了按位与(bitwise AND)操作符 &。这个表达式通常用于检查TP_Get_State()
返回的触摸状态值中是否设置了特定的位(bit),这个位由TP_PRES_DOWN定义。
TP_PRES_DOWN通常被定义为类似0x01、0x02、0x04、0x08、0x10等的值,
这些值分别对应二进制中的0001、0010、0100、1000等。这些值只有一个位是1,其余位都是0。
这样,当使用按位与操作符时,只有TP_Get_State()返回的值的对应位也是1时,结果才不会是0。
如果没有这个判断,px = my_touch.x;会不断的获取坐标值,也就是说没有按压屏幕也会一直
输出坐标值
*/
if (my_touch.TP_Get_State() & TP_PRES_DOWN) {
// 获取触控后x、y轴坐标
px = my_touch.x;
py = my_touch.y;
Serial.print("触屏X轴坐标=");
Serial.println(px);
Serial.print("触屏Y轴坐标=");
Serial.println(py);
}
// 判断点击的位置如果在该按钮的范围内,则进入。
if (is_pressed(5, 5, 34, 34, px, py)) {
// 判断当前开关状态为true则进入if,否则进入else
if (switch_flag_1) {
// 显示关闭按钮图标
show_picture(switch_off_2, sizeof(switch_off_2) / 2, 5, 5, 34, 34);
// 设置颜色
my_lcd.Set_Draw_color(WHITE);
/***************************************************************
* @brief 绘制一个矩形框,该函数内部调用了Fill_Rect函数,该函数才是执行绘制矩形框函数。它从Set_Draw_color函数获取矩形框背景色
* @param x1,y1,x2,y2绘制矩形框x轴和y轴启动和终点
* @param
* @note
**************************************************************/
my_lcd.Fill_Rectangle(60, 11, 216, 27);
// 显示关闭文本
show_string("switch is off ", 60, 11, 2, RED, WHITE, 1);
// 修改开关全局状态为关闭
switch_flag_1 = false;
} else {
show_picture(switch_on_2, sizeof(switch_on_2) / 2, 5, 5, 34, 34);
my_lcd.Set_Draw_color(WHITE);
my_lcd.Fill_Rectangle(60, 11, 216, 27);
show_string("switch is on ", 60, 11, 2, GREEN, BLACK, 1);
switch_flag_1 = true;
}
delay(100);
}
}
3.2.实现思路
触控屏幕实现开关状态变化在思路上分成了两个支线,一条线是点亮屏幕后显示的初始化内容,另一个条线是点击屏幕后显示的内容。
1.初始化状态
在初始化状态需要显示两个类型的内容分别是文本
和开关图标
2.点击后状态
当点击屏幕后执行流程如下
- 首先判断屏幕是否被点击
- 判断点击屏幕x和y轴坐标值是否在开关按钮范围内
- 展示关闭按钮文本和关闭按钮图标
3.3.实现代码
1.初始化状态
封装显示文本函数
/***************************************************************
* @brief 显示文本
* @param *str:文本内容;x,y:文本显示的x和y轴坐标位置;csize:字号;fc:文本颜色;bc:文本背景颜色;mode:文本模式
* @param
* @note
**************************************************************/
void show_string(uint8_t *str, int16_t x, int16_t y, uint8_t csize, uint16_t fc, uint16_t bc, boolean mode) {
my_lcd.Set_Text_Mode(mode);
my_lcd.Set_Text_Size(csize);
my_lcd.Set_Text_colour(fc);
my_lcd.Set_Text_Back_colour(bc);
my_lcd.Print_String(str, x, y);
}
封装显示图标函数
/***************************************************************
* @brief 显示开关图标
* @param x1, y1, x2, y2设置图标可显示区域的窗口大小
* @param *color_buf:图标, int16_t buf_size:图标尺寸,
* @note
**************************************************************/
void show_picture(const uint8_t *color_buf, int16_t buf_size, int16_t x1, int16_t y1, int16_t x2, int16_t y2) {
my_lcd.Set_Addr_Window(x1, y1, x2, y2);
my_lcd.Push_Any_Color(color_buf, buf_size, 1, 1);
}
2.点击后状态
1.获取屏幕点击的坐标
/*
my_touch.TP_Get_State() & TP_PRES_DOWN 是一个位运算表达式,
它使用了按位与(bitwise AND)操作符 &。这个表达式通常用于检查TP_Get_State()
返回的触摸状态值中是否设置了特定的位(bit),这个位由TP_PRES_DOWN定义。
TP_PRES_DOWN通常被定义为类似0x01、0x02、0x04、0x08、0x10等的值,
这些值分别对应二进制中的0001、0010、0100、1000等。这些值只有一个位是1,其余位都是0。
这样,当使用按位与操作符时,只有TP_Get_State()返回的值的对应位也是1时,结果才不会是0。
如果没有这个判断,px = my_touch.x;会不断的获取坐标值,也就是说没有按压屏幕也会一直
输出坐标值
*/
if (my_touch.TP_Get_State() & TP_PRES_DOWN) {
// 获取触控后x、y轴坐标
px = my_touch.x;
py = my_touch.y;
Serial.print("触屏X轴坐标=");
Serial.println(px);
Serial.print("触屏Y轴坐标=");
Serial.println(py);
}
2.封装判断点击屏幕x和y轴坐标值是否在开关按钮范围内函数
/***************************************************************
* @brief 判断px和py触控的x轴和y轴坐标位置是否在矩形范围内
* @param x1:x轴坐标起点位置;x2:x轴终点位置;y1:y轴起点位置;y2:y轴终点位置;
* @param px:触控的x轴坐标;py:触控的y轴坐标
* @note 备注
**************************************************************/
boolean is_pressed(int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t px, int16_t py) {
if ((px > x1 && px < x2) && (py > y1 && py < y2)) {
return true;
} else {
return false;
}
}
3.改变文本和图标状态
if (is_pressed(5, 5, 34, 34, px, py)) {
// 判断当前开关状态为true则进入if,否则进入else
if (switch_flag_1) {
// 显示关闭按钮图标
show_picture(switch_off_2, sizeof(switch_off_2) / 2, 5, 5, 34, 34);
// 设置颜色
my_lcd.Set_Draw_color(WHITE);
/***************************************************************
* @brief 绘制一个矩形框,该函数内部调用了Fill_Rect函数,该函数才是执行绘制矩形框函数。它从Set_Draw_color函数获取矩形框背景色
* @param x1,y1,x2,y2绘制矩形框x轴和y轴启动和终点
* @param
* @note
**************************************************************/
my_lcd.Fill_Rectangle(60, 11, 216, 27);
// 显示关闭文本
show_string("switch is off ", 60, 11, 2, RED, WHITE, 1);
// 修改开关全局状态为关闭
switch_flag_1 = false;
} else {
show_picture(switch_on_2, sizeof(switch_on_2) / 2, 5, 5, 34, 34);
my_lcd.Set_Draw_color(WHITE);
my_lcd.Fill_Rectangle(60, 11, 216, 27);
show_string("switch is on ", 60, 11, 2, GREEN, BLACK, 1);
switch_flag_1 = true;
}
3.4.实验结果
初始状态屏幕显示打开状态
点击屏幕显示关闭状态
3.5.其他图案开关
学会了触控屏幕改变开关状态后,下面增加了几个开关图标的样式,完整代码如下。
#include <LCDWIKI_GUI.h> //Core graphics library
#include <LCDWIKI_SPI.h> //Hardware-specific library
#include <LCDWIKI_TOUCH.h> //touch screen library
#include "switch_font.c"
//定义TFT屏幕引脚
#define MODEL ILI9341
#define CS A5
#define RST A4
#define CD A3
#define MOSI 11
#define SCK 13
#define LED A0
#define MISO 12
// 定义TFT屏幕触控引脚
#define TCLK 3
#define TCS 2
#define TDIN 5
#define TDOUT 4
#define TIRQ 6
// 定义触控x和y轴后返回值的变量
uint16_t px, py;
// 定义颜色
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
// 定义开关变量初始值
boolean switch_flag_1 = true, switch_flag_2 = true, switch_flag_3 = true, switch_flag_4 = true, switch_flag_5 = true, switch_flag_6 = true;
// 创造LCD对象
LCDWIKI_SPI my_lcd(MODEL, CS, CD, MISO, MOSI, RST, SCK, LED); //model,cs,dc,miso,mosi,reset,sck,led
// 创建触控对象
LCDWIKI_TOUCH my_touch(TCS, TCLK, TDOUT, TDIN, TIRQ); //tcs,tclk,tdout,tdin,tirq
/***************************************************************
* @brief 判断px和py触控的x轴和y轴坐标位置是否在矩形范围内
* @param x1:x轴坐标起点位置;x2:x轴终点位置;y1:y轴起点位置;y2:y轴终点位置;
* @param px:触控的x轴坐标;py:触控的y轴坐标
* @note 备注
**************************************************************/
boolean is_pressed(int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t px, int16_t py) {
if ((px > x1 && px < x2) && (py > y1 && py < y2)) {
return true;
} else {
return false;
}
}
/***************************************************************
* @brief 显示文本
* @param *str:文本内容;x,y:文本显示的x和y轴坐标位置;csize:字号;fc:文本颜色;bc:文本背景颜色;mode:文本模式
* @param
* @note
**************************************************************/
void show_string(uint8_t *str, int16_t x, int16_t y, uint8_t csize, uint16_t fc, uint16_t bc, boolean mode) {
my_lcd.Set_Text_Mode(mode);
my_lcd.Set_Text_Size(csize);
my_lcd.Set_Text_colour(fc);
my_lcd.Set_Text_Back_colour(bc);
my_lcd.Print_String(str, x, y);
}
/***************************************************************
* @brief 显示开关图标
* @param x1, y1, x2, y2设置图标可显示区域的窗口大小
* @param *color_buf:图标, int16_t buf_size:图标尺寸,
* @note
**************************************************************/
void show_picture(const uint8_t *color_buf, int16_t buf_size, int16_t x1, int16_t y1, int16_t x2, int16_t y2) {
my_lcd.Set_Addr_Window(x1, y1, x2, y2);
my_lcd.Push_Any_Color(color_buf, buf_size, 1, 1);
}
void setup() {
// 打开串口
Serial.begin(9600);
// 创建LCDWIKI_SPI对象
my_lcd.Init_LCD();
// 设置屏幕显示方向
my_lcd.Set_Rotation(0);
//创建LCDWIKI_TOUCH对象
my_touch.TP_Init(my_lcd.Get_Rotation(), my_lcd.Get_Display_Width(), my_lcd.Get_Display_Height());
// 设置触控方向
my_touch.TP_Set_Rotation(3);
//设置背景颜色
my_lcd.Fill_Screen(WHITE);
my_lcd.Set_Draw_color(192, 192, 192);
my_lcd.Draw_Fast_HLine(0, 3, my_lcd.Get_Display_Width());
// 绘制开关背景图形
show_picture(switch_on_2, sizeof(switch_on_2) / 2, 5, 5, 34, 34);
// 绘制开关文本内容和属性
show_string("switch is on ", 60, 11, 2, GREEN, BLACK, 1);
my_lcd.Draw_Fast_HLine(0, 57, my_lcd.Get_Display_Width());
show_string("wifi setting", 5, 40, 2, BLACK, BLACK, 1);
show_picture(switch_on_3, sizeof(switch_on_3) / 2, 195, 40, 234, 54);
my_lcd.Draw_Fast_HLine(0, 57, my_lcd.Get_Display_Width());
show_string("bt setting", 5, 60, 2, BLACK, BLACK, 1);
show_picture(switch_on_3, sizeof(switch_on_3) / 2, 195, 60, 234, 74);
my_lcd.Draw_Fast_HLine(0, 77, my_lcd.Get_Display_Width());
show_string("auto time", 5, 80, 2, BLACK, BLACK, 1);
show_picture(switch_on_1, sizeof(switch_on_1) / 2, 204, 80, 218, 94);
my_lcd.Draw_Fast_HLine(0, 97, my_lcd.Get_Display_Width());
show_string("enable lock", 5, 100, 2, BLACK, BLACK, 1);
show_picture(switch_on_1, sizeof(switch_on_1) / 2, 204, 100, 218, 114);
}
void loop() {
px = 0;
py = 0;
my_touch.TP_Scan(0);
/*
my_touch.TP_Get_State() & TP_PRES_DOWN 是一个位运算表达式,
它使用了按位与(bitwise AND)操作符 &。这个表达式通常用于检查TP_Get_State()
返回的触摸状态值中是否设置了特定的位(bit),这个位由TP_PRES_DOWN定义。
TP_PRES_DOWN通常被定义为类似0x01、0x02、0x04、0x08、0x10等的值,
这些值分别对应二进制中的0001、0010、0100、1000等。这些值只有一个位是1,其余位都是0。
这样,当使用按位与操作符时,只有TP_Get_State()返回的值的对应位也是1时,结果才不会是0。
如果没有这个判断,px = my_touch.x;会不断的获取坐标值,也就是说没有按压屏幕也会一直
输出坐标值
*/
if (my_touch.TP_Get_State() & TP_PRES_DOWN) {
// 获取触控后x、y轴坐标
px = my_touch.x;
py = my_touch.y;
Serial.print("触屏X轴坐标=");
Serial.println(px);
Serial.print("触屏Y轴坐标=");
Serial.println(py);
}
// 判断点击的位置如果在该按钮的范围内,则进入。
if (is_pressed(5, 5, 34, 34, px, py)) {
// 判断当前开关状态为true则进入if,否则进入else
if (switch_flag_1) {
// 显示关闭按钮图标
show_picture(switch_off_2, sizeof(switch_off_2) / 2, 5, 5, 34, 34);
// 设置颜色
my_lcd.Set_Draw_color(WHITE);
/***************************************************************
* @brief 绘制一个矩形框,该函数内部调用了Fill_Rect函数,该函数才是执行绘制矩形框函数。它从Set_Draw_color函数获取矩形框背景色
* @param x1,y1,x2,y2绘制矩形框x轴和y轴启动和终点
* @param
* @note
**************************************************************/
my_lcd.Fill_Rectangle(60, 11, 216, 27);
// 显示关闭文本
show_string("switch is off ", 60, 11, 2, RED, WHITE, 1);
// 修改开关全局状态为关闭
switch_flag_1 = false;
} else {
show_picture(switch_on_2, sizeof(switch_on_2) / 2, 5, 5, 34, 34);
my_lcd.Set_Draw_color(WHITE);
my_lcd.Fill_Rectangle(60, 11, 216, 27);
show_string("switch is on ", 60, 11, 2, GREEN, BLACK, 1);
switch_flag_1 = true;
}
delay(100);
}
if (is_pressed(195, 40, 234, 54, px, py)) {
if (switch_flag_2) {
show_picture(switch_off_3, sizeof(switch_off_3) / 2, 195, 40, 234, 54);
switch_flag_2 = false;
} else {
show_picture(switch_on_3, sizeof(switch_on_3) / 2, 195, 40, 234, 54);
switch_flag_2 = true;
}
delay(100);
}
if (is_pressed(195, 60, 234, 74, px, py)) {
if (switch_flag_3) {
show_picture(switch_off_3, sizeof(switch_off_3) / 2, 195, 60, 234, 74);
switch_flag_3 = false;
} else {
show_picture(switch_on_3, sizeof(switch_on_3) / 2, 195, 60, 234, 74);
switch_flag_3 = true;
}
delay(100);
}
if (is_pressed(205, 81, 217, 93, px, py)) {
if (switch_flag_4) {
show_picture(switch_off_1, sizeof(switch_off_1) / 2, 204, 80, 218, 94);
switch_flag_4 = false;
} else {
show_picture(switch_on_1, sizeof(switch_on_1) / 2, 204, 80, 218, 94);
switch_flag_4 = true;
}
delay(100);
}
if (is_pressed(205, 101, 217, 113, px, py)) {
if (switch_flag_5) {
show_picture(switch_off_1, sizeof(switch_off_1) / 2, 204, 100, 218, 114);
switch_flag_5 = false;
} else {
show_picture(switch_on_1, sizeof(switch_on_1) / 2, 204, 100, 218, 114);
switch_flag_5 = true;
}
delay(100);
}
}
显示效果