Simple programing question from beginner

I saw a program for a Heater controller, but did not understand how the pins got given a category, i.e. OUTPUT or INPUT.

Then I decide the pinMode were not given numbers because any pin can be picked to be what you want, (almost).

So, I modified the code to what I think it should look like.

Two questions;

Are my pinMode and digitalWrite done properly? See different font.

Can I leave documenting inside the code? Such as up_key, down_key, relay, etc. As in digitalWrite(2,down_key, high)

The down_key would be to document what the function is>>> Is that permissible?

Thanks, Mavam

Arrgh, yes, pins 9 and 10 should say INPUT.

Lesson Number 4 answered all my questions. :slight_smile:

Mavam

Youtube and github always will help you)

The Arduino Language Reference at https://www.arduino.cc/reference/en/ can be very helpful as well.

https://www.arduino.cc/reference/en/lan … o/pinmode/

https://docs.arduino.cc/learn/microcont … gital-pins

You can either set your pinMode to INPUT_PULLUP, or set it to INPUT then digitalWrite that pin HIGH to enable the pullup.

PinMode (pin, mode), configuring pin mode

Pin: the number of the pin

Mode: The mode of the pin, Input: Input mode, OUTPUT: Output mode, Input_ PULLUP: Input pull-up mode

DigitalWrite (pin, value), specifying the pin output value

Pin: pin number

Value: Pin output value, HIGH: Output high level, LOW: Output low level.

DigitalRead (pin), reads the value of the pin, and calls this function to return the value of the pin, HIGH or LOW

Pin: pin number