arduino / arduino/ArduinoCore-samd

SamdSercom tutorial has a bug: integer is read but only byte is sent

Open
#552 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
502
Forks
740
PR merge metrics
No merged PRs in 30d

Description

In the "Adding more Serial Interfaces to SAMD microcontrollers (SERCOM)" tutorial, in the section for "Create a new Serial instance", the example code shows:

````
int sensorValue = analogRead(A0);
// print out the value you read on mySerial wired in loopback:
mySerial.write(sensorValue);
````
analogRead() will return values greater than 256 (assuming the resolution of the ADC is the default 10 bits) but the write() will only write a byte. This should be explained, and optionally scaled to fit in a byte.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the “Adding more Serial Interfaces to SAMD microcontrollers (SERCOM)” tutorial and its “Create a new Serial instance” section. Review the analogRead() and mySerial.write() example, then update the explanation so the ADC value’s size and the transmitted byte behavior are clear; done means the example accurately documents the result and any scaling choice.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.