Git Product home page Git Product logo

arduinoduppalib's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduinoduppalib's Issues

Support Arduino Uno R4 minima

Hi,
i tried my old code for the arduino uno R3 on my new R4 but i get random outputs such as:

18:28:09.506 -> Max!
18:28:10.492 -> Max!
18:28:16.494 -> Push: 
18:28:17.481 -> Increment: 255
18:28:20.494 -> Increment: -256
18:28:23.481 -> Max!
18:28:24.496 -> Max!
18:28:30.507 -> Push: 
18:28:31.494 -> Increment: 255
18:28:34.485 -> Increment: -256
18:28:37.508 -> Max!
18:28:38.480 -> Max!

They are mechanically connected in the same way, any ideas?
Thanks"

Brightness Difference between 3.3v and 5v?

While working on two different projects, I noticed a brightness difference of the RGB LED built into an encoder. My guess is that this brightness difference is because one project is powering the board with 3.3v and the other with 5v. I would have assumed that 5v was being stepped down to 3.3v internally, but maybe I'm wrong? Does 5v result in a brighter RGB LED in the encoder?

REL_MODE_ENABLE

Hello.

I have the pdf manual but I don't see what is the exact way to activate Relative mode: REL_MODE_ENABLE

Now I have found that relative mode has been inserted into lib i2cEncoderLibV2 ..
Is there any way to activate it on the EncoderMini??

Thank you, -Fede

I2C Encoder Mini - Long Push Duration

I am using I2C Encoder Mini. Good product. I see that this can detect a long push. Is there any way to change the duration after which a long push event is being sent ?

thank you

ESP32 and mini I2C encoder

I saw this project in different places and also Arduino forum some ember recommend it. This is not an issue I am trying to know if purchase this product.

In my project I have a rotary encoder connected to my ESP32 and its very unstable. eg: turn the encoder four steps to right and the result could be:
1
2
3
4
3
4
5
6
7
7
8
9
8
7
9
10

other issues: if I move the shaft half way ( like not complete the step ) I will get values that are not correct. It seems to be a problem with ESP32 and ecoders.

My question here is: This I2C encoder fixes that problems with ESP32? of course I could take advantage of the I2C and free pins but is not the most important.

Launch All state reactions(interrupt ) if a second encoder is not connected

Hi. There is a bug whereby if an encoder is missing(optional) and I call updateStatus().
In this case All interrupt routines are launched for
Encoder is released!
Encoder is pushed!
Encoder is long pushed!
Encoder is double pushed!
..
all this because this function does not check the error reported by the I2C bus
_stat = readEncoderByte(REG_ESTATUS);
receive -1 = 255

in lib i don't see a test function to check the connection.

I would add a "connected" boolean during setup or reset or begin

For the rest I am fine .. thanks
-Federico

Error compiling for board Arduino/Genuino Mega or Mega 2560.

"Basic with Callbacks" example.
Works fine for Nano, but fails on the Arduino Mega 2560 - it can't compile the sketch

Build options changed, rebuilding all
In file included from /Users/redacted/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/avr/include/avr/iom2560.h:38:0,
                 from /Users/redacted/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/avr/include/avr/io.h:174,
                 from /Users/redacted/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/avr/include/avr/pgmspace.h:90,
                 from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:28,
                 from /Users/redacted/Documents/Arduino/libraries/ArduinoDuPPaLib/src/i2cNavKey.h:19,
                 from /Users/redacted/Documents/Arduino/libraries/ArduinoDuPPaLib/src/I2CNavKey.cpp:15:
/Users/redacted/Documents/Arduino/libraries/ArduinoDuPPaLib/src/i2cNavKey.h:101:3: error: expected identifier before numeric constant
   INT2 = 0x8000,
   ^
/Users/redacted/Documents/Arduino/libraries/ArduinoDuPPaLib/src/i2cNavKey.h:101:3: error: expected '}' before numeric constant
/Users/redacted/Documents/Arduino/libraries/ArduinoDuPPaLib/src/i2cNavKey.h:101:3: error: expected unqualified-id before numeric constant
In file included from /Users/redacted/Documents/Arduino/libraries/ArduinoDuPPaLib/src/I2CNavKey.cpp:15:0:
/Users/redacted/Documents/Arduino/libraries/ArduinoDuPPaLib/src/i2cNavKey.h:182:20: error: expected ')' before 'add'
  i2cNavKey(uint8_t add);
                    ^
