Help with a timer class

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: roger, imaqine, 99jonathan

User avatar
esmetaman
Advanced Member
Posts: 311
Joined: Wed Sep 13, 2006 12:16 am
Location: Madrid, Spain
Contact:

Help with a timer class

Postby esmetaman » Thu Dec 20, 2007 12:01 am

Hi I would like to program a class using Timer to show a character in LCD. Anybody can help me?

I dont know how to use Timer class in NXJ.

thanks.
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
https://github.com/jabrena/livingrobots
http://www.iloveneutrinos.com/

User avatar
bbagnall
Site Admin
Posts: 392
Joined: Fri Aug 04, 2006 4:03 pm

Postby bbagnall » Tue Dec 25, 2007 6:30 pm

First you create a TimerListener class by extending the TimerListener interface. Implement a method called timedOut() as the interface requires. Everytime the timer clicks, this method will be called, so I assume you want to update your LCD image here.

Then make a timer object that uses your timerListener - specify the delay and your TimerListener:

Timer(int theDelay, TimerListener el)

The rest is pretty self explanatory from the API docs for Timer.


Return to “NXJ Software”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest