Boolean function isCharing()?

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

Moderators: 99jonathan, roger, imaqine

Boolean function isCharing()?

Postby Damian » Thu May 15, 2014 8:46 am

Do we have a function or way to know if the NXT robot is charging or not?
Damian
New User
 
Posts: 14
Joined: Sat Apr 12, 2014 8:27 am

Re: Boolean function isCharing()?

Postby gloomyandy » Thu May 15, 2014 8:06 pm

No and the hardware does not provide any way to tell if the NXT is charging.
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4072
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Boolean function isCharing()?

Postby Damian » Sat May 17, 2014 9:31 am

Can I find out the percentage of how much it is charged at least with a getCharge() method? Is there something like this?
Damian
New User
 
Posts: 14
Joined: Sat Apr 12, 2014 8:27 am

Re: Boolean function isCharing()?

Postby skoehler » Sat May 17, 2014 9:39 am

There is a getVoltage() function. Also, there is the isRechargable() function that tells you whether you dealing with one of the special Lego recharchable batteries or not. That's all we have.
skoehler
leJOS Team Member
 
Posts: 1421
Joined: Thu Oct 30, 2008 4:54 pm

Re: Boolean function isCharing()?

Postby Damian » Sat May 17, 2014 10:09 am

I also saw there is getVoltageMilliVolt(), but what object do I need to create to use this method? How is its constructor? Are there any examples? Thanks!
Damian
New User
 
Posts: 14
Joined: Sat Apr 12, 2014 8:27 am

Re: Boolean function isCharing()?

Postby skoehler » Sat May 17, 2014 10:12 am

Damian wrote:I also saw there is getVoltageMilliVolt(), but what object do I need to create to use this method? How is its constructor? Are there any examples? Thanks!

All method of the class Battery are static. You don't need to create an object. Just call the methods. For example:
Code: Select all
float f = Battery.getVoltage();
skoehler
leJOS Team Member
 
Posts: 1421
Joined: Thu Oct 30, 2008 4:54 pm

Re: Boolean function isCharing()?

Postby Damian » Sat May 17, 2014 10:20 am

skoehler wrote:
Damian wrote:I also saw there is getVoltageMilliVolt(), but what object do I need to create to use this method? How is its constructor? Are there any examples? Thanks!

All method of the class Battery are static. You don't need to create an object. Just call the methods. For example:
Code: Select all
float f = Battery.getVoltage();



Thank you very much for the fast replies so I am thinking to measure a value of mV first and after some seconds measure again, the second should be bigger, while charging so from this I will understand it is charging but http://www.lejos.org/rcx/tutorial/essen ... ttery.html it says we can see the charge on the LCD, yes we can and is there no way to access this information by coding and see if it is charging?
Damian
New User
 
Posts: 14
Joined: Sat Apr 12, 2014 8:27 am

Re: Boolean function isCharing()?

Postby skoehler » Sat May 17, 2014 10:29 am

Damian wrote:
skoehler wrote:
Damian wrote:I also saw there is getVoltageMilliVolt(), but what object do I need to create to use this method? How is its constructor? Are there any examples? Thanks!

All method of the class Battery are static. You don't need to create an object. Just call the methods. For example:
Code: Select all
float f = Battery.getVoltage();

Thank you very much for the fast replies so I am thinking to measure a value of mV first and after some seconds measure again, the second should be bigger, while charging so from this I will understand it is charging but http://www.lejos.org/rcx/tutorial/essen ... ttery.html it says we can see the charge on the LCD, yes we can and is there no way to access this information by coding and see if it is charging?

We show a battery on the LCD. Yes. And how full the battery is computed by some heuristics that may work more or less well for you, depending on whether you're using alkalines, nimh rechargeable, or the Lithium based rechargeable sold by Lego. All we can use is the voltage of the battery because the hardware of the EV3 doesn't offer anything else. And if read about the batteries and the relation between voltage and capacity, then you'll realize that using the voltage is really not very reliable. Also consider that even turning a motor on/off will increase/decrease the battery voltage.
skoehler
leJOS Team Member
 
Posts: 1421
Joined: Thu Oct 30, 2008 4:54 pm

Re: Boolean function isCharing()?

Postby Damian » Sat May 17, 2014 10:43 am

skoehler wrote:
Damian wrote:
skoehler wrote:
Damian wrote:I also saw there is getVoltageMilliVolt(), but what object do I need to create to use this method? How is its constructor? Are there any examples? Thanks!

All method of the class Battery are static. You don't need to create an object. Just call the methods. For example:
Code: Select all
float f = Battery.getVoltage();

Thank you very much for the fast replies so I am thinking to measure a value of mV first and after some seconds measure again, the second should be bigger, while charging so from this I will understand it is charging but http://www.lejos.org/rcx/tutorial/essen ... ttery.html it says we can see the charge on the LCD, yes we can and is there no way to access this information by coding and see if it is charging?

We show a battery on the LCD. Yes. And how full the battery is computed by some heuristics that may work more or less well for you, depending on whether you're using alkalines, nimh rechargeable, or the Lithium based rechargeable sold by Lego. All we can use is the voltage of the battery because the hardware of the EV3 doesn't offer anything else. And if read about the batteries and the relation between voltage and capacity, then you'll realize that using the voltage is really not very reliable. Also consider that even turning a motor on/off will increase/decrease the battery voltage.


I experienced that ... I measure the voltage it doesnt decrease, it gives the same values, sometimes higher than before or lower. I see that I cant count on this. I dont have EV3, I have NXT does that make a difference?
Damian
New User
 
Posts: 14
Joined: Sat Apr 12, 2014 8:27 am

Re: Boolean function isCharing()?

Postby skoehler » Sat May 17, 2014 10:44 am

Damian wrote:I dont have EV3, I have NXT does that make a difference?

Sorry, I meant to write NXT, not EV3.
skoehler
leJOS Team Member
 
Posts: 1421
Joined: Thu Oct 30, 2008 4:54 pm


Return to NXJ Software

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 2 guests

more stuff