Read windows battery percentage with arduino

I want to make an arduino do something when a laptop battery percentage is 10%. The laptop should be running a version of windows such as windows 7. So how can I read windows 7 battery percentage with the arduino to use in my application? Thanks in advance!

You have the PC do it and send the result to the Arduino.

Mark

You can't use the arduino directly. There has to be some program running on your PC that looks at the battery state and when it reaches a certain value sends a message to the arduino through the serial port. Then the arduino can respond to that message.

Which software could I use to read the computer's battery percentage? How could I send the message to the arduino? How could I use that message to do something with the arduino? Thanks in advance!

Which software could I use to read the computer's battery percentage?

Software that you write - this is the difficult bit. Any language you want but it is the PC realm. This code needs to tap into the battery management API if that is open.

How could I send the message to the arduino?

Get the software to print something to the serial port.

How could I use that message to do something with the arduino?

In the arduino IDE select the menu File -> Examples -> 04 Communications -> ReadASCIIString

Could I use BatteryMon to read the battery percentage and send a message to the arduino? If not, can someone please tell me which software I should use? Thanks in advance!

You have to write your own program which will do exactly what you want.

To read battery level, take a look at: http://msdn.microsoft.com/en-us/library/windows/desktop/aa394074(v=vs.85).aspx http://msdn.microsoft.com/en-us/library/windows/desktop/aa394357(v=vs.85).aspx

To send a message to the Arduino you first add a SerialPort object to your program and use the SerialPort.Write function: http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx

If you are beginner and don't know which language to choose, I suggest C#.

You need to either find, or write, some PC software that does what you need. Writing it would be relatively simple - you would probably want to use the the RegisterPowerSettingNotification API.