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.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
Hello, I recently purchased a few mbeds with the LPC1768 MCU for my hobby. I am experienced with micro-controllers but new to ARM. I am trying to send I2C commands to a slave mbed module. The slave code works fine as I have tried it with other devices. This code does not work. Where am I goofing up?
#include "mbed.h" InterruptIn PWM_Up_Btn(p20); InterruptIn PWM_Dn_Btn(p19); I2C I2C_master(p9, p10); char command_up[1] = { 'U' }; // U = PWM increase brightness. char command_dn[1] = { 'D' }; // D = PWM decrease brightness. const int PWM_CAN_address = 0x08; void up_button() { I2C_master.write(PWM_CAN_address, command_up, 0x01, false); } void dn_button() { I2C_master.write(PWM_CAN_address, command_dn, 0x01, false); } int main() { // Objects and variables: PWM_Up_Btn.rise(&up_button); PWM_Dn_Btn.rise(&dn_button); PWM_Dn_Btn.mode(PullDown); PWM_Up_Btn.mode(PullDown); I2C_master.frequency(10000); while(1) { } }