Go Down

Topic: Make input high without hardware (Read 206 times) previous topic - next topic



Is there a way to make a input high by software only?
I'm trying to make the interrupt high without the use of any hardware, since the code triggers the interrupt. For now i'm just using the blink sketch. When the first loop is done, the hardware goes to sleep.

Code: [Select]
#define LED_PIN 13
#define INT_OUTPUT 12
#define INT_INPUT 3

#include <Wire.h>
#include <LowPower.h>
#include <VL53L1X.h>

VL53L1X sensor;

void setup() {
  pinMode(LED_PIN, OUTPUT);
  for (int i = 0; i < 20; i++) {
    if(i != 2)
    pinMode(i, OUTPUT);
  attachInterrupt(0, digitalInterrupt, FALLING); //interrupt for waking up

void loop() {

  LowPower.powerDown(SLEEP_FOREVER , ADC_OFF, BOD_OFF);

  digitalWrite(LED_PIN, HIGH);
  digitalWrite(LED_PIN, LOW);
  digitalWrite(0, HIGH);

  if(INT_INPUT == HIGH){
    digitalWrite(LED_PIN, HIGH);
    digitalWrite(LED_PIN, LOW);


void digitalInterrupt(){
  //needed for the digital input interrupt


Look at the differences between that, and the example sketch:
Code: [Select]
// **** INCLUDES *****
#include "LowPower.h"

// Use pin 2 as wake up pin
const int wakeUpPin = 2;

void wakeUp()
    // Just a handler for the pin interrupt.

void setup()
    // Configure wake up pin as input.
    // This will consumes few uA of current.
    pinMode(wakeUpPin, INPUT);   

void loop()
    // Allow wake up pin to trigger interrupt on low.
    attachInterrupt(0, wakeUp, LOW);
    // Enter power down state with ADC and BOD module disabled.
    // Wake up when wake up pin is low.
    LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
    // Disable external pin interrupt on wake up pin.
    // Do something here
    // Example: Read sensor, data logging, data transmission.
  ... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.


No way to trigger the interrupt without the hardware. But please tell me why do you want to do that? You need to have the interrupt pin free from any other connection if you want to use interrupts.

Don't ever give up from your projects. Post in the forums, everyone will help you : )


No way to trigger the interrupt without the hardware.
That's not true.

If you set one of the interrupt pins as OUTPUT and change it from LOW to HIGH with digitalWrite() (or vice versa) it will trigger the interrupt.

Two or three hours spent thinking and reading documentation solves most programming problems.


This is nonsense...
Code: [Select]

#define INT_INPUT 3

To check a pin state you need to call digitalRead().

Go Up