Skip to content

Setting (digitalWrite) pin y, unsets pin x #102

Open
@FunDeckHermit

Description

@FunDeckHermit
  • Arduino board: Custom board

  • Arduino IDE version (found in Arduino -> About Arduino menu): PlatformIO

  • List the steps to reproduce the problem below:
    Run below sketch, it is expected that pin5 is toggling every 2 seconds.
    It will however prematurely turn off setting another pin.

#include <Arduino.h>
#include <Adafruit_MCP23X08.h>

Adafruit_MCP23X08 mcp;
TwoWire my_wire(0);

void setup()
{
    Serial.begin(460800);

    my_wire.setPins(5,6);
    mcp.begin_I2C(0x27, &my_wire);
    mcp.pinMode(5, OUTPUT);
    mcp.pinMode(6, OUTPUT);
}

void loop()
{
    delay(2000);
    digitalWrite(1, HIGH);
    mcp.digitalWrite(6,LOW);
    
    delay(2000);
    digitalWrite(1, LOW);
    mcp.digitalWrite(6,HIGH);
    
    mcp.digitalWrite(5,HIGH); //This write also sets pin6 low ???
    delay(50);
    mcp.digitalWrite(5,LOW);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions