Inside the arduino commands

Hello all!
I am reading a tutorial that came with my after marktet Arduino kit. It teaches about Digital inputs.
In the lesson, we learn how to use push buttons with digital inputs to turn an LED on and off.
Pressing the button will turn the LED on; pressing the other button will turn the LED off.

What I am more interested is to disect the premade commands. I want to see the .h files that set and talk about the pinMode command, digitalRead etc.

I want to see the inside of the command INPUT_PULLUP. etc.

Where can i find such info?

Uusually .h files have such info. Where can I find the file.
Thank you


//www.elegoo.com
//2016.12.08

int ledPin = 5;
int buttonApin = 9;
int buttonBpin = 8;

void setup() 
{
  pinMode(ledPin, OUTPUT);
  pinMode(buttonApin, INPUT_PULLUP);  
  pinMode(buttonBpin, INPUT_PULLUP);  
}

void loop() 
{
  if (digitalRead(buttonApin) == LOW)
  {
    digitalWrite(ledPin, HIGH);
  }
  if (digitalRead(buttonBpin) == LOW)
  {
    digitalWrite(ledPin, LOW);
  }
}

On my system the files are in the Arduino IDE installation folder at ... \arduino-1.8.12\hardware\arduino\avr\cores\arduino. The .h and .cpp files for the Arduino functions are there ( for the AVR processors).

YES!! I found what I was looking for.

BTW, who are the guys who wrote this code for us, so that we dont have to setup the ATMega chip everytime we wanna use it? Where are theses guys?

Explainer: What is Arduino?

One thing to note is that each Arduino boards platform has its own core library that defines the standard Arduino API like pinMode, etc. Even though the public interface is consistent from one board to another, the underlying code in the core might be completely different. groundFungus's instructions got you to the core of the "Arduino AVR Boards" platform of the Uno, Mega, Leonardo, etc. and it sounds like this was indeed what you were looking for, but if you were using something like a SAMD architecture based Arduino MKR board, it is located in another place on your computer. If you turn on "Show verbose output during > Compilation" in the Arduino IDE's File > Preferences, then check the contents of the black console pane at the bottom of the Arduino IDE window after compiling, you will find the location of the active core library for the board you had selected during the compilation. For example:

Using core 'arduino' from platform in folder: C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3

Another thing to note is that the Arduino IDE installation comes with a bundled copy of the Arduino AVR Boards platform, but if you ever do an update of the platform via the Arduino IDE's Boards Manager, it is installed to a different location and the copy bundled with the Arduino IDE is no longer used. This can result in a confusing time if you decide you want to tinker around with modifications to the platform and then discover they are having no effect.

Also here: ArduinoCore-avr/cores/arduino at master · arduino/ArduinoCore-avr · GitHub

digitalWrite() and company were conceived by Hernando Barragan as part of a master's project "Wiring" to bring "physical computing" to non-technical folk. There's a bunch of background and some rather bitter recriminations here: https://arduinohistory.github.io/
A lot of development has happened since then, contributed by a lot of different people. There's a big difference between creating a project and supporting a community for 15+ years...

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.