Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 3 months ago.
DigitalOut with PCA9675
Hello,
I am trying to simply set my PCA9675 ports to a digital output 0 (0V) or 1 (3.3V) as if I was using the function "DigitalOut" for the mbedLPC1768. I can´t seem to do this, I keep getting 4.9V through all the ports on my PCA all the time. I have attached code below. Any suggestions are appreciated thank you.
- include "mbed.h"
- include "misra_types.h"
- include "PCA9675.h"
- define PCA9675_BASE_BOARD_SLAVE_ADDRESS 0x20
I2C CNTRL_i2c(p9, p10); PCA9675 BaseBoardLatch(&CNTRL_i2c, PCA9675_BASE_BOARD_SLAVE_ADDRESS);
int main() {
uint8_t port0_payload = 0x00; uint8_t port1_payload = 0x00; CNTRL_i2c.frequency(400000);
BaseBoardLatch.init(port0_payload, port1_payload);
while(1) { BaseBoardLatch.write_data(0xff, port1_payload); wait(2); BaseBoardLatch.write_data(0x00, port1_payload); wait(2); } }