-
Notifications
You must be signed in to change notification settings - Fork 62
Add in Raspberry gpio pages for Part 1, Chapter 1 #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
omckeon
wants to merge
45
commits into
splashkit:main
Choose a base branch
from
omckeon:raspberry_gpio_part_1_chapter_1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
be40da1
Add new projects: Binary Calculator and Judgement Game; introduce Ras…
XQuestCode 4960e28
Add new guides for Raspberry Pi control flow and potentiometer usage;…
XQuestCode 21ba3be
Merge branch 'raspberry-pi-tasks' of https://github.com/XQuestCode/th…
omckeon 3e78664
Remove unwanted files
omckeon ef1313e
Update Part 0 Raspberry Pi pages
omckeon 6f1b78e
Simplify the P0C3 Raspberry Pi guided activity.
omckeon 70f3493
Add attributions for RPi images in P0C2
omckeon 8702c58
Update blink LED diagram and add attribution
omckeon f1d2712
Update Pi installation page to add links for more information about c…
omckeon 8041b51
Update P0C3 Gpio pages
omckeon 54e7c07
Update file names to fix order in sidebar to have raspberry pi at the…
omckeon b487e64
P1C1 - Add initial 7-segment display content to overview section
omckeon e49224c
Update circuits diagrams to make it easier for moving to the 7-segmen…
omckeon f7b0c7e
Update diagram and move simplified pinout to guided tour
omckeon 4425935
Initial plan for P1C1 guided tour
omckeon 0762478
Move pages into control flow chapter - reading GPIO pin focus
omckeon 8678487
P1C1 - Add in plan for gpio test your knowledge activity.
omckeon 633d4b3
Update P1C1 Overview for GPIO
omckeon c3e098e
Move button press pages back to P1C1
omckeon 75a9e6c
Update P1C1 overview pages
omckeon 5919d54
Update P1C1 GPIO guided tour pages
omckeon 171aa0f
Move 7-segment pages to P2C2
omckeon 56aa91e
Rename pages
omckeon 5b2763b
Update 7-seg pages
omckeon ccaacd0
Fix broken links
omckeon d9542a4
Merge branch 'main' of https://github.com/splashkit/the-programmers-f…
omckeon eba3ace
Add note with link to guided activity
omckeon 9438e95
Remove part 2 file changes
omckeon d01cca9
Merge branch 'main' of https://github.com/splashkit/the-programmers-f…
omckeon c9377bf
Update dot points on GPIO Pins overview page
omckeon aa088cf
Merge branch 'main' of https://github.com/splashkit/the-programmers-f…
omckeon ef76a14
Add GpioPinValue to gpio methods page
omckeon 60efe99
Merge branch 'main' of https://github.com/splashkit/the-programmers-f…
omckeon 48b1227
Simplify binary calculator activity page (initial version) and rename…
omckeon 83b30eb
Minor updates for binary converter activity
omckeon 181cc85
Finalise Binary converter activity
omckeon a858a87
Update graffle file to match file in main
omckeon a33588d
Merge branch 'main' of https://github.com/splashkit/the-programmers-f…
omckeon ba731a6
Simplify and tidy up Part 0 pages to remove the excess chatGPT style …
omckeon 1693eb0
Finalise GPIO guided tour activity
omckeon ff00f54
Merge branch 'main' of https://github.com/splashkit/the-programmers-f…
omckeon 7fbdae9
Update to include "digital" in P1C1 GPIO guided activity
omckeon 53251aa
Remove extra files
omckeon 776e094
Remove missed file
omckeon e77218a
Finalise P1C1 GPIO overview pages
omckeon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
157 changes: 157 additions & 0 deletions
157
...nt/docs/book/part-1-instructions/1-sequence-and-data/0-panorama/8-gpio-pins.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| --- | ||
| title: Raspberry Pi GPIO Pins | ||
| sidebar: | ||
| attrs: | ||
| class: pi | ||
| --- | ||
|
|
||
| **G**eneral **P**urpose **I**nput/**O**utput pins let your Raspberry Pi sense or control simple electronic components. Each pin can be configured as an input (to read a signal) or an output (to send a signal). | ||
|
|
||
| SplashKit provides a variety of useful functionality and special data types to make it easier to work with the Raspberry Pi's GPIO pins. | ||
|
|
||
| ## Working with GPIO Pins | ||
|
|
||
| ### Pin Numbering | ||
|
|
||
| SplashKit's GpioPin data type refers to the physical header numbers, shown in the pinout diagram in [Understandingthe GPIO Pins](/book/part-0-getting-started/2-computer-use/1-tour/3-2-setup-raspberry#understanding-the-gpio-pins). | ||
|
|
||
| The [`GpioPin`](https://splashkit.io/api/types/#gpio-pin) table shows the code values for each pin on the left, and a description of the pin on the right. e.g. `GpioPin.Pin11` refers to "GPIO 17". | ||
|
|
||
| The interactive [Raspberry Pi Pinout](https://pinout.xyz/) page is a useful resource if you want to learn more about the different GPIO pins. | ||
|
|
||
| ### Pin Modes | ||
|
|
||
| GPIO pins need their "mode" (input/output) configured before using them in your code. You can set the input/output mode of a GPIO Pin using SplashKit's [`RaspiSetMode`](https://splashkit.io/api/raspberry/#raspi-set-mode) method. The second argument given to this method will use the values shown in the first two rows of the [`GpioPinMode`](https://splashkit.io/api/types/#gpio-pin-mode) table (`GpioPinMode.GpioInput` and `GpioPinMode.GpioOutput`). | ||
|
|
||
| ### Pull Resistors (Input Mode) | ||
|
|
||
| When configuring a GPIO pin for **digital *input*** devices such as a push button, the input signal can “float” if nothing is connected (such as when a button is not pressed), which will cause unexpected behaviour in your program. To prevent this issue, you can use SplashKit's [`RaspiSetPullUpDown`](https://splashkit.io/api/raspberry/#raspi-set-pull-up-down) method to enable an internal pull‑up (default high) or pull‑down (default low) resistor. | ||
|
|
||
| In the example below, the button pin has been configured to enable an internal pull‑down resistor using the `PullUpDown.PudDown` value from the [`PullUpDown`](https://splashkit.io/api/types/#pull-up-down) table. | ||
|
|
||
| ### Pin Values | ||
|
|
||
| The GPIO pins use **digital** signals when writing to, or reading from, a GPIO pin. A digital signal is either low (0) or high (1). This connects with the [Machine Code](/book/part-0-getting-started/1-digital-realities/2-trailside/4-machine-code) ideas: the CPU ultimately deals in ones and zeroes, and GPIO lets you see and set those bits in the real world. | ||
|
|
||
| :::caution[Digital "high" signal voltage] | ||
|
|
||
| On the Raspberry Pi, a digital high signal is 3.3 volts. | ||
|
|
||
| *Never feed 5 volts into a GPIO pin!* | ||
|
|
||
| ::: | ||
|
|
||
| :::tip[SplashKit's Pin Values] | ||
|
|
||
| When reading button inputs in the example below, the [`RaspiRead`](https://splashkit.io/api/raspberry/#raspi-read) method will return a [`GpioPinValue`](https://splashkit.io/api/types/#gpio-pin-value) of `GpioLow` (0) or `GpioHigh` (1). | ||
|
|
||
| To convert these values into raw binary values (0 or 1) to use in calculations, you can use SplashKit's [`ToInt`](https://splashkit.io/api/raspberry/#to-int) method. | ||
| ::: | ||
|
|
||
| ### The usual GPIO workflow | ||
|
|
||
| Once you have wired up your circuit and connected it to the relevant GPIO pins: | ||
|
|
||
| 1. Start the pigpiod daemon in the shell if you have just rebooted. | ||
| 2. In your code, call `RaspiInit` at the start. | ||
| 3. Create `GpioPin` variables for each pin you want to use. | ||
| 4. Set each pin’s mode (and pull for inputs) | ||
| 5. Read or write as needed | ||
| 6. Then call `RaspiCleanup` before the program exits. | ||
|
|
||
| ## GPIO "pre‑flight checklist" | ||
|
|
||
| ### 1. Hardware and wiring | ||
|
|
||
| - Power to the Pi is off while you wire components (or just connect the voltage pin last). | ||
| - LED polarity is correct: long leg to GPIO via resistor, short leg to Ground (GND). | ||
| - A current‑limiting resistor (≈220–330 Ω) is in series with any LEDs. | ||
| - Buttons are wired between the chosen GPIO pin and 3.3 V or GND (match this to your pull‑up or pull‑down choice). | ||
| - Ground connection is solid (all components share a GND with the Pi). | ||
| - No 5V wire is touching a GPIO pin (GPIOs are 3.3 V tolerant only). | ||
|
|
||
| ### 2. Pin choices and naming | ||
|
|
||
| - You know which physical header pins you are using (for example `GpioPin.Pin11`). | ||
| - You are not mixing physical pin numbers with Broadcom (BCM) numbers. | ||
|
|
||
| ### 3. System services | ||
|
|
||
| - `pigpiod` is running (start it after a reboot): | ||
|
|
||
| ```shell | ||
| sudo pigpiod | ||
|
|
||
| ## Example | ||
|
|
||
| To get started with using the Raspberry functions to write and read GPIO pin values, you can use the following wiring diagram to connect an LED to Pin 11 and connect a button to Pin 13. | ||
|
|
||
| :::note | ||
| You can check out [Step 2 - Initialise GPIO Pin](/book/part-1-instructions/1-sequence-and-data/1-tour/03-01-prepare-gpio-pins) from the guided activity for more information about setting up the button. | ||
| ::: | ||
|
|
||
|  | ||
| <div class="caption">Image created with <a href="https://fritzing.org/">Fritzing</a></div> | ||
|
|
||
| The following program uses methods in the [Raspberry](https://splashkit.io/api/raspberry/) category of the SplashKit library to "write" data to Pin 11 (GPIO 17), and "read" data from Pin 13 (GPIO 27) on the Raspberry Pi (as shown in the wiring diagram above). | ||
|
|
||
| ```cs | ||
| using SplashKitSDK; | ||
| using static SplashKitSDK.SplashKit; | ||
|
|
||
| // Initialise the GPIO system | ||
| RaspiInit(); | ||
|
|
||
| // Define the LED pin (using physical Pin 11) | ||
| GpioPin ledPin = GpioPin.Pin11; | ||
| // Define the button pin (using physical Pin 13) | ||
| GpioPin buttonPin = GpioPin.Pin13; | ||
|
|
||
| // Set the button pin to input mode | ||
| RaspiSetMode(buttonPin, GpioPinMode.GpioInput); | ||
| // Set the led pin to output mode | ||
| RaspiSetMode(ledPin, GpioPinMode.GpioOutput); | ||
|
|
||
| // Set the button pin to use an internal pull-down resistor | ||
| RaspiSetPullUpDown(buttonPin, PullUpDown.PudDown); | ||
|
|
||
| // Reading 1 with button pressed | ||
| WriteLine("Press and hold your button down, then hit Enter to record the reading:"); | ||
| ReadLine(); // Wait for user to press Enter | ||
| GpioPinValue reading1 = RaspiRead(buttonPin); | ||
|
|
||
| // Output of button being pressed | ||
| WriteLine("Button Gpio value: " + reading1); | ||
| RaspiWrite(ledPin, reading1); | ||
|
|
||
| // Reading 2 with button released | ||
| WriteLine("Now release your button now so it is not pressed, then hit Enter:"); | ||
| ReadLine(); // Wait for another press | ||
| GpioPinValue reading2 = RaspiRead(buttonPin); | ||
|
|
||
| // Output of button not being pressed | ||
| WriteLine("Button Gpio value: " + reading2); | ||
| RaspiWrite(ledPin, reading2); | ||
|
|
||
| // Clean up the GPIO system | ||
| RaspiCleanup(); | ||
| ``` | ||
|
|
||
| ## Activities | ||
|
|
||
| Here are some lines from the code above. What do you think these lines of code do? | ||
|
|
||
| 1. `GpioPin ledPin = GpioPin.Pin11;` | ||
| 2. `RaspiSetMode(ledPin, GpioPinMode.GpioOutput);` | ||
| 3. `GpioPinValue reading1 = RaspiRead(buttonPin);` | ||
| 4. `RaspiWrite(ledPin, reading1);` | ||
|
|
||
| <details> | ||
| <summary role="button">Answers</summary> | ||
| <ul> | ||
| <li><strong>1: </strong><code>GpioPin ledPin = GpioPin.Pin11;</code> creates a GpioPin variable named ledPin, and assigns it the value of pin 11.</li> | ||
| <li><strong>2: </strong><code>RaspiSetMode(ledPin, GpioPinMode.GpioOutput);</code> sets the LED pin to output mode to allow data to be written to pin 11.</li> | ||
| <li><strong>3: </strong><code>GpioPinValue reading1 = RaspiRead(buttonPin);</code> reads the value of the pin 13, while the button is pushed, and assigns it to a GpioPinValue variable named "reading1".</li> | ||
| <li><strong>4: </strong><code>RaspiWrite(ledPin, reading1);</code> turns the LED "on" by writing the value stored in the "reading1" variable (GpioHigh) to pin 11, which is connected to the LED.</li> | ||
| </ul> | ||
| </details> | ||
97 changes: 97 additions & 0 deletions
97
.../part-1-instructions/1-sequence-and-data/0-panorama/9-raspberry-gpio-methods.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| --- | ||
| title: Raspberry methods to use | ||
| sidebar: | ||
| attrs: | ||
| class: pi | ||
| --- | ||
|
|
||
| Interacting with the GPIO pins on a Raspberry Pi can be a fun way to explore how software and hardware interact. The following methods will give you a start building programs using your Raspberry Pi. | ||
|
|
||
| To create programs that use the GPIO pins on your Raspberry Pi, you will need the following using directives: | ||
|
|
||
| ```cs | ||
| using SplashKitSDK; | ||
| using static SplashkitSDK.SplashKit; | ||
| ``` | ||
|
|
||
| The `using SplashKitSDK;` line allows you to create variables using SplashKit's data types, such as [`GpioPin`](https://splashkit.io/api/types/#gpio-pin) for your GPIO pins and [`GpioPinValue`](https://splashkit.io/api/types/#gpio-pin-value) for the values received from the GPIO pins. | ||
|
|
||
| With the `using static SplashkitSDK.SplashKit;` line, you have access to the following methods to interact with the Raspberry Pi GPIO Pins: | ||
|
|
||
| ```cs | ||
| // Initialise the GPIO system | ||
| public static void RaspiInit(); | ||
|
|
||
| // Set the Mode for a GPIO Pin on the Raspberry Pi | ||
| public static void RaspiSetMode(GpioPin pin, GpioPinMode mode); | ||
|
|
||
| // Set the Pull up/down mode for a pin to set it's default state (down = 0 and up = 1) | ||
| public static void RaspiSetPullUpDown(GpioPin pin, PullUpDown pud); | ||
|
|
||
| // Write data (0 or 1) to the Raspberry Pi GPIO pin | ||
| public static void RaspiWrite(GpioPin pin, GpioPinValue value); | ||
|
|
||
| // Read data (0 or 1) from the Raspberry Pi GPIO pin | ||
| public static GpioPinValue RaspiRead(GpioPin pin); | ||
|
|
||
| // Reset the GPIO system before exiting the program | ||
| public static void RaspiCleanup(); | ||
|
|
||
| // Convert the "GpioPinValue" type to an integer | ||
| public static int ToInt(GpioPinValue value); | ||
|
|
||
| // Delay - waiting for a number of milliseconds before continuing | ||
| public static void Delay(int milliseconds); | ||
| ``` | ||
|
|
||
| *What do the different arguments represent?* | ||
|
|
||
| When you interact with the GPIO pins on your Raspberry Pi, it first needs to know which GPIO pin is being used, and how. This is done using the `RaspiSetMode` method. The `pin` argument determines which GPIO pin to set up, and the `mode` argument determines how it will be used, such as using `GpioPinMode.GpioOutput` to write data to a GPIO pin, or `GpioPinMode.GpioInput` to read data from a GPIO pin. | ||
|
|
||
| The `RaspiWrite` method allows you to write data to a given GPIO pin, using the `pin` argument. The data written to the pin is determined by the `value` argument, which could be `GpioPinValue.GpioLow` (0), or `GpioPinValue.GpioHigh` (1). | ||
|
|
||
| The `RaspiRead` method allows you to read data from a given GPIO pin, using the `pin` argument. The data read from the pin, which could be `GpioPinValue.GpioLow` (0), or `GpioPinValue.GpioHigh` (1), is returned when the method is called. | ||
|
|
||
| ## Example | ||
|
|
||
| The following example reads whether the button connected to Pin 11 was pressed, and then turns the LED connected to Pin 13 "ON" if the button was pressed, and "OFF" if not pressed. | ||
|
|
||
| ```cs | ||
| using SplashKitSDK; | ||
| using static SplashKitSDK.SplashKit; | ||
|
|
||
| // Initialise the GPIO system | ||
| RaspiInit(); | ||
|
|
||
| // Define the button and LED pins | ||
| GpioPin buttonPin = GpioPin.Pin13; | ||
| GpioPin ledPin = GpioPin.Pin11; | ||
|
|
||
| // Set the button pin to input mode, and the led pin to output mode | ||
| RaspiSetMode(buttonPin, GpioPinMode.GpioInput); | ||
| RaspiSetMode(ledPin, GpioPinMode.GpioOutput); | ||
|
|
||
| // Set the button pin to use an internal pull-down resistor | ||
| RaspiSetPullUpDown(buttonPin, PullUpDown.PudDown); | ||
|
|
||
| // Button pressed | ||
| WriteLine("Press and hold your button down, then hit Enter to record the reading:"); | ||
| ReadLine(); // Wait for user to press Enter | ||
| GpioPinValue reading1 = RaspiRead(buttonPin); | ||
|
|
||
| // Output result | ||
| WriteLine("Button Gpio value: " + reading1); | ||
| RaspiWrite(ledPin, reading1); | ||
|
|
||
| // Button released | ||
| WriteLine("Now release your button now so it is not pressed, then hit Enter:"); | ||
| ReadLine(); // Wait for another press | ||
| GpioPinValue reading2 = RaspiRead(buttonPin); | ||
|
|
||
| // Output result | ||
| WriteLine("Button Gpio value: " + reading2); | ||
| RaspiWrite(ledPin, reading2); | ||
|
|
||
| // Clean up the GPIO system | ||
| RaspiCleanup(); | ||
| ``` |
Binary file added
BIN
+214 KB
...rt-1-instructions/1-sequence-and-data/0-panorama/images/read-button-circuit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
107 changes: 107 additions & 0 deletions
107
...k/part-1-instructions/1-sequence-and-data/1-tour/03-00-button-press-counter.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| --- | ||
| title: Button Press Counter | ||
| sidebar: | ||
| attrs: | ||
| class: pi | ||
| --- | ||
|
|
||
| import { Accordion, AccordionItem } from "accessible-astro-components"; | ||
|
|
||
| In this guided activity, you'll learn how you can use SplashKit to read a **digital** value from a GPIO pin on your Raspberry Pi, using a simple circuit with a push button. | ||
|
|
||
| When you run the program, you will be prompted 3 times to press your button (or you can choose not to press it), and then hit Enter to record the value of the pin connected to the button. The pin value will then be converted to an integer to print the number of times the button was pressed. | ||
|
|
||
| Here is an example of the terminal output for when the button is pressed only for readings 1 and 3: | ||
|
|
||
| ```txt | ||
| Welcome to the button press counter! | ||
|
|
||
| You will be prompted to read the value of the button pin 3 times. | ||
| Press the button when prompted to increase the button counter. | ||
|
|
||
| Button Press - Reading 1 | ||
| Press Enter to record the button reading: | ||
|
|
||
| Button Press - Reading 2 | ||
| Press Enter to record the button reading: | ||
|
|
||
| Button Press - Reading 3 | ||
| Press Enter to record the button reading: | ||
|
|
||
| Results: | ||
|
|
||
| Reading 1: 1 | ||
| Reading 2: 0 | ||
| Reading 3: 1 | ||
|
|
||
| The button was pressed 2 times! | ||
| | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| For this activity, we'll be using a **tactile push button switch** (sometimes called a "momentary" push button switch) to provide input to the Raspberry Pi, as shown in the wiring diagram below: | ||
|
|
||
|  | ||
| <div class="caption">Image created with <a href="https://fritzing.org/">Fritzing</a></div> | ||
|
|
||
| Here are the steps to create the circuit shown above: | ||
|
|
||
| 1. **Put the push button onto the breadboard:** | ||
|
|
||
| Place the button across the center channel of the breadboard. | ||
|
|
||
| :::note[Internal button connections] | ||
| The 4 pins on the button are connected internally into two sets. The image below shows each set of connected pins circled in red: | ||
|
|
||
|  | ||
| ::: | ||
|
|
||
| 2. **Connect the power using the 3.3V GPIO pin:** | ||
|
|
||
| Attach a jumper wire from one side of the button to the 3.3V pin. | ||
| *(This is the red wire connected to pin 1 in the diagram above.)* | ||
|
|
||
| 3. **Connect the button to the GPIO Pin:** | ||
|
|
||
| Attach a jumper wire from the diagonally opposiste pin on the buttton to GPIO Pin 13. | ||
| *(This is the yellow wire connected to pin 13 in the diagram above.)* | ||
|
|
||
| --- | ||
|
|
||
| Once you have completed the circuit above, create a new folder, and a dotnet project called ButtonCounter on your Raspberry Pi computer. | ||
|
|
||
| 1. Open your terminal on your Raspberry Pi, and set up your project: | ||
|
|
||
| ```zsh | ||
| # Move you your code projects folder | ||
| cd ~/Documents/Code # or cd /c/Users/andrew/Documents/Code | ||
|
|
||
| # Create and move into a folder for the project | ||
| mkdir ButtonCounter | ||
| cd ButtonCounter | ||
|
|
||
| # Create a blank dotnet project | ||
| dotnet new console | ||
|
|
||
| # Add the SplashKit library | ||
| dotnet add package splashkit | ||
|
|
||
| # Open in VS Code | ||
| code . | ||
| ``` | ||
|
|
||
| 2. Add the [using directives](/book/part-1-instructions/1-sequence-and-data/0-panorama/1-method-library) to access the SplashKit code and GPIO types: | ||
|
|
||
| <Accordion> | ||
| <AccordionItem header="Code with using directives"> | ||
|
|
||
| At this point you should just have these two lines of code. | ||
|
|
||
| ```csharp | ||
| using SplashKitSDK; | ||
| using static SplashKitSDK.SplashKit; | ||
| ``` | ||
|
|
||
| </AccordionItem> | ||
| </Accordion> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are GPIO pins?
General Purpose Input/Output pins let your Raspberry Pi sense or control simple electronic components. Each pin can be configured as an input (to read a signal) or an output (to send a signal). SplashKit provides a typed interface so you do not work with raw numbers.
Binary signals in practice
A digital signal is either low (0) or high (1). On the Raspberry Pi a high signal is 3.3 volts. This connects with the Machine Code ideas: the CPU ultimately deals in ones and zeroes, and GPIO lets you see and set those bits in the real world.
Pin numbering and safety
SplashKit’s GpioPin enum refers to the physical header numbers (Pin11, Pin13, and so on). Never feed 5 V into a GPIO pin.
Modes and pull resistors
Inputs read, outputs drive. Inputs can “float” if nothing is connected, so you usually enable an internal pull‑up (default high) or pull‑down (default low) resistor. Outputs ignore pull settings.
The usual GPIO workflow
Start the pigpiod daemon in the shell if you have just rebooted. In code, call RaspiInit once, set each pin’s mode (and pull for inputs), read or write as needed, then call RaspiCleanup before the program exits.
Quick reference
TODO : (Insert the short table above, then link to the SplashKit docs.) ??
Raspberry Pi GPIO pre‑flight checklist
1. Hardware and wiring
2. Pin choices and naming
GpioPin.Pin11)3. System services
pigpiodis running (start it after a reboot):There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hope this helps? Extend / modify the checklist to cover what you want them to double check?
I like the idea of linking back to splashkit for the bulk of the references, but perhaps adding a tabl of common terms mght be good too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fantastic Cliff! Thank you!