|
194 | 194 | "---\n", |
195 | 195 | "Schematic of a button with a pull-up resistor connected to an LED in two configurations\n", |
196 | 196 | "```\n", |
197 | | - "Consider [Task B2](Task_B2_2_1), for configuration A and configuration B, predict what the LED will do when the button is not pressed and when the button is pressed. \n", |
| 197 | + "Consider [Task B2](Task_B2_2_1), for configuration A and configuration B. Predict what the LED will do when the button is not pressed and when the button is pressed. \n", |
198 | 198 | "\n", |
199 | 199 | "Recall [Task B4](Task_B4_2_1). What is the default output (when the button is not pressed) of a button in a pull-down configuration? What is the output when a button in a pull-down configuration is pressed?\n", |
200 | 200 | "\n", |
|
208 | 208 | "Schematic of a button with a pull-down resistor connected to an LED in two configurations\n", |
209 | 209 | "```\n", |
210 | 210 | "\n", |
211 | | - "Consider [Task B2](Task_B2_2_1), for configuration A and configuration B, predict what the LED will do when the button is unpressed and when the button is pressed. \n", |
| 211 | + "Consider [Task B2](Task_B2_2_1). For configuration A and configuration B, predict what the LED will do when the button is unpressed and when the button is pressed. \n", |
212 | 212 | "\n", |
| 213 | + "(Task_A2_2_1)=\n", |
| 214 | + "#### Task A2: Using digitial input/output pins to implement more advanced behaviour\n", |
213 | 215 | "\n", |
| 216 | + "While the above setups allow you to control the behaviour of an LED using a switch, they don't allow for more advanced logic to be implemented. For example, in your version of Whack-a-mole, LEDs should turn on at random, much like how moles randomly appear from holes in the original game. Further, analogous to hitting the mole with a mallet, when the corresponding switch is pushed, the LED should turn off. \n", |
214 | 217 | "\n", |
215 | | - "-----\n", |
| 218 | + "To implement this more advanced behaviour, you will have to make use of the digital input and output pins. \n", |
216 | 219 | "\n", |
217 | | - "Compare connecting LED to switch in pull-up and pull-down config - validate in I&I1\n", |
218 | | - "Idea is that they understand when output is true and when output is false\n", |
| 220 | + "The LED should react based on the state of the button (pushed/not pushed). Hence, predict whether the switch or the LED should be connected to the digital output pin. Predict whether the switch or LED should be connected to the digital input pin. \n" |
| 221 | + ] |
| 222 | + }, |
| 223 | + { |
| 224 | + "cell_type": "markdown", |
| 225 | + "id": "4e777430", |
| 226 | + "metadata": {}, |
| 227 | + "source": [ |
| 228 | + "### Simulate\n", |
| 229 | + "\n", |
| 230 | + "(Task_S1_2_1)=\n", |
| 231 | + "#### Task S1: \n", |
| 232 | + "There is no simulate for this week." |
| 233 | + ] |
| 234 | + }, |
| 235 | + { |
| 236 | + "cell_type": "markdown", |
| 237 | + "id": "fddf060f", |
| 238 | + "metadata": {}, |
| 239 | + "source": [ |
| 240 | + "### Implement and Investigate\n", |
| 241 | + "\n", |
| 242 | + "(Task_I1_2_1)=\n", |
| 243 | + "#### Task I1: Seeing the button in action\n", |
219 | 244 | "\n", |
220 | | - "Explain that can't implement logic with this yet \n", |
| 245 | + "Think back to [Task A1](Task_A1_2_1) where you predicted the correct configuration for connecting an LED to a switch in a pull-up configuration. You will now implement this on the ALPACA.\n", |
221 | 246 | "\n", |
222 | | - "Look at connecting switch to digital input pin and connecting digital output pin to the LED\n", |
223 | | - "Explain that this then allows us to do logic: by setting hte output pin to true, we can turn on the LED. When we push the button, we will get a true/false signal (depending on whether have pull-up or pull-down config). Based on this, when get certain signal at input pin, can output something in response from output pin to make LED respond to whatever is happening with the switch " |
| 247 | + "\n" |
224 | 248 | ] |
225 | 249 | } |
226 | 250 | ], |
|
0 commit comments