Is it possible to trick the Arduino IDE into reading data from pins that only exist in software?

kadoat
Posts: 2
Joined: Tue Sep 22, 2020 12:01 am

Is it possible to trick the Arduino IDE into reading data from pins that only exist in software?

Postby kadoat » Tue Sep 22, 2020 12:38 am

For example, the ESP32 has 34 GPIO pins. On n pin 4 you connect a push button, and on pin 5 you connect an LED. Under normal circumstances, you would write your code such that if pin 4 reads LOW (button pressed), pin 5 outputs HIGH and the LED turns on.

Now, is there a way to send the raw data from pin 4 to an artificially created pin - say, pin 36 - such that you could run the same program from above? The only deference being the program references pin 36 instead of pin 4 for turning on the LED.

I don't want to create an abstraction above the Arduino IDE. The Arduino IDE has to think this pin is an honest to goodness pin so that any random user can use whatever existing libraries they like. Could I possibly modify the ESP32 board files that the IDE references to give it this functionality?

mrburnette
Posts: 22
Joined: Mon Feb 12, 2018 6:50 pm

Re: Is it possible to trick the Arduino IDE into reading data from pins that only exist in software?

Postby mrburnette » Wed Sep 30, 2020 4:01 am

kadoat wrote:
Tue Sep 22, 2020 12:38 am
...
Now, is there a way to send the raw data from pin 4 to an artificially created pin - say, pin 36 - such that you could run the same program from above? The only deference being the program references pin 36 instead of pin 4 for turning on the LED.
...
Arduino is messy, look at any hw variant file pins_arduino.h and notice the pins are constants


Excerpt:

Code: Select all

static const uint8_t TX = 1;
static const uint8_t RX = 3;

static const uint8_t SDA = 22;//23;
static const uint8_t SCL = 21;//19;

static const uint8_t SDA1 = 12;
static const uint8_t SCL1 = 13;

static const uint8_t SS    = 5;
static const uint8_t MOSI  = 23;
static const uint8_t MISO  = 19;
static const uint8_t SCK   = 18;

Who is online

Users browsing this forum: No registered users and 87 guests