

บทเรียนที่ไม่มีชื่อ
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
8 questions
SI-A-09 - Unit 06
Presentation
•
6th Grade
3 questions
Unit 2 Week 5 Recording and INTERACTIVE Worksheet
Presentation
•
7th Grade
7 questions
blooket crypto hack
Presentation
•
3rd Grade
3 questions
Untitled Lesson
Presentation
•
6th Grade
6 questions
youtube
Presentation
•
4th Grade
7 questions
Theme of Story
Presentation
•
4th Grade
6 questions
Ασφάλεια στο διαδύκτιο lessons
Presentation
•
3rd - 5th Grade
1 questions
Cause/Effect of Texas Revolution
Presentation
•
4th Grade
Popular Resources on Wayground
10 questions
Safety Day 2026 – Student Review
Quiz
•
9th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
12 questions
Map Skills
Quiz
•
3rd Grade
22 questions
Continents and Oceans
Quiz
•
5th Grade
15 questions
Rounding Decimals
Quiz
•
5th Grade
Discover more resources for Instructional Technology
20 questions
Parts of Speech
Quiz
•
5th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
Continents and Oceans
Quiz
•
5th Grade
15 questions
Rounding Decimals
Quiz
•
5th Grade
10 questions
Columbus Day and Indigenous People's Day
Interactive video
•
5th - 8th Grade
20 questions
Mixtures and Solutions Practice
Quiz
•
5th Grade
15 questions
Mastering Multiplication Facts 1-10
Quiz
•
5th Grade