Add C# examples to Raspberry Pi PWM button guide #681
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.
Description
This PR adds comprehensive C# language support (both Top-level Statements and Object-Oriented Programming styles) to the "Modify PWM through button presses" Raspberry Pi GPIO tutorial. The tutorial previously only included C++ examples, and this update ensures consistency with other SplashKit tutorials by providing complete C# implementations.
Related Documentation: This implements the requirements from the Tutorial Style Guide to include both C# coding styles in all tutorials.
Context: The SplashKit documentation aims to support multiple programming languages, with C# being a primary language alongside C++. This tutorial demonstrates advanced GPIO concepts including PWM control, button debouncing, and timer management, making it crucial for C# developers learning hardware programming.
Type of Change
Changes Made
Modified Files:
src/content/docs/guides/raspberry-gpio/3-pwm-button-control.mdxsyncKey="csharp-style"scripts/json-files/guides/Raspberry-GPIO/raspberry-gpio.jsonraspi_set_pwm_frequencyfrom tutorial entryAuto-Regenerated Files:
scripts/json-files/guides.json- Updated with corrected function listsrc/content/docs/api/*.mdx- All 21 API documentation pages regenerated with tutorial linksHow Has This Been Tested?
Code Validation
Site Build Testing
npm run setupsuccessfullyCode Review
Code Examples
C# Top-level Statements Version
C# Object-Oriented Version
Variable & Type Conversions
brightnessbrightnessmax_brightnessmaxBrightnesslast_read_timelastReadTimeread_intervalreadIntervalled_pinledPinincrease_btn_pinincreaseBtnPindecrease_btn_pindecreaseBtnPinrun_timerrunTimercurrent_timecurrentTimeunsigned longulonggpio_pinPinstimerTimerGPIO_OUTPUTPinModes.GpioOutputGPIO_INPUTPinModes.GpioInputGPIO_HIGHPinValues.GpioHighPUD_DOWNPullUpDown.PudDownChecklist
Code Quality
Testing
Configuration Files
Additional Notes
Why This Matters
This tutorial is particularly important because it:
Compliance
Breaking Changes
None. This is a pure addition of C# code examples to an existing tutorial. All existing C++ code remains unchanged, and the tutorial structure is preserved.
Future Work