Julie Newcomb / Mbed 2 deprecated ToastBoardLCDhello

Dependencies:   TextLCD mbed

Fork of TextLCD_HelloWorld by Simon Ford

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "TextLCD.h"
00003 
00004 DigitalOut led1(LED1);
00005 
00006 TextLCD lcd(D11,D10,D3,D2,D1,D0,TextLCD::LCD20x4);
00007 
00008 DigitalIn sda(PTE0);
00009 DigitalIn scl(PTE1);
00010 I2CSlave slave(PTE0, PTE1);
00011 //AnalogIn vol(A0);
00012 
00013 //const int addr = 0x90;
00014 char cmd[2];
00015 //slave.address = addr;
00016 
00017 
00018 int main() {
00019     led1=1;
00020     sda.mode(PullUp);
00021     scl.mode(PullUp);
00022     cmd[0] = '?';
00023     cmd[1] = '!';
00024     slave.address(0x90);
00025     while(true) {
00026         led1=!led1;
00027         //float val = 3.3*vol;
00028         slave.read(cmd,2);
00029         lcd.printf("Toastboard!\n");
00030         lcd.printf("%s\n",cmd);
00031         wait(1);
00032         }
00033         
00034 }