Skip to content

Guides: Introduce C Tutorial #21434

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

Merged
merged 1 commit into from
Jun 26, 2025
Merged

Conversation

AnnsAnns
Copy link
Contributor

@AnnsAnns AnnsAnns commented Apr 24, 2025

image

Contribution description

This is the first wave of many that introduce brand new beginner tutorials to RIOT. The aim of this PR is to introduce the C Tutorials covering some of the most basic things from Threads to GPIO.

Testing procedure

Every tutorial within this PR is covered by an example that is 1:1 reproducible by following the tutorial. This means that all guides are cross-checked with the linked examples and all examples are built as usual which should avoid long term de-synchronization.

Issues/PRs references

Disclaimer: This depends on #21404!

This also depends on #21436

@AnnsAnns AnnsAnns marked this pull request as ready for review April 24, 2025 14:39
@github-actions github-actions bot added Area: doc Area: Documentation Area: CI Area: Continuous Integration of RIOT components Area: tools Area: Supplementary tools Area: examples Area: Example Applications labels Apr 24, 2025
@crasbe crasbe added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation State: waiting for other PR State: The PR requires another PR to be merged first labels Apr 24, 2025
@AnnsAnns AnnsAnns marked this pull request as draft April 24, 2025 15:12
@AnnsAnns
Copy link
Contributor Author

I have decided to make a different PR the head of this Tutorial wave as it made more sense chronologically. I will convert this into a draft till the other PR has been merged/is close to it.

@AnnsAnns AnnsAnns force-pushed the introduce_tutorials branch from e77a073 to e484faf Compare April 29, 2025 16:48
@github-actions github-actions bot removed Area: CI Area: Continuous Integration of RIOT components Area: tools Area: Supplementary tools labels Apr 29, 2025
@crasbe crasbe added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed State: waiting for other PR State: The PR requires another PR to be merged first labels Apr 29, 2025
@riot-ci
Copy link

riot-ci commented Apr 29, 2025

Murdock results

✔️ PASSED

8cdb2d9 doc/guides: Riot Tutorial

Success Failures Total Runtime
109 0 109 02m:33s

Artifacts

@AnnsAnns
Copy link
Contributor Author

One day I will PR something without whitespace issues, today isn't that day 😛

@AnnsAnns AnnsAnns force-pushed the introduce_tutorials branch from 9e54709 to e82e71b Compare April 30, 2025 12:41
@AnnsAnns
Copy link
Contributor Author

I rebased the branch now that both parents have been merged and this PR should be reviewable 😄

@AnnsAnns AnnsAnns marked this pull request as ready for review April 30, 2025 12:43
Copy link
Contributor

@Teufelchen1 Teufelchen1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use this one weird trick, to save ~46 MB of data! You might also use AV1 instead of x265, as @bergzand suggested. It's royalty free.

cd doc/guides/c_tutorials/img/gpio/

// Reduce filesize by 99.34%
ffmpeg -i 05_working_video.mp4 -filter:v scale=1080:-2 output.mp4
ffmpeg -i output.mp4 -vf "crop=1080:1300:0:0" -vcodec libx265 -crf 28 output2.mp4
mv output2.mp4 05_working_video.mp4
rm output.mp4

// Reduce by 81.35%
ffmpeg -i 08_buttons.mp4 -vcodec libx265 -crf 28 output.mp4
mv output.mp4 08_buttons.mp4

// For asthetics
ffmpeg -i 04_code.png -vf "crop=772:450:0:0" 04_code2.png
mv 04_code2.png 04_code.png

Not done with the review yet. I don't know if I am a fan of screenshots from VSCode? What do they add of value? Showing the code? We can do just that without an image.

@AnnsAnns
Copy link
Contributor Author

AnnsAnns commented May 5, 2025

Use this one weird trick, to save ~46 MB of data! You might also use AV1 instead of x265, as @bergzand suggested. It's royalty free.

cd doc/guides/c_tutorials/img/gpio/

