Lesson 70: Gates from switches
หน้านี้ต้องใช้เบราว์เซอร์ล่าสุด (รองรับ SharedArrayBuffer) กรุณาอัปเดต Chrome, Edge, Firefox หรือ Safari เป็นเวอร์ชันล่าสุด
English
Logic you can build
- Logic gates are made from tiny electronic switches. You can build the idea with two push buttons.
- Series: one button after the other. The current needs both: that is AND.
- Parallel: two buttons side by side. Either one is enough: that is OR.
| A | B | AND (series) | OR (parallel) |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |
- 1 means the button is pressed, or the LED is on.
- The 10 kΩ pull-down resistor makes D2 read 0 when no path to 5V is closed (lesson 25).
English
In the exam
- 0478/22/M/J/23 Q2: link each logic gate (AND, OR, NAND, NOT) to its standard symbol. AND has a flat back and a round front; OR has a curved back and a pointed front.
- Use the table above for the AND and OR truth tables. Lesson 42 tests all six gates with code.
ความยาก 3/5 · 200 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Build an AND gate from two buttons. Put them in series, one after the other, between the 5V row and the D2 row, and add a 10 kΩ pull-down resistor from D2 to GND (as in lesson 25). The sketch copies D2 to the LED on D13, which is already wired. The LED should light only when ทั้งสองอย่าง buttons are pressed.
คลิก Run เพื่อดูผลลัพธ์ที่นี่
ความยาก 3/5 · 200 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Now an OR gate: put the two buttons in parallel, side by side, each one from the 5V side to the D2 side. Keep the pull-down resistor. The LED should light when A หรือ B (or both) is pressed.
คลิก Run เพื่อดูผลลัพธ์ที่นี่