This is progress at least!
Please provide a link to the web page you obtained the non-working examples from.
Please post your full sketch.
I'll provide instructions you can follow to do that:
- Select Tools > Auto Format from the Arduino IDE menus.
ⓘ This is done to make the code easier for us to read. - Select Edit > Copy for Forum (Markdown) from the Arduino IDE menus.
- Open a reply here on this forum topic by clicking the "Reply" button.
- Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
This will paste the sketch to the post composer. - Move the cursor outside of the code block markup before you add any additional text to your reply.
- Repeat the above process if your sketch has multiple tabs.
- Click the "Reply" button to publish the post.