// Reduce filesize by 99.34%
ffmpeg -i 05_working_video.mp4 -filter:v scale=1080:-2 output.mp4
ffmpeg -i output.mp4 -vf "crop=1080:1300:0:0" -vcodec libx265 -crf 28 output2.mp4
mv output2.mp4 05_working_video.mp4
rm output.mp4

// Reduce by 81.35%
ffmpeg -i 08_buttons.mp4 -vcodec libx265 -crf 28 output.mp4
mv output.mp4 08_buttons.mp4

// For asthetics
ffmpeg -i 04_code.png -vf "crop=772:450:0:0" 04_code2.png
mv 04_code2.png 04_code.png

Not done with the review yet. I don't know if I am a fan of screenshots from VSCode? What do they add of value? Showing the code? We can do just that without an image.

Ty for the commands. When I initially wrote that guide I was thinking of some people that barely had any experience with vscode and needed some visual guidance to understand what they are even doing in vscode (As happened in the riot uni project) but the screenshots also add a really annoying maintenance burden when you change something so I'm not really against removing them.

@AnnsAnns
Copy link
Contributor Author

AnnsAnns commented Jun 2, 2025

As a small info as to why the PR is currently stale, I'm trying to get my bachelor's project to a point where I can confidently register it without fearing the deadline, I will come back to this after that (Hopefully soon-ish).

Copy link
Contributor

@Teufelchen1 Teufelchen1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please squash 👍

Copy link
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't really go through the written documentation yet, just some observations from the code.

@Teufelchen1
Copy link
Contributor

Looks like I was sloppy during the review. Sorry. The files were marked as reviewed - so I thought I finished, but that clearly wasn't the case.

@crasbe
Copy link
Contributor

crasbe commented Jun 24, 2025

I ran the make generate-Makefile.ci command for the new examples and this is the result:

chris@ThinkPias:~/RIOTstuff/riot-c-guide/RIOT/examples/guides$ git status
Auf Branch introduce_tutorials
Unversionierte Dateien:
  (benutzen Sie "git add <Datei>...", um die Änderungen zum Commit vorzumerken)
	gpio/Makefile.ci
	saul/Makefile.ci
	threads/Makefile.ci

nichts zum Commit vorgemerkt, aber es gibt unversionierte Dateien
(benutzen Sie "git add" zum Versionieren)
chris@ThinkPias:~/RIOTstuff/riot-c-guide/RIOT/examples/guides$ cat gpio/Makefile.ci 
BOARD_INSUFFICIENT_MEMORY := \
    atmega8 \
    nucleo-l011k4 \
    #
chris@ThinkPias:~/RIOTstuff/riot-c-guide/RIOT/examples/guides$ cat saul/Makefile.ci 
BOARD_INSUFFICIENT_MEMORY := \
    atmega8 \
    #
chris@ThinkPias:~/RIOTstuff/riot-c-guide/RIOT/examples/guides$ cat threads/Makefile.ci 
BOARD_INSUFFICIENT_MEMORY := \
    nucleo-l011k4 \
    #

@AnnsAnns
Copy link
Contributor Author

Looks like I was sloppy during the review. Sorry. The files were marked as reviewed - so I thought I finished, but that clearly wasn't the case.

Im also to blame, I should have retroactively applied the requested changes from #21545 here now that I know more about the formatting guidelines 😅

@AnnsAnns
Copy link
Contributor Author

I used this as a chance to improve the explanations of the examples with a lot more comments, better to do it now than later 👍

@AnnsAnns
Copy link
Contributor Author

I ran the make generate-Makefile.ci command for the new examples and this is the result:

chris@ThinkPias:~/RIOTstuff/riot-c-guide/RIOT/examples/guides$ git status
Auf Branch introduce_tutorials
Unversionierte Dateien:
  (benutzen Sie "git add <Datei>...", um die Änderungen zum Commit vorzumerken)
	gpio/Makefile.ci
	saul/Makefile.ci
	threads/Makefile.ci

