server to send/receive updates via GET/POST (Bridge library)
LCD 1602 with keybuttons
rotary encoder with interrupt code on digital pins 2-3 (INT 0 & 1)
analog temp sensor
few relays
In this setup everything is working as expected.
LCD screen that I'm using is taking all the digital pins and I needed few more, I decided to use the same 1602 LCD with I2C controller, that requires only 2 digital pins, instead of 5.
Here is the problem with new setup:
I2C has to be connected to SDA/SCL which is pin 2/3 on Arduino Yun (pins are also duplicated)
Encoder was using interrupts on pin 2/3, I have tried to move it somewhere else but it seems I have no options on Yun (pins 0 & 1 (INT 0 & 1) and pin 7 reserved/used by the board) when I'm using those pins nothing works.
i tried EnableInterrupt library to change pin interrupt but it didn't help
Please confirm that I'm out of luck with this setup.
Pin 0 and 1 are indeed used by the Bridge, and pin 2 and 3 are the I2C bus.
So there goes all the normal interrupts. Pin 7 interrupt is reserved for future use.
Thank you for your response, Koepel. Your post gives me hope
This is what I've tried before (LCD is not connected)
// default arduino
attachInterrupt(digitalPinToInterrupt(3), myfunction, LOW); // Encoder works
// 3rd party library
enableInterrupt(3, myfunction, LOW); //Encoder works
// now with LCD i2c on 2/3
enableInterrupt(7, myfunction, LOW); // app starts, but when encoder is moved, it crashes, perhaps because of "handshake"
enableInterrupt(8, myfunction, LOW); // Encoder is not working
enableInterrupt(9, myfunction, LOW); // Encoder is not working
enableInterrupt(10, myfunction, LOW); // Encoder is not working
enableInterrupt(11, myfunction, LOW); // Encoder is not working
Please tell me what I am doing wrong. I can try it out tonight.
// Test with Arduino Leonardo and EnableInterrupt with pin 8, 9, 10, 11
// https://github.com/GreyGnome/EnableInterrupt
#include <EnableInterrupt.h>
const int pcintPin = 8; // test with 8, 9, 10, 11
volatile uint16_t interruptCount=0; // The count will go back to 0 after hitting 65535.
void interruptFunction()
{
interruptCount++;
}
void setup()
{
Serial.begin( 9600);
while( !Serial); // wait for for serial monitor to open
pinMode( pcintPin, INPUT_PULLUP);
enableInterrupt( pcintPin, interruptFunction, CHANGE);
}
void loop()
{
Serial.print( "Pin was interrupted: ");
Serial.print( interruptCount, DEC);
Serial.println( " times so far.");
delay(1000);
}