To what?
What does the application do?
What are its inputs and outputs?
Please be more specific.
Thanks.. Tom..
To what?
What does the application do?
What are its inputs and outputs?
Please be more specific.
Thanks.. Tom..
This time around, I'm out for good. You're on my ignore list.
To digitalize legacy machines
Thanks.. Tom..
no
long way ahead until it will really work
If you want to use a GPIO as input and as output at the same time you have to
open the plastic covering of the ESP32-chip
and connect the input-gate with a 5ยตm thin goldwire with the source of the output MOSFET.
A post was split to a new topic: Digitalize legacy machine
It's possible but dangerous. The AVR PINx registers show the (external) pin state, while PORTx registers show the intended output state. If both differ and the output is enabled then either end of the line may release the magic smoke.
FYR,
Arduino UNO
The tricky thing is not programming. It is how to do the circuit design, read and write in the same pin, and consider leak current when pressing the button switch.
Concept
Project: InOutInOun (IOIO) project
The objective is to see the led status when pressing the pushbutton on the ON and OFF states I call hold last value.
STATE: ON
STATE: OFF
What the controller work is toggle LED on/off every second,
The above picture shows the current leak's result of 10-20 ฮผA (300-350 mV) when pressing a button. It is only done on a tinkercad simulator .
The below code for reference,
#define ioPin 12 // Define Input/Output Pin
MicroBeaut_Trigger trigger; // Read Input Trigger Function
const float intervalReadInput = 0.010; // Read Input Interval = 10 milliseconds
bool inputState; // Input State
MicroBeaut_Blink blinkOutput; // Blink Function for RED and Green LEDs
bool outputState = false; // Output State
MicroBeaut_Blink ledBuiltin; // Blink Function for LED_BUILTIN
bool builtinState; // State for LED_BUILTIN
const float blinkDelay = 1.0; // Time Delay 1.0 second
void setup() {
pinMode(LED_BUILTIN, OUTPUT); // Set Pin to OUTPUT Mode
pinMode(ioPin, OUTPUT); // Set Pins to Output Mode
digitalWrite(ioPin, outputState); // ON/OFF LEDs
trigger.SetTimeDelay(intervalReadInput); // Initial Trigger Time
}
void loop() {
if (trigger.Trigger(true)) {
pinMode(ioPin, INPUT); // Set Pins to Input Mode
inputState = digitalRead(ioPin); // Read Input State (1 = Press, 0 = Release)
pinMode(ioPin, OUTPUT); // Set Pins to Output Mode
}
outputState = blinkOutput.Blink(!inputState, blinkDelay); // Get State from Blink Function
digitalWrite(ioPin, outputState); // ON/OFF LEDs
builtinState = ledBuiltin.Blink(true, blinkDelay); // Get State from Blink Function
digitalWrite(LED_BUILTIN, builtinState); // ON/OFF LED_BUILTIN
}
Please do not attach your request to an existing thread, it is considered "hijacking". Please start a new one.
Thanks, I'll be careful about this.
Thanks. What is your programming question?
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.