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.
main.cpp
- Committer:
- seethe
- Date:
- 2015-02-18
- Revision:
- 1:80eb2d3e5974
- Parent:
- 0:fbbd6271c1ac
- Child:
- 2:ce41adf02350
File content as of revision 1:80eb2d3e5974:
// Hello World! for the TextLCD
#include "mbed.h"
#include "TextLCD.h"
//TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7
TextLCD lcd(p24, p26, p27, p28, p29, p30); // rs, e, d4-d7
AnalogIn in1(p15);
AnalogIn in2(p16);
AnalogIn in3(p17);
AnalogOut out(p18);
DigitalOut DO[4]={LED1, LED2, LED3, LED4};
//int nCnt;
void led_blink(int cnt)
{
for(int n=0; n<4; n++){
if(n == cnt) DO[n] = 1;
else DO[n] = 0;
}
}
int main() {
int nCnt;
double cnt;
nCnt = 0;
cnt = 0.1;
while(1){
led_blink(nCnt);
nCnt++;
if(nCnt > 3)
nCnt = 0;
wait(0.1);
sin(1);
cnt+=0.1;
if(cnt>=1.0)
cnt = 0.1;
out.write((float)cnt);
lcd.printf("...\n");
lcd.printf("%.2f,.%.2f,%.2f\n", in1.read(), in2.read(), in3.read());
}
}