|
160 | 160 | "outputs": [],
|
161 | 161 | "source": [
|
162 | 162 | "# The below \"save\" comment is a SparkFun Jupyter Notebook command to save all code below to the board permanently\n",
|
163 |
| - "# %save% \n", |
| 163 | + "# %save%\n", |
164 | 164 | "\n",
|
165 | 165 | "# The qwiic_oled driver module allows for control of SparkFun OLEDs.\n",
|
166 | 166 | "# The QwiicLargeOled class is for the Large 1.3\" OLED display in our SIK\n",
|
|
232 | 232 | " myOLED.clear(myOLED.PAGE) # Clear the processor's display buffer.\n",
|
233 | 233 | "\n",
|
234 | 234 | "def show_start_sequence():\n",
|
| 235 | + " myOLED.set_font_type(1) # Set our font to font #1 (medium sized letters and numbers)\n", |
235 | 236 | " clear_all_oled() # Clear the OLED display\n",
|
236 | 237 | " myOLED.set_cursor(0, 0) # Move the cursor to the top left corner\n",
|
237 | 238 | " myOLED.print(\"Category:\") # Print \"Category:\"\n",
|
|
244 | 245 | " sleep_ms(2000) # Wait for 2 seconds\n",
|
245 | 246 | " \n",
|
246 | 247 | " clear_all_oled() # Clear the display\n",
|
247 |
| - " myOLED.set_cursor(40, 20) # Move the cursor to middle(ish) of the screen\n", |
| 248 | + " myOLED.set_cursor(20, 25) # Move the cursor to middle(ish) of the screen\n", |
248 | 249 | " myOLED.print(\"Get ready!\") # Print \"Get ready!\"\n",
|
249 | 250 | " myOLED.display() # Actually show what we've printed\n",
|
250 | 251 | " sleep_ms(1000) # Wait for 1 second\n",
|
| 252 | + "\n", |
| 253 | + " # Let's make our countdown nice and big by using font #3 (Large Number Font)\n", |
| 254 | + " myOLED.set_font_type(3)\n", |
251 | 255 | " \n",
|
252 | 256 | " # Pro Tip: You can count DOWN with a for loop by passing -1 to the range function\n",
|
253 | 257 | " # This will count from 3 to 1, decreasing by 1 each time\n",
|
254 | 258 | " for i in range(3, 0, -1): # Countdown from 3 to 1\n",
|
255 | 259 | " clear_all_oled() # Clear the display\n",
|
256 |
| - " myOLED.set_cursor(40, 20) # Move the cursor to middle(ish) of the screen\n", |
| 260 | + " myOLED.set_cursor(60, 10) # Move the cursor to middle(ish) of the screen\n", |
257 | 261 | " myOLED.print(str(i)) # Print the countdown number\n",
|
258 | 262 | " myOLED.display() # Actually show what we've printed\n",
|
259 | 263 | " sleep_ms(1000) # Wait for 1 second\n",
|
260 | 264 | "\n",
|
| 265 | + " # # Set our font back to font #1 (medium sized letters and numbers) after the countdown\n", |
| 266 | + " myOLED.set_font_type(1)\n", |
| 267 | + "\n", |
261 | 268 | "# Function to display when the player loses\n",
|
262 | 269 | "def game_over():\n",
|
263 | 270 | " clear_all_oled() # Clear the OLED display\n",
|
|
285 | 292 | " myOLED.set_cursor(50, 20) # Move the cursor to the top center of the screen\n",
|
286 | 293 | " myOLED.print(\"YOU\") # Print \"You\"\n",
|
287 | 294 | " \n",
|
288 |
| - " myOLED.set_cursor(50, 30) # Move to the bottom center of the screen\n", |
| 295 | + " myOLED.set_cursor(50, 40) # Move to the bottom center of the screen\n", |
289 | 296 | " myOLED.print(\"WIN!\") # Print \"WIN!\"\n",
|
290 | 297 | " myOLED.display() # Actually show what we've printed\n",
|
291 | 298 | " \n",
|
|
318 | 325 | "for i in range(len(orderOfWords)):\n",
|
319 | 326 | " clear_all_oled() # Clear the OLED display\n",
|
320 | 327 | "\n",
|
321 |
| - " myOLED.set_cursor(40, 20) # Move the cursor to middle(ish) of the screen\n", |
| 328 | + " myOLED.set_cursor(0, 25) # Move the cursor to the start of the middle(ish) row of the screen\n", |
322 | 329 | " roundNumber = i + 1 # the array starts at 0, but the roundNumber will start counting from 1\n",
|
323 | 330 | " myOLED.print(str(roundNumber) + \": \") # Print the current round number\n",
|
324 | 331 | " myOLED.print(words[orderOfWords[i]]) # Print the word from the random order list\n",
|
|
0 commit comments