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.
Dependencies: 4DGL-uLCD-SE EthernetInterface mbed rtos
main.cpp
- Committer:
- shekha_atrash
- Date:
- 2016-06-25
- Revision:
- 3:7862ff3a9feb
- Parent:
- 2:14a8a5475978
- Child:
- 4:5780f46cbd63
File content as of revision 3:7862ff3a9feb:
#include "mbed.h"
#include "uLCD_4DGL.h"
uLCD_4DGL lcd(p9,p10,p11);
EthernetInterface eth;
//void basicLCD();
//void BlinkLED();
int main()
{
lcd.printf("hi");
char buf[0x600];
while(1)
{
int size = eth.receive();
if(size > 0)
{
eth.read(buf, size);
printf("Destxination: %02X:%02X:%02X:%02X:%02X:%02X\n",
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
printf("Source: %02X:%02X:%02X:%02X:%02X:%02X\n",
buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]);
}
wait(1);
}
}
void BlinkLED()
{
DigitalOut myled(LED1);
while(1)
{
myled = 1;
wait(0.2);
myled = 0;
wait(0.2);
}
}
void receiveFromEthernet()
{
Ethernet eth;
char buf[0x600];
while(1)
{
int size = eth.receive();
if(size > 0)
{
eth.read(buf, size);
printf("Destination: %02X:%02X:%02X:%02X:%02X:%02X\n",
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
printf("Source: %02X:%02X:%02X:%02X:%02X:%02X\n",
buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]);
}
wait(1);
}
}
void basicLCD()
{
uLCD_4DGL lcd(p9,p10,p11);
// Set our UART baudrate to something reasonable
lcd.baudrate(115200);
// Change background color (must be called before cls)
lcd.background_color(WHITE);
// Clear screen with background color
lcd.cls();
lcd.printf("hello");
}
void lcdFunction()
{
uLCD_4DGL lcd(p9,p10,p11);
// Set our UART baudrate to something reasonable
lcd.baudrate(115200);
// Change background color (must be called before cls)
lcd.background_color(WHITE);
// Clear screen with background color
lcd.cls();
// Change background color of text
lcd.textbackground_color(WHITE);
// Make some colorful text
lcd.locate(4, 1); // Move cursor
lcd.color(BLUE);
lcd.printf("This is a\n");
lcd.locate(5, 3); // Move cursor
lcd.text_width(2); // 2x normal size
lcd.text_height(2); // 2x normal size
lcd.color(RED); // Change text color
lcd.printf("TEST");
lcd.text_width(1); // Normal size
lcd.text_height(1); // Normal size
lcd.locate(3, 6); // Move cursor
lcd.color(BLACK); // Change text color
lcd.printf("of my new LCD");
}