I2C not working with Wire.h only get address byte out

I have been trying to get my UNO to send a series of bytes out the I2C lines. I have been using the Wire.h library. It seems to send the address byte correctly, but then I can not get it to send out a second byte in a string.

#include <Servo.h>
//#include <EEPROM.h>
#include <Wire.h>


Servo servo;

void setup() {
  
  // Unused pins
  pinMode(0, OUTPUT);
  digitalWrite(0, HIGH);
  pinMode(1, OUTPUT);
  digitalWrite(1, HIGH);

  pinMode(A0, OUTPUT);
  digitalWrite(A0, HIGH);
  pinMode(A1, OUTPUT);
  digitalWrite(A1, HIGH);
  pinMode(A2, OUTPUT);
  digitalWrite(A2, HIGH);
  //pinMode(A4, OUTPUT);
 // digitalWrite(A4, HIGH);
 // pinMode(A5, OUTPUT);
 // digitalWrite(A5, HIGH);

  // Used pins
  
  Wire.begin(); // join i2c bus master
  
  pinMode(A3, INPUT_PULLUP);    // Button input with pull-up
//  digitalWrite(A5, HIGH);
  
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW); // Indicator LED off
  
  pinMode(lspPin, INPUT);   // Left speed sensor input
  pinMode(rspPin, INPUT);   // right speed sensor input

  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  digitalWrite(trigPin, LOW);

  pinMode(enAPin, OUTPUT);
  pinMode(in1Pin, OUTPUT);
  pinMode(in2Pin, OUTPUT);
  pinMode(in3Pin, OUTPUT);
  pinMode(in4Pin, OUTPUT);
  pinMode(enBPin, OUTPUT);

  servo.attach(servoPin);
}

byte valq = 0;



void loop() {

  Wire.beginTransmission(3); // transmit to device #44 (0x2c)
                              // device address is specified in datasheet
  Wire.write(valq);             // sends value byte  
  Wire.endTransmission();     // stop transmitting

  valq++;        // increment value
  if(valq == 64) // if reached 64th position (max)
  {
    valq = 0;    // start over from lowest value
  }


  delay(100);
}

robot-carNt1.ino (8.52 KB)

When the I2C address 0x03 does not exist on the I2C bus, then the rest is not transmitted.
Is it a CAP1188 chip ?

  Wire.beginTransmission(3); // transmit to device #44 (0x2c)

In this line either the address byte (3) or the comment (44) is wrong.

It seems to send the address byte correctly, but then I can not get it to send out a second byte in a string.

How do you know? Why don't you check the result of Wire.endTransmission()? It might give you insights what went wrong. My guess is that you're using a wrong address. Have you tried an I2C scanner sketch?

Koepel:
When the I2C address 0x03 does not exist on the I2C bus, then the rest is not transmitted.
Is it a CAP1188 chip ?

From my past use of I2C the master does not re

Koepel:
When the I2C address 0x03 does not exist on the I2C bus, then the rest is not transmitted.
Is it a CAP1188 chip ?

In my earlier use of I2C I don't recall that the target had to ACK the address, in order for the master to continue the transmission. My expectation is that the master continues sending regardless of an ACK from the bus. The peripheral chip in this case is a PCF8574T.

I appreciate your input. Please let me know if you have further ideas.

Thanks,
Butch

pylon:

  Wire.beginTransmission(3); // transmit to device #44 (0x2c)

In this line either the address byte (3) or the comment (44) is wrong.

How do you know? Why don't you check the result of Wire.endTransmission()? It might give you insights what went wrong. My guess is that you're using a wrong address. Have you tried an I2C scanner sketch?

The comment is wrong.

In my earlier use of I2C I don't recall that the target had to ACK the address, in order for the master to continue the transmission. My expectation is that the master continues sending regardless of an ACK from the bus. The peripheral chip in this case is a PCF8574T.

I am using an oscilloscope to observe the I2C traffic. As I change the address in the Wire.beginTransmission() , I can observe the bits change in the data stream. I am seeing only 8 bits and the termination signal from the master.

I appreciate your input. Please let me know if you have further ideas.

Thanks,
Butch

Where can I find the I2C scanner sketch and do I get to observe the returned value without a display?

Thanks.

Thanks everyone! With your prompting I found that I was using the wrong address.

I have communication now.

Very grateful,
Butch