

บทเรียนที่ไม่มีชื่อ
Presentation
•
Instructional Technology
•
5th Grade
•
Hard
Godlike Tutor
Used 1+ times
FREE Resource
3 Slides • 0 Questions
1
By Godlike Tutor
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS]=
{
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {9,8,7,6};
byte colPins[COLS] = {5,4,3,2};
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup()
{
Serial.begin(9600);
}
void loop()
{
char key = keypad.getKey();
if (key != NO_KEY)
{
Serial.println(key);
}
}
2
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] =
{
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {9,8,7,6};
byte colPins[COLS] = {5,4,3,2};
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
// รหัสผ่านที่ต้องการ
const char correctPassword[] = "1234";
char enteredPassword[5]; // เก็บรหัสที่ผู้ใช้กรอก
byte passwordIndex = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
char key = keypad.getKey();
if (key != NO_KEY) {
// ถ้ากดปุ่ม *
if (key == '*') {
// รีเซ็ตรหัสผ่านที่กรอกแล้ว
passwordIndex = 0;
memset(enteredPassword, 0, sizeof(enteredPassword));
Serial.println("Password reset.");
}
// ถ้ากดปุ่ม #
else if (key == '#') {
// ตรวจสอบรหัสผ่านที่กรอก
enteredPassword[passwordIndex] = '\0'; // ใส่ null-terminator สำหรับการตรวจสอบ
if (strcmp(enteredPassword, correctPassword) == 0) {
Serial.println("Password Correct!");
} else {
Serial.println("Incorrect Password.");
}
// รีเซ็ตรหัสผ่านที่กรอกแล้ว
passwordIndex = 0;
memset(enteredPassword, 0, sizeof(enteredPassword));
}
// ถ้ากดปุ่มตัวเลข
else {
if (passwordIndex < 4) {
enteredPassword[passwordIndex] = key; // เก็บคีย์ที่กรอก
passwordIndex++;
Serial.print("Entered: ");
Serial.println(enteredPassword);
}
}
}
}
By Godlike Tutor
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS]=
{
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {9,8,7,6};
byte colPins[COLS] = {5,4,3,2};
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup()
{
Serial.begin(9600);
}
void loop()
{
char key = keypad.getKey();
if (key != NO_KEY)
{
Serial.println(key);
}
}
Show answer
Auto Play
Slide 1 / 3
SLIDE
Similar Resources on Wayground
5 questions
Consequences and Rules Assignment.
Presentation
•
5th Grade
6 questions
Health Term 4
Presentation
•
5th Grade
10 questions
The French and Indian War
Presentation
•
5th Grade
9 questions
Мэдээлэл технологи хичээл 6-р анги
Presentation
•
6th Grade
11 questions
Main idea Mystery
Presentation
•
4th - 5th Grade
10 questions
The Visit 2/1-2/4 Writing Practice
Presentation
•
4th Grade
3 questions
Pemanfaatan Akun Belajar
Presentation
•
KG
6 questions
Ella Fizgerarld
Presentation
•
5th Grade
Popular Resources on Wayground
11 questions
Hallway & Bathroom Expectations
Quiz
•
6th - 8th Grade
10 questions
HCS SCI 03 Summer School Assessment 2
Quiz
•
3rd Grade
11 questions
Home Scope
Quiz
•
7th - 8th Grade
12 questions
2026 TAP Technology in the Classroom
Presentation
•
Professional Development
15 questions
HCS SCI 05 Summer School Assessment 2 Review
Quiz
•
5th Grade
15 questions
HCS SCI 04 Summer School Review 2
Quiz
•
4th Grade
59 questions
Geometry Unit 3 Review
Quiz
•
9th - 12th Grade
14 questions
FAST ELA READING SMAPLE TEST MATERIALS
Passage
•
3rd Grade