/Users/redacted/Documents/Arduino/libraries/ArduinoDuPPaLib/src/i2cNavKey.h:196:18: error: 'Int_Status' was not declared in this scope
  bool readStatus(Int_Status s);
                  ^
/Users/redacted/Documents/Arduino/libraries/ArduinoDuPPaLib/src/i2cNavKey.h:197:26: error: 'uint16_t readStatus()' redeclared as different kind of symbol
  uint16_t readStatus(void);
                          ^
/Users/redacted/Documents/Arduino/libraries/ArduinoDuPPaLib/src/i2cNavKey.h:196:7: note: previous declaration 'bool readStatus'
  bool readStatus(Int_Status s);
       ^
/Users/redacted/Documents/Arduino/libraries/ArduinoDuPPaLib/src/i2cNavKey.h:275:1: error: expected unqualified-id before 'private'
 private:
 ^
/Users/redacted/Documents/Arduino/libraries/ArduinoDuPPaLib/src/i2cNavKey.h:292:1: error: expected declaration before '}' token
 };
 ^
Multiple libraries were found for "i2cEncoderLibV2.h"
 Used: /Users/redacted/Documents/Arduino/libraries/ArduinoDuPPaLib
 Not used: /Users/redacted/Documents/Arduino/libraries/ArduinoDuPPaLib-1.2.0
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

Though the problem seems to be specifically about the NavKey which I'm not using.

If I delete I2CNavKey.h and I2CNavKey.cpp from the folder in my library, then it DOES work

I guess that should actually make this an issue for I2CNavKey and not this, however I will leave this here, since they are a "combined" library and others may not realise

Compile errors for teensy_RGB_encoder example

Trying to test some v2.0 encoder boards I have but I'm getting the following compile error:
`C:\Users\jrsph\Documents\Arduino\libraries\ArduinoDuPPaLib-master\src\LEDRing.cpp: In member function 'void LEDRing::LEDRing_ClearAll()':

C:\Users\jrsph\Documents\Arduino\libraries\ArduinoDuPPaLib-master\src\LEDRing.cpp:96:12: error: 'PWM_MODE' was not declared in this scope

PWM_MODE();

        ^

Error compiling for board Teensy 3.2 / 3.1.`

What am I missing?

EEPROM usage

Hi Saimon!

If I want to control 4 virtual encoders with 1 encoder, can I use this eeprom to store and recall the positions of the virtual encoders?
Is it possible to make additional divisions in it by shifting?

LEDRing issue with ESP32

Just tried to compile up the demo for the LEDRing on my ESP32. It fails with :-

Arduino: 1.8.12 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"
In file included from C:\Users\ajm1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/esp32-hal.h:53:0,
from C:\Users\ajm1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Arduino.h:35,
from sketch\Demo.ino.cpp:1:
C:\Users\ajm1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/esp32-hal-gpio.h:35:27: error: expected unqualified-id before numeric constant
#define PULLUP 0x04
^
`C:\Users\ajm1\Documents\Arduino\libraries\ArduinoDuPPaLib-master\src/LEDRing.h:56:10: note: in expansion of macro 'PULLUP'` ` void PULLUP(uint8_t pull);` ` ^`
C:\Users\ajm1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/esp32-hal-gpio.h:37:27: error: expected unqualified-id before numeric constant
#define PULLDOWN 0x08
^
`C:\Users\ajm1\Documents\Arduino\libraries\ArduinoDuPPaLib-master\src/LEDRing.h:57:10: note: in expansion of macro 'PULLDOWN'` ` void PULLDOWN(uint8_t pull);` ` ^`
C:\Users\ajm1\AppData\Local\Temp\arduino_modified_sketch_714030\Demo.ino: In function 'void setup()':
`C:\Users\ajm1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/esp32-hal-gpio.h:35:27: error: expected unqualified-id before numeric constant` ` #define PULLUP 0x04` ` ^`
C:\Users\ajm1\AppData\Local\Temp\arduino_modified_sketch_714030\Demo.ino:36:11: note: in expansion of macro 'PULLUP'
LEDRing.PULLUP(0b111); // 32k pull-up resistor for avoid ghost effect
^
`C:\Users\ajm1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/esp32-hal-gpio.h:37:27: error: expected unqualified-id before numeric constant`
#define PULLDOWN 0x08
^
`C:\Users\ajm1\AppData\Local\Temp\arduino_modified_sketch_714030\Demo.ino:37:11: note: in expansion of macro 'PULLDOWN'` ` LEDRing.PULLDOWN(0b111); // 32k pull-down resistor for avoid ghost effect` ` ^`
exit status 1
Error compiling for board ESP32 Dev Module.

