adafruit / Adafruit_AS7341

Other
29 stars 18 forks source link

Incorrect comment in AS7341 gpio_input_example #12

Closed jfd5041 closed 3 years ago

jfd5041 commented 3 years ago

Here is the complete code listing directly from the AS7341 library examples folder: / This example will use the GPIO pin to blink an led /

include

Adafruit_AS7341 as7341;

void setup() { Serial.begin(115200);

// Wait for communication with the host computer serial monitor while (!Serial) { delay(1); }

if (!as7341.begin()){ Serial.println("Could not find AS7341"); while (1) { delay(10); } } // set the GPIO direction to input so we can read the input if (!as7341.setGPIODirection(AS7341_GPIO_INPUT)){ Serial.println("Could not set the GPIO direction to true to enable"); } }

void loop() { bool gpio_value = as7341.getGPIOValue();

Serial.print("GPIO pin is "); if (gpio_value){ Serial.println("high"); } else { Serial.println("Low"); } delay(500); }

caternuson commented 3 years ago

Yep. Looks like copy pasta from the gpio_example sketch, which is the OUTPUT example for the GPIO. That one would blink an LED attached to the pin. The gpio_input_example is the INPUT example and just prints pin state to the serial monitor. There are no LEDs involved.

Want to PR something with a better first line comment?

jfd5041 commented 3 years ago

Yes, I'll do it while learning how to use Git and GitHub.  Git wasn't even around before I retired; we used SCCS, CVS, and then Subversion. On Tuesday, February 2, 2021, 05:46:50 PM PST, Carter Nelson notifications@github.com wrote:

Yep. Looks like copy pasta from the gpio_example sketch, which is the OUTPUT example for the GPIO. That one would blink an LED attached to the pin. The gpio_input_example is the INPUT example and just prints pin state to the serial monitor. There are no LEDs involved.

Want to PR something with a better first line comment?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

caternuson commented 3 years ago

Closing. Fixed with #13 . Thanks @jfd5041