The module is a microcontroller board based on the controller ATmega32U4 with 32k flash. Board can be powered either from the USB connection or a Lithium battery(80mA output current). And the board can charge for the Lithium battery through the USB port. The USB port on the board can be also used for upload program.When you upload program to the Xadow Main Board as you do with other Arduino boards, please select "Arduino Leonardo " from the Tools > Board menu. It is a indispensable part in the Xadow Kit.
This library is written for manage Xadow, include :
- user led
- charge state read
- battery voltage read
- sleep mode operation
you can use the folowing function, it's useful in some way.
void init();
float getBatVol();
unsigned char getChrgState();
it'll return the folowing value:
#define NOCHARGE 0
#define CHARGING 1
#define CHARGDONE 2
there'are two user led that you can use, a green one and a read one.
void greenLed(unsigned char state); // green Led drive
void redLed(unsigned char state); // red led drive
about the input value, you can use:
#define LEDON 1 // led on
#define LEDOFF 2 // led off
#define LEDCHG 3 // change led state
of curse, sometimes you want your xadow goto sleep to save some power, then you can use this function:
void pwrDown(unsigned long tSleep); // power down, tSleep ms
it'll let your xadow goto sleep for sSleep ms, then it'll wake, you shourld use the folowing function to awake it:
void wakeUp(); // wake up
there'are some application here, for more applicaton you can refer to examples
#include <Wire.h>
#include "xadow.h"
void setup()
{
Serial.begin(115200);
// while(!Serial);
Xadow.init();
delay(2000);
cout << "init over" << endl;
}
void loop()
{
cout << "begin to sleep for 1s" << endl;
Xadow.pwrDown(1000); // sleep for 1000ms
Xadow.wakeUp(); // wake up
cout << "wake up" << endl;
delay(500); // delay 500 ms
}
#include <Wire.h>
#include "xadow.h"
void setup()
{
Serial.begin(115200);
while(!Serial);
Xadow.init();
delay(1000);
cout << "init over" << endl;
}
void loop()
{
cout << "vol: " << Xadow.getBatVol() << endl;
delay(500);
}
#include <Wire.h>
#include "xadow.h"
void setup()
{
Xadow.init();
}
void loop()
{
Xadow.greenLed(LEDON); // green led on
Xadow.redLed(LEDOFF); // red led off
delay(200);
Xadow.redLed(LEDON); // red led on
Xadow.greenLed(LEDOFF); // green led off
delay(200);
}
For more information, please refer to [wiki page](http://www.seeedstudio.com/wiki/Xadow_Main_Board).
This software is written by loovee luweicong@seeedstudio.com for seeed studio
and is licensed under The MIT License. Check License.txt for more information.
Contributing to this software is warmly welcomed. You can do this basically by
forking, committing modifications and then pulling requests (follow the links above
for operating guide). Adding change log and your contact into file header is encouraged.
Thanks for your contribution.
Seeed Studio is an open hardware facilitation company based in Shenzhen, China.
Benefiting from local manufacture power and convenient global logistic system,
we integrate resources to serve new era of innovation. Seeed also works with
global distributors and partners to push open hardware movement.