constant signal

I have hardwired thermal controller with a pushbutton boost. The boost is reset when at temp with a constant reset (low) (until temp drops and the reset goes high). The reset switches a boost (roof PVcell controller off for 3 seconds). I have a capacitor / resistive circuit which produces this 3 secs delay. I want to control using a Mega and programmed timing without the res/cap time circuit. To do this I need to reset the input pin to go high after initial low. At present the input stays low and the timing loop is not initiated until pin retns to high by 10K resistor. How do I code to get this timing

How do I code to get this timing

You will need to make changes to the code that you have not posted (HINT !)

How do I code to get this timing

Sorry, but I don't understand your description of what you want to achieve - can you express it more clearly please?


In escence the pin(2 input) stays low (satisfied) until the temp changes then goes high (call). The output pin(10 output) is low and will only change when pin(2) goes high, which initiates the delay loop for 3 secs, pin(10)goes high then returns to low after 3 secs. I have tried rising and dropping edge, change pin 2 to output after delay, debounce etc but can't seem to get the timing cycle to work unless the state of pin (2) changes. Does this make more sense. Please be kind to me, I am a newby to code I'm afraid. How do I get pin(2) to be momentary using code akin to a pushbutton for instance. Thanks

Still no code posted, hence it is still not possible to provide help

A schematic of the circuit, hand drawn is OK, would help too

here is the code. How do I code to make multi shot i.e further cycles when pin 2 goes high then low again?

//* Takes pin 10 low for 3 seconds when continuous low applied to pin 2. Doesn't reset, one shot only. Doesn't reset when pin 2 goes high (pullup 10K)

//The circuit:
//*pin 2 connected to thermal controller
//*pin 10 connected to reset toggle
const int buttonPin = 2; //the number of the pushbutton pin
const int LEDPin = 10; //the number of the enable pin
int buttonState; //variable for the pushbutton status
unsigned long ontime = 10; //variable for the alarm on-time
unsigned long currentMillis;
long previousMillis = 0;

void setup() {
pinMode(LEDPin, OUTPUT); //initialize the LED pin as an output
pinMode(buttonPin, INPUT); //initialize the pushbutton pin as an input
pinMode ( buttonPin, FALLING);
Serial.begin(9600); //initialize serial communication for debugging

unsigned int debounceTime = 3000;

void loop() {

static bool ledOn = false;
static unsigned long buttonTm = 0;
static unsigned long ledTm = 0;

// always debounce your inputs, but debouncing uses a different time counter
// than your LED on, necessarily, as you want to be able to press the button
// more than once every on period

if( digitalRead(buttonPin) == 0 && millis() - buttonTm > debounceTime ) {

buttonTm = millis();

if( ledOn ) {
// LED is already on, turn it off
digitalWrite(LEDPin, 0);
//ledOn = false;
else {
// LED is not on, turn it on
digitalWrite(LEDPin, 1);
ledOn = true;