nichts zum Commit vorgemerkt, aber es gibt unversionierte Dateien
(benutzen Sie "git add" zum Versionieren)
chris@ThinkPias:~/RIOTstuff/riot-c-guide/RIOT/examples/guides$ cat gpio/Makefile.ci 
BOARD_INSUFFICIENT_MEMORY := \
    atmega8 \
    nucleo-l011k4 \
    #
chris@ThinkPias:~/RIOTstuff/riot-c-guide/RIOT/examples/guides$ cat saul/Makefile.ci 
BOARD_INSUFFICIENT_MEMORY := \
    atmega8 \
    #
chris@ThinkPias:~/RIOTstuff/riot-c-guide/RIOT/examples/guides$ cat threads/Makefile.ci 
BOARD_INSUFFICIENT_MEMORY := \
    nucleo-l011k4 \
    #

I dont really understand what that means 😅

@AnnsAnns
Copy link
Contributor Author

This PR should now be ready for re-review 👍 Ty for all the feedback

@crasbe
Copy link
Contributor

crasbe commented Jun 24, 2025

I ran the make generate-Makefile.ci command for the new examples and this is the result:

I dont really understand what that means 😅

The merge failed because the nucleo-l011k4 has insufficient memory for some of the examples. In order to avoid this error, you can define a Makefile.ci file for each of the examples which declares boards that have insufficient memory.

I did that for your examples and posted the results. Three files were generated and I printed the contents of the files, so you can copy&paste them. In the review-mode of Github I can't propose a new file (I think?), therefore this way.

@crasbe
Copy link
Contributor

crasbe commented Jun 24, 2025

Looks like I was sloppy during the review. Sorry. The files were marked as reviewed - so I thought I finished, but that clearly wasn't the case.

Im also to blame, I should have retroactively applied the requested changes from #21545 here now that I know more about the formatting guidelines 😅

Blame is a strong word in this case. You always learn something new, but you can't (or shouldn't) reiterate old code every time you learn something new. Then you'd never get done 😅

@AnnsAnns AnnsAnns force-pushed the introduce_tutorials branch 2 times, most recently from 00a5913 to fef0c7e Compare June 24, 2025 22:22
@AnnsAnns
Copy link
Contributor Author

I ran the make generate-Makefile.ci command for the new examples and this is the result:

I dont really understand what that means 😅

The merge failed because the nucleo-l011k4 has insufficient memory for some of the examples. In order to avoid this error, you can define a Makefile.ci file for each of the examples which declares boards that have insufficient memory.

I did that for your examples and posted the results. Three files were generated and I printed the contents of the files, so you can copy&paste them. In the review-mode of Github I can't propose a new file (I think?), therefore this way.

This should now also be fixed 🙏

Copy link
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some time to go through the actual written documentation.

Perhaps I missed some of the Roter Faden, but I'm still half asleep 😴
So if any of the review comments don't make sense, blame it on that.

@AnnsAnns
Copy link
Contributor Author

This should cover all your review feedback 🙏

Copy link
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please squash 👍

@AnnsAnns
Copy link
Contributor Author

The two holy words everyone wants to hear, ty 🥳

examples/guides: Introduce tutorial references

doc/guides/tutorial: Introduce code_folder for all tutorials
@AnnsAnns AnnsAnns force-pushed the introduce_tutorials branch from fc6947a to 8cdb2d9 Compare June 26, 2025 13:54
@crasbe
Copy link
Contributor

crasbe commented Jun 26, 2025

The two holy words everyone wants to hear, ty 🥳

"Changes Requested", yeah you can have that too 😈

@crasbe crasbe enabled auto-merge June 26, 2025 13:56
@AnnsAnns
Copy link
Contributor Author

He giveth and he taketh away ⛪

@crasbe crasbe added this pull request to the merge queue Jun 26, 2025
Merged via the queue into RIOT-OS:master with commit 05b965a Jun 26, 2025
25 checks passed
@Teufelchen1 Teufelchen1 added this to the Release 2025.07 milestone Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: doc Area: Documentation Area: examples Area: Example Applications CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants