Hello dear community. I am beginner with Arduino and I am trying to make simple interrupt where in loop you got IF, IF int 1 then turn on code else do nothing but when I connect my button and write an interrupt with int++ then nothing. The int is not getting new value.
Part of my code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); // nastavenie portov pre LCD
#define echoPin 11
#define trigPin 12
int LED = 13;
long duration, distance;
const int interruptPin = 2;
volatile int cislo = 0;
MarvelSK:
I am trying to make simple interrupt where in loop you got IF, IF int 1 then turn on code else do nothing
I wouldn't say "else do nothing". Your code prints the value of cislo to the LCD in the else clause.
MarvelSK:
The int is not getting new value.
"The int" is a very vague statement. If you want to have success in programming and electronics you will need to train yourself to be very precise. You have multiple "int"s in your code. We give variables names so that they are easy to refer to. It's the same idea as giving people and towns names. You wouldn't say "I talked to person" you would say "I talked to Susan". Why wouldn't you use the name of the variable when talking about it?
pert:
I wouldn't say "else do nothing". Your code prints the value of cislo to the LCD in the else clause.
"The int" is a very vague statement. If you want to have success in programming and electronics you will need to train yourself to be very precise. You have multiple "int"s in your code. We give variables names so that they are easy to refer to. It's the same idea as giving people and towns names. You wouldn't say "I talked to person" you would say "I talked to Susan". Why wouldn't you use the name of the variable when talking about it?