Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not able to upload arduino code to A16v3 board
#5
I have tired and the serial communication is working, but the digital pins are not working. Its not going high for the following code. kindly help

Code:
#include "Arduino.h"
#include "PCF8574.h"
#include "wire.h"


// Set i2c address
PCF8574 pcf8574_1(0x24,4,5);
PCF8574 pcf8574_2(0x25,4,5);

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

  pcf8574_1.pinMode(P0, OUTPUT);
  pcf8574_1.pinMode(P1, OUTPUT);
  pcf8574_1.pinMode(P2, OUTPUT);
  pcf8574_1.pinMode(P3, OUTPUT);
  pcf8574_1.pinMode(P4, OUTPUT);
  pcf8574_1.pinMode(P5, OUTPUT);
  pcf8574_1.pinMode(P6, OUTPUT);
  pcf8574_1.pinMode(P7, OUTPUT);

  pcf8574_2.pinMode(P0, OUTPUT);
  pcf8574_2.pinMode(P1, OUTPUT);
  pcf8574_2.pinMode(P2, OUTPUT);
  pcf8574_2.pinMode(P3, OUTPUT);
  pcf8574_2.pinMode(P4, OUTPUT);
  pcf8574_2.pinMode(P5, OUTPUT);
  pcf8574_2.pinMode(P6, OUTPUT);
  pcf8574_2.pinMode(P7, OUTPUT);


    Serial.print("Init pcf8574_1...");
    if (pcf8574_1.begin()){
        Serial.println("PCF8574_1_OK");
    }else{
        Serial.println("PCF8574_1_KO");
    }

  Serial.print("Init pcf8574_2...");
  if (pcf8574_2.begin()){
    Serial.println("PCF8574_2_OK");
  }else{
    Serial.println("PCF8574_2_KO");
  }


}

void loop()
{
  pcf8574_1.digitalWrite(P7, LOW);
  pcf8574_1.digitalWrite(P6, LOW);
  pcf8574_1.digitalWrite(P5, LOW);
  pcf8574_1.digitalWrite(P4, LOW);
  pcf8574_1.digitalWrite(P3, LOW);
  pcf8574_1.digitalWrite(P2, LOW);
  delay(1000);
  pcf8574_1.digitalWrite(P7, HIGH);
  pcf8574_1.digitalWrite(P6, HIGH);
  pcf8574_1.digitalWrite(P5, HIGH);
  pcf8574_1.digitalWrite(P4, HIGH);
  pcf8574_1.digitalWrite(P3, HIGH);
  pcf8574_1.digitalWrite(P2, HIGH);
  delay(1000);

  pcf8574_2.digitalWrite(P7, LOW);
  delay(1000);
  pcf8574_2.digitalWrite(P7, HIGH);
  delay(1000);
}
Reply


Messages In This Thread
RE: Not able to upload arduino code to A16v3 board - by ematicenergies - 04-12-2025, 01:40 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)