It seenms that both PULLUP and PULLDOWN are used as part of the ESP32 core functionality.

I changed the LEDRing.h and LEDRing.cpp to use LRPULLDOWN/LRPULLUP and changed the demo code to then use those and it compiled and worked perfectly. I'm not sure that's a good fix however. But works for now.

Has the encoder mini board changed?

Hey @Fattoresaimon

I ordered some encoder mini boards again. What i encountered, that my code, that i am using in the boards ordered last summer is not working anymore, unless i include Wire.h and Wire.begin() in setup.

Before i did not need to do so. Is this now mandatory? Otherwise the arduino is stuck at setup (at the point of initialising the encoder). It does not depend on how many boards i use.

Because as far as i can tell, you are including the Wire.h already in your library, so i only use your standard comments, defined in your library, that is why i wonder about the need of Wire in my own code now

Best regards!

Bug - Triple pressing acts as a double push instantly followed by a single press

Triple pressing acts as a double push instantly followed by a single press. Realistically this should still fall under control of the debouncing methods, given that's it's highly unlikely someone wants to action a double press and then a single press like that. Ideally, it should not register the 3rd press... so in other words, it should action the double press method and ignore the 3rd press (within the debounce period)

compile errors Implementing your library

Hey Saimon, I have two different programs using a Teensy 4.1, Arduino 1.8.12 IDE, and your latest, i2cEncoderLibV2.h. One program compiles without problems. The other program is giving me errors with my functions that handle .onChange, .onButtonRelease, onMinMax, and .onFadeProcess.

I configure the events:

        I2C_Encoder[i2c_enc_cnt].onChange = encoder_rotated;
        I2C_Encoder[i2c_enc_cnt].onButtonRelease = encoder_click;
        I2C_Encoder[i2c_enc_cnt].onButtonDoublePush = encoder_doubleclick;
        I2C_Encoder[i2c_enc_cnt].onMinMax = encoder_thresholds;
        I2C_Encoder[i2c_enc_cnt].onFadeProcess = encoder_fade;

and for example, the encoder_rotated function looks like this:


