Skip to content
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

the content of the example file ReadASCIIString.ino feels odd to me. #35

Open
mj2068 opened this issue Mar 30, 2021 · 0 comments
Open

Comments

@mj2068
Copy link

mj2068 commented Mar 30, 2021

file: examples/04.Communication/ReadASCIIString/ReadASCIIString.ino
`
/*
...
It parses them into ints, and uses those to fade an RGB LED.
Circuit: Common-Cathode RGB LED wired like so:

  • red anode: digital pin 3 through 220 ohm resistor

  • green anode: digital pin 5 through 220 ohm resistor

  • blue anode: digital pin 6 through 220 ohm resistor

  • cathode: GND
    ...

    if (Serial.read() == '\n') {
    // constrain the values to 0 - 255 and invert
    // if you're using a common-cathode LED, just use "constrain(color, 0, 255);"
    red = 255 - constrain(red, 0, 255);
    green = 255 - constrain(green, 0, 255);
    blue = 255 - constrain(blue, 0, 255);
    ...
    "
    `

the implementation of this example file feels odd to me.
i mean the circuit wiring instruction part in the starting comment describes using a Common-Cathode RGB LED, i think people would assume the actual code implementation will be using a Common-Cathode RGB LED as well, but no, the code is actually for a Common-Anode RGB LED, plus the prior comment line confirms the starting comment. don't you feel odd about this? i think we should be consistent comments and code. (at least for me, this took some time to fully figure out the logic of the flow and understand what was going on... idk, maybe it's just me being dumb... :p )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant