![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Sample code for the TrainInfoLib
Dependencies: NJE10XCtrlLib NTPClient_NetServices mbed IniFileLib NextTrainFileLib TrainInfoLib lwip
Diff: TrainInfoSample.cpp
- Revision:
- 1:93b052511e2c
- Parent:
- 0:1a9fa43d77af
diff -r 1a9fa43d77af -r 93b052511e2c TrainInfoSample.cpp --- a/TrainInfoSample.cpp Fri Nov 19 20:40:48 2010 +0000 +++ b/TrainInfoSample.cpp Fri Nov 19 21:07:11 2010 +0000 @@ -35,6 +35,15 @@ //////////////////////////////////////////////////////////////////////////////// +// LCD +#include "TextLCD.h" +void putLcd(const char* msg){ + TextLCD lcd(p24, p25, p26, p27, p28, p29, p30); // rs, rw, e, d0, d1, d2, d3 + lcd.cls(); + lcd.printf("%s", msg); +} + +//////////////////////////////////////////////////////////////////////////////// // RTC Configuration //#define USE_NTPCLIENT 1 @@ -238,6 +247,8 @@ //////////////////////////////////////////////////////////////////////////////// // NextTrain & Delay information control int updateNext(TrainInfo& train){ + putLcd("Update NextTrain information..."); + printf("UpdateTrain\n"); // Next (and 2nd Next) train check @@ -269,6 +280,8 @@ } int updateDelay(TrainInfo& train){ + putLcd("Update Delay Information..."); + // Delay check TrainInfo::Status ret = train.checkDelay(); if(ret == TrainInfo::S_DELAY_DETECTED){ @@ -330,11 +343,14 @@ // Init RTC + putLcd("Connect to the NTP server..."); UpdateRTC(ntpserver, ntpport, gTimeZone); return 0; } int main(){ + putLcd("Start TrainInfo!"); + setupParams(INI_FILE); Ticker dispTicker; dispTicker.attach(dispCB, 1); // 1 update per sec @@ -345,6 +361,7 @@ // Free LocalFileSystem before waiting. // (For access file via USB) + putLcd("Wait for the next update event"); wait(60); } dispTicker.detach();