I am using STAMPLC and have all function included the PWR485 are normal. However, I purchase a PbHub to use as a extended input for buttons. I cannot connect the PbHub on PortA or PortC on STAMPLC.
I follow the sample code as follow in setup:
#include "M5UnitPbHub.h"
M5UnitPbHub pbhub;
void setup() {
Serial.begin(115200);
if (!pbhub.begin(&Wire, UNIT_PBHUB_I2C_ADDR, 2, 1, 400000U)) {
Serial.println("Couldn't find Pbhub");
while (1) delay(1);
}
}
void loop() {
Serial.printf("ch:%d adc:%d\r\n", 0 , pbhub.analogRead(0));
delay(1);
}
The following is the response on Serial Monitor:
Couldn't find Pbhub
E (1982) i2c.master: I2C transaction unexpected nack detected
E (1983) i2c.master: s_i2c_synchronous_transaction(924): I2C transaction failed
E (1984) i2c.master: i2c_master_multi_buffer_transmit(1186): I2C transaction failed
Wirings and functions are correct, G1 and G2 can get analogue and digital data I/O as normal. Any hints to solve the problem. I have write a simple I2C scanner program on Port A G2, G1 pin, there was response from Address 0x61, but Pbhub library cannot read data from Pbhub