Git Product home page Git Product logo

max7313-arduino's Introduction

MAX7313-Arduino

Arduino Library for the MAX7313 Port Expander by eta systems GmbH


Usage

#include <Wire.h>
#include "MAX7313.h"

MAX7313 pwm(0x27);  // on I2C address 0x27

void setup() {
  pwm.begin();
  pwm.pinMode(0, OUTPUT);
  pwm.pinMode(1, INPUT);
}

void loop(){
    pwm.analogWrite(0, 5);            // set PWM in range 0-15
    pwm.digitalWrite(0, HIGH);        // turn PWM to max
    uint8_t val = pwm.digitalRead(1); // read port 1
}

MIT License

Copyright (c) 2019 eta systems GmbH. All rights reserved.

This Software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

max7313-arduino's People

Contributors

mnemocron avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

gerporgl

max7313-arduino's Issues

Read Input

Hello, the library is very helpful so far.
However, I have a problem with reading out inputs.
I need a bit mask for the exact evaluation of the inputs.
As it is currently in the library, only a numerical value from 0-255 is output.
Do you have a possibility to improve the whole thing, so that one gets only a simple HIGH or LOW for each input?

Many thanks

Problems with interrupt

Hi and a big thanks for this library. It works very welll but I havn't got the interrupt to work. I have the MAX7313 INT pin (1) connected to the Raspberry Pi Pico (GPIO 2) with a pullup to 3.3V (as I understand the INT should go low when a change is noticed).

pinMode(2, INPUT_PULLUP);
attachInterrupt(2, trigged, FALLING );

void trigged(){
  Serial.println("Change happend!");
}

the max code (to enable interrupt)

pwm.pinMode(8, INPUT);
pwm.pinMode(16, OUTPUT);  // Tried without this too
pwm.enableInterrupt();

but nothing happens when I press a button on port 8, if I read the port (digitalRead(8)) I can see when the button is pressed. What am I missing?

Compile Problems with tabs in Arduino IDE

Hello,
The library is often used by me and I would like to thank you very much for maintaining it!
In my latest project I want to increase the clarity and use tabs in IDE.
So in the main INO the tab is added via #include "file.h".
In other projects I have done this several times.
However, errors occur when copmpiling with this library.
I don't have a complete script yet and hope that the excerpts describe my problem well.

Now the question is am I doing something wrong or is the cause of this error coming from the library?

Main INO:

#include <Wire.h>
#include "MAX7313.h"
#include "shutter.h"

const int16_t ADDR = 0x64;
MAX7313 expander(ADDR);

void setup() {
  Serial.begin(115200);
  Wire.begin();
  expander.begin();
  expander.pinMode(0, OUTPUT);
  expander.pinMode(10, INPUT);
  expander.analogWrite(0, 15);
}

void loop() {
  shutter();
}

Shutter.h:

void shutter() {
  unsigned long currentMillis = millis();

  if (expander.digitalRead(JAL_UP_BUTTON) == LOW && expander.digitalRead(JAL_DOWN_BUTTON) == HIGH && down_int == 0) {
      //  Abridged

Error:

Compilation error: 'expander' was not declared in this scope

Missing Class name in digitalWrite function

The function: void digitalWrite(uint8_t num, uint8_t val); in max7313.cpp is missing the "MAX7313::" before the function name.
When Compiling the compiler can not find this function.

Need to add "MAX7313::" to this function then the compiler could find it and the code works.

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.