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.
点击“运行”查看此处输出。
难度 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.
点击“运行”查看此处输出。