Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of TextLCD_HelloWorld by
main.cpp
- Committer:
- amrita_arm19
- Date:
- 2016-03-31
- Revision:
- 6:5fcb9eb2a1f1
- Parent:
- 5:6f2d3689b015
File content as of revision 6:5fcb9eb2a1f1:
// Hello World! for the TextLCD
#include "mbed.h"
#include "TextLCD.h"
TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD16x2); // rs, e, d4-d7
Serial ftdi(USBTX, USBRX);
/*
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
DigitalOut led4(LED4);
*/
BusOut myleds(LED1,LED2,LED3, LED4);
int time1=0; // button count
int main() {
lcd.printf("Welcome!\n");
ftdi.printf("Enter LED on time: ");
ftdi.scanf("%d", &time1);
ftdi.printf(":%d\n\r", time1);
while(1)
{
if(!ftdi.readable())
{
lcd.printf("LED on: %d\n", time1);
myleds=15;
/*
led1=1;
led2=1;
led3=1;
led4=1;
*/
wait(time1);
myleds=10;
/*led1=0;
led2=0;
led3=0;
led4=0;
*/
wait(time1);
}
else if(ftdi.readable())
{
int a;
ftdi.scanf("%d", &a);
time1=a;
ftdi.printf("New time: %d\n\r", time1);
lcd.cls();
/*
_rs=0;
_d = 0x01;
wait(0.000040f); // most instructions take 40us
_e = 0;
wait(0.000040f);
_e = 1;
*/
lcd.printf("LED on (new): %d\n\n", time1);
}
}
}
