Kate Barnes / Mbed 2 deprecated HD44780-LCD_with_Bluetooth

Dependencies:   TextLCD mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002 Bluetooth to HD44780 (via Android Blutooth TerminL)
00003 Kate Barnes
00004 JY-MCU Bluetooth Module, 4-line HD44780 compatible LCD,
00005 STM32F407VE Development Board
00006 */
00007 
00008 #include "mbed.h"
00009 #include "TextLCD.h"
00010 
00011 Serial pc(PA_9, PA_10);  // tx, rx. To terminal
00012 Serial pc2(PA_2, PA_3);  // tx, rx. To bluetooth board
00013  
00014 int main() {
00015     TextLCD lcd(PE_2,PE_3,PE_4,PE_5,PE_6,PE_7, TextLCD::LCD20x4);
00016     // Define custom character and assign it to '\1'
00017     char square[]={ 0x0,0x1f,0x11,0x11,0x11,0x1f,0x0,0x0 };
00018     lcd.defineChar(1, square);
00019 
00020     pc.baud(57600);
00021     pc.printf("Serial terminal online\r\n");
00022     pc.printf("SystemCoreClock is %d MHz\r\n", (SystemCoreClock/1000000));
00023     
00024     pc2.baud(9600); // linvor bluetooth module default baud rate
00025     //pc2.printf("AT");    
00026     //wait(1);
00027     //if(pc2.readable()) 
00028     //{
00029      //   pc.putc(pc2.getc());
00030     //}
00031     lcd.printf("  \1 BT Receiver \1");
00032     lcd.printf("                    ");
00033     lcd.printf("                    ");
00034     lcd.printf("       \1 Barnes \1");
00035     wait(2);
00036     lcd.cls();
00037     while (1) 
00038     {
00039         if(pc2.readable()) 
00040         {
00041             char SChar = pc2.getc();
00042             pc.putc(SChar);
00043             lcd.putc(SChar);
00044         }
00045     }
00046 }