void loop()
{
    // every 100 msecs get new data
    if( loop_cnt > 1 )
    {
        loop_cnt = 0;

        nunchuck_get_data();

        accx  = nunchuck_accelx(); // ranges from approx 70 - 182
        accy  = nunchuck_accely(); // ranges from approx 65 - 173
        zbut = nunchuck_zbutton();
        cbut = nunchuck_cbutton();


        //figure out what area the acc is in
        newPos[0] = map(accx,east,west,0,800);
        newPos[1] = map(accy,south,north,800,0);


        //send absolute positions
        sendRawData();

        //send just the area
        //findArea();
        //if(lastArea != activeArea) sendArea();

    }
    loop_cnt++;
    delay(1);

}
예제 #2
0
void loop()
{
    if( loop_cnt > 100 ) { // every 100 msecs get new data
        loop_cnt = 0;

        nunchuck_get_data();

        accx  = nunchuck_accelx(); // ranges from approx 70 - 182
        accy  = nunchuck_accely(); // ranges from approx 65 - 173
        zbut = nunchuck_zbutton();
        cbut = nunchuck_cbutton(); 
            
        Serial.print((byte)accx);
//        Serial.print("\taccy: "); Serial.print((byte)accy);
//        Serial.print("\tzbut: "); Serial.print((byte)zbut);
//        Serial.print("\tcbut: "); Serial.println((byte)cbut);
    }
    loop_cnt++;
    delay(1);
}