karelv / Mbed 2 deprecated i2c_io_lpc4088

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "my_i2c.h"
00003 
00004 DigitalOut myled(LED1);
00005 
00006 // Connections made:
00007 // SDA to pin9  of LPC4088 QSB
00008 // SCL to pin10 of LPC4088 QSB
00009 // on I2C bus is PCF8574 connected at sub-address 0 (0x40).
00010 // all supplied at 3.3V
00011 // no external pullup (5K internal pullup used by my_i2c functions)
00012 // 
00013 // note in the my_i2c functions a delay of 1us is added after each transition of the pin.
00014 //      so this means an absolute maximum frequency of 500kHz.
00015 
00016 int main() {
00017     
00018     while(1) {
00019         myled = 1;
00020         my_i2cStart(0x40);
00021         my_i2cWrite (0x55);
00022         my_i2cStop();
00023         wait(0.5);
00024         myled = 0;
00025         my_i2cStart(0x40);
00026         my_i2cWrite (0xAA);
00027         my_i2cStop();
00028         wait(0.5);
00029     }
00030 }