void encoder_rotated(i2cEncoderLibV2* obj) {
  switch (obj->id) {
    case 0:
      // Volume encoder
      //  codec.lineOutLevel(obj->readCounterInt()); // Set Line-out voltage level
      if (obj->readStatus(i2cEncoderLibV2::RINC)) {
        Serial.print("Volume Up ");
      }
      else
        Serial.print("Volume Down ");
        Serial.println(obj->readCounterInt());
      obj->writeRGBCode(0x00FF00);
      break;
    case 1:
      // Gain encoder
      if (obj->readStatus(i2cEncoderLibV2::RINC))
        Serial.print("Gain Up ");
      else
        Serial.print("Gain Down ");
        Serial.println(obj->readCounterInt());
      obj->writeRGBCode(0x00FF00);
      break;
    case 2:
      //Filter encoder
      if (obj->readStatus(i2cEncoderLibV2::RINC))
        Serial.print("Flt Increment ");
      else
        Serial.print("Flt Decrement ");
        Serial.println(obj->readCounterInt());
      obj->writeRGBCode(0x00FF00);
      break;
  }

I'm getting a compile errors like the following, but for all the events, not just onChange :

ra8875:279: error: variable or field 'enc_rotate' declared void
 void enc_rotate(i2cEncoderLibV2* obj) {
                 ^
ra8875:279: error: 'i2cEncoderLibV2' was not declared in this scope
ra8875:279: error: 'obj' was not declared in this scope
 void enc_rotate(i2cEncoderLibV2* obj) {
                                  ^
variable or field 'enc_rotate' declared void

I've been trying to figure this out for a day now and it might have something to do with the Arduino IDE and auto-prototyping?

I've posted the code for both programs on a gist: https://gist.github.com/jrsphoto/f257f607b948ddf7aad47ef6463ba077

The file backpack_sdr_jrs_ili9341_audiosdr_i2c_encoders.ino will compile and function;
The file ra8875_spectrum.ino is the one that is giving me the errors.

If you can help, I would be grateful.

Multiple encoders

Hi!
Can you help? I don't fully understand how to assign tasks by ID for multiple encoders.
If I use multiple encoders, how do I request information for a particular encoder? How can I associate behavior with an ID. For example: If the encoder ID is X, do you do it, and if the encoder ID is Y, do you do it?

void encoder_rotated(i2cEncoderLibV2* obj) {
  if (obj->readStatus(i2cEncoderLibV2::RINC))
    Serial.print("Increment ");
  else
    Serial.print("Decrement ");
  Serial.print(obj->id);
  Serial.print(": ");
  Serial.println(obj->readCounterInt());
  "if the ID = 0" writeRGBCode(0x0000FF);
  "if the ID = 1" writeRGBCode(0x00FF00);
}

Thanks in advance.

Encoder absolute position

Hi! I would like to use an encoder for multiple functions (MIDI CC controller) using a menu system I would tell the encoder which one to change. I want to be able to use the controller on IOS too so the -1 / + 1 signal of the encoder is not enough for me (relative). I would need the absolute position of the encoder which I would also need to store due to bank changes. I guess your encodered is capable of this?

Serial monitor bugging out on all examples

Well I thought I wired my array of v2.1 encoders correctly but the serial monitor is getting a constant signal:

Increment: 255
Increment: -256
Max!
Max!
Push: 
Increment: 255
Increment: -256
Max!
Max!

I tried using an i2c scanner for my teensy 3.2 and unfortunately I'm getting:

Scanning...
Unknown error at address 0x01
Unknown error at address 0x02
...
No I2C devices found

I've got 4.7k resistors on the i2c wires but do I need to solder the onboard resistor as well for the chain? Or should a single onboard pull up resistor be enough for a chain of 24?

Econder diagnostic question

Hello!
I'm looking forward some diagnostic solution for this i2cEncoder, basically the I2C bus is already covered.
Since I couldn't find any CRC or inverse stored register, how can I catch any HW failure?
The best I've come up with:

int encoderErrorcounter;
while (0 == Encoder.readCounterInt())
{
encoderErrorcounter++;
Encoder.writeCounter((int32_t)65535);
if (encoderErrorcounter >= 5)
{
Serial.println("Encoder error!");
break;
}
}

Is there a better way? Or any hints welcome...
Best regards,
Andras

Bug in autoconfigInterrupt()

Hi!

The autoconfigInterrupt() method does not check for the onIncrement callback, and so does not set the according bit in the interrupt register.

This code should be added:

if (onIncrement != NULL) reg |= RINC;

Thanks,

Frédéric

I2C Encoder Mini - Interrupt Pin does not go Low

I recently purchased a I2C Encoder Mini and attached it to an Arduino Duemilanove ( - -> GND, + -> 5V, SDA -> A4, SCL -> A5, INT -> A3) and uploaded the example Basic_with_Callbacks.ino.

The INT Pin always stays on 5V. (Checked also wit oscilloscope)

If i just execute Encoder.updateStatus() in the loop() without "if (digitalRead(IntPin) == LOW) " all Callback-Routines are executed and output on the serial Monitor.

Am i missing something in the setup()?

Coding of example
Encoder.reset();

Encoder.begin(i2cEncoderMiniLib::WRAP_ENABLE
| i2cEncoderMiniLib::DIRE_LEFT | i2cEncoderMiniLib::IPUP_DISABLE
| i2cEncoderMiniLib::RMOD_X1 );

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.