Loading...
  Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Displays / Re: SKM53 to Nokia 5110 84x48 LCD on: October 22, 2011, 02:35:52 pm
Hmmm...
Solved  smiley-cool
I dont know if this is the BEST WAY... but is working !!!


Code:
//-----------------------------------------------------------
#include <PCD8544.h>
#include <TinyGPS.h>
#include <NewSoftSerial.h>

// A custom glyph (a smiley)...
//static const byte glyph[] = { B00010000, B00110100, B00110000, B00110100, B00010000 };


static PCD8544 lcd;
//------------------------------------------------------------




unsigned long fix_age;

NewSoftSerial GPS(2,8);
TinyGPS gps;
void gpsdump(TinyGPS &gps);
bool feedgps();
void getGPS();
long lat, lon;
float LAT, LON;

void setup(){
  //------------------------------------------------------------
  // PCD8544-compatible displays may have a different resolution...
  lcd.begin(84, 48);
 
  // Add the smiley to position "0" of the ASCII table...
 // lcd.createChar(0, glyph);
  //------------------------------------------------------------
  GPS.begin(9600);
 // Serial.begin(115200);
}

void loop(){
  long lat, lon;
  unsigned long fix_age, time, date, speed, course;
  unsigned long chars;
  unsigned short sentences, failed_checksum;

  // retrieves +/- lat/long in 100000ths of a degree
  gps.get_position(&lat, &lon, &fix_age);

  // time in hh:mm:ss, date in dd/mm/yy
/*gps.get_datetime(&date, &time, &fix_age);
  year = date % 100;
  month = (date / 100) % 100;
  day = date / 10000;
  hour = time / 1000000;
  minute =  (time / 10000) % 100;
  second = (time / 100) % 100;
  Serial.print("Date: ");
  Serial.print(year); Serial.print("/");
  Serial.print(month); Serial.print("/");
  Serial.print(day);
  Serial.print(" :: Time: ");
  Serial.print(hour); Serial.print(":");
  Serial.print(minute); Serial.print(":");
  Serial.println(second);
*/
  getGPS();
 // Serial.print("Latitude : ");
 // Serial.print(LAT/100000,7);
 // Serial.print(" :: Longitude : ");
 // Serial.println(LON/100000,7);
 
  //-----------------------------------------------------------------------------
  // Just to show the program is alive...
 // static int counter = 0;

  // Write a piece of text on the first line...
  lcd.setCursor(0, 0);
  lcd.print("Lat:");
  lcd.print(LAT/100000,7);
 
  lcd.setCursor(0, 1);
  lcd.print("Lon:");
  lcd.print(LON/100000,7);
 
  lcd.setCursor(0, 2);
  lcd.print("ALT:");
  lcd.print(gps.altitude());

  // Write the counter on the second line...
  lcd.setCursor(0, 3);
  lcd.print("Course:");
  lcd.print(gps.course());
 
  lcd.setCursor(0, 4);
  lcd.print("Speed:");
  lcd.print(gps.f_speed_kmph());
 

  delay(500); 
//  counter++;
  //------------------------------------------------------------------------------
}

void getGPS(){
  bool newdata = false;
  unsigned long start = millis();
  // Every 1 seconds we print an update
  while (millis() - start < 1000)
  {
    if (feedgps ()){
      newdata = true;
    }
  }
  if (newdata)
  {
    gpsdump(gps);
  }
}

bool feedgps(){
  while (GPS.available())
  {
    if (gps.encode(GPS.read()))
      return true;
  }
  return 0;
}

void gpsdump(TinyGPS &gps)
{
  //byte month, day, hour, minute, second, hundredths;
  gps.get_position(&lat, &lon);
  LAT = lat;
  LON = lon;
  {
    feedgps(); // If we don't feed the gps during this long routine, we may drop characters and get checksum errors
  }
}

Hmmm.. i don't remember who originally wrote the two part of codes...sorry..
but one thing is sure...its NOT MINE !!!
2  Using Arduino / Displays / SKM53 to Nokia 5110 84x48 LCD on: October 21, 2011, 02:15:51 pm
Hi.
I need sketch to display values from a SKM53 GPS to a Nokia 5110 84x48 in order to study how to print this values.
I was trying so far to compile two working sketchs with NO success  smiley-cry
Can someone help ?
Thnx in advance
3  Forum 2005-2010 (read only) / Syntax & Programs / Re: Cheap ebay nunchuck NOT working on: January 31, 2010, 03:05:52 am
crimony ..
YES !!! YES !!! YES !!!  smiley
Working !!!!
Many many thnx ....
You r THE BEST ...
THNX..
4  Forum 2005-2010 (read only) / Syntax & Programs / Re: Cheap ebay nunchuck NOT working on: January 29, 2010, 06:46:14 pm
Here is an image of the board.
http://img96.imageshack.us/i/p1142482.jpg/
5  Forum 2005-2010 (read only) / Syntax & Programs / Re: Cheap ebay nunchuck NOT working on: January 29, 2010, 06:17:21 pm
Thnx digimike for your reply.
Quote
Do you have it wired right? What code are you using?
Yes i m sure that is wired right. I also open it and take some readings with the multimeter in the accelerometer exit.
The code im using is http://todbot.com/arduino/sketches/NunchuckPrint/. I v also tested almost every code i v found in the internet .
6  Forum 2005-2010 (read only) / Syntax & Programs / Cheap ebay nunchuck NOT working on: January 29, 2010, 05:47:35 pm
Hi.
I bought cheap nunchuck from China and it would not work whatever i do. :-[
Firstly i tested it with an original wii system and the nunchuck was working fine.
But when i try to connect it in my arduino...i get nothing.
Any one got an idea why ??
Thnx in advance.
7  Forum 2005-2010 (read only) / Syntax & Programs / Re: 2 servo scann on: February 11, 2010, 04:09:55 pm
Hmmmmm..... seems that is working . im taking this
Code:
scanObstacle ==>
pos = 0
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 10
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 20
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 30
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 40
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 50
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 60
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 70
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 80
Move vertical servo to 180
scanObstacle <==
scanObstacle ==>
pos = 90
Move vertical servo to 180
scanObstacle <==
scanObstacle ==>
pos = 100
Move vertical servo to 180
scanObstacle <==
scanObstacle ==>
pos = 110
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 120
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 130
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 140
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 150
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 160
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 170
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 180
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 170
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 160
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 150
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 140
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 130
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 120
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 110
Move vertical servo to 90
scanObstacle <==
scanObstacle ==>
pos = 100
Move vertical servo to 180
scanObstacle <==
scanObstacle ==>
pos = 90
Move vertical servo to 180
scanObstacle <==

and i v modify
Code:
if((pos >= 0 && pos < 80) || (pos > 100 && pos <= 180))
      {
          Serial.println("Move vertical servo to 90");
          myservo_vertical.write(90);
      }
      else if(pos >= 89 && pos <= 91) <<<------------- only one step for 180 degree
      {
          Serial.println("Move vertical servo to 180");
          myservo_vertical.write(180);
            delay(500);  <<<<<<<---------------------------added this delay
      }
and now WORKING just fine.. as expected  smiley

Seems that was working from the first time , both 2 modifications , but due to small delay
 int aDelay = 30;           // Delay for the servo and let the IR to return results
the 2nd servo was not moving at all
I m so sorry.. its my fault  :-[
From now , I must use  the print statements that helps a lot to see what goes wrong.

Thnx for your help  smiley
8  Forum 2005-2010 (read only) / Syntax & Programs / Re: 2 servo scann on: February 11, 2010, 03:44:05 pm
Code:
scanObstacle ==>
pos = 0
scanObstacle <==
scanObstacle ==>
pos = 10
scanObstacle <==
scanObstacle ==>
pos = 20
scanObstacle <==
scanObstacle ==>
pos = 30
scanObstacle <==
scanObstacle ==>
pos = 40
scanObstacle <==
scanObstacle ==>
pos = 50
scanObstacle <==
scanObstacle ==>
pos = 60
scanObstacle <==
scanObstacle ==>
pos = 70
scanObstacle <==
scanObstacle ==>
pos = 80
scanObstacle <==
scanObstacle ==>
pos = 90
scanObstacle <==
scanObstacle ==>
pos = 100
scanObstacle <==
scanObstacle ==>
pos = 110
scanObstacle <==
scanObstacle ==>
pos = 120
scanObstacle <==
scanObstacle ==>
pos = 130
scanObstacle <==
scanObstacle ==>
pos = 140
scanObstacle <==
scanObstacle ==>
pos = 150
scanObstacle <==
scanObstacle ==>
pos = 160
scanObstacle <==
scanObstacle ==>
pos = 170
scanObstacle <==
scanObstacle ==>
pos = 180
scanObstacle <==
scanObstacle ==>
pos = 170
scanObstacle <==
scanObstacle ==>
pos = 160
scanObstacle <==
scanObstacle ==>
pos = 150
scanObstacle <==
scanObstacle ==>
pos = 140
scanObstacle <==
scanObstacle ==>
pos = 130
scanObstacle <==
scanObstacle ==>
pos = 120
scanObstacle <==
scanObstacle ==>
pos = 110
scanObstacle <==
scanObstacle ==>
pos = 100
scanObstacle <==
scanObstacle ==>
pos = 90
scanObstacle <==
scanObstacle ==>
pos = 80
scanObstacle <==
scanObstacle ==>
pos = 70
scanObstacle <==
scanObstacle ==>
pos = 60
scanObstacle <==
scanObstacle ==>
pos = 50
scanObstacle <==
scanObstacle ==>
pos = 40
scanObstacle <==
scanObstacle ==>
pos = 30
scanObstacle <==
scanObstacle ==>
pos = 20
scanObstacle <==
scanObstacle ==>
pos = 10
scanObstacle <==
scanObstacle ==>
pos = 0
.......... and again from the begining...
Iv added also in setup Serial.begin(19200);
9  Forum 2005-2010 (read only) / Syntax & Programs / Re: 2 servo scann on: February 11, 2010, 03:25:53 pm
Code:
 void scanObstacle ()
    {
      myservo_pan.write(pos);                           // sets the servo position
      myservo_vertical.write(90);                       // sets the servo position @ 90 degree
      delay(aDelay);                                    // waits for the servo to get there
      
      readDistance = analogRead(sensorPin);             // Take a reading from sensor
      readDistance90 = analogRead(Vertical_sensorPin);  // Take a reading from Vertical sensor @90 degree and store it      
      delay(aDelay);                                    // Wait to get the reading SOSOSOSOS !!!! We need this    
      
      if (readDistance > minDistanceLimit)              // If we can scan an obstacle
      {
        avoidObstacle(pos);                  // Then do avoiding actions
      }

<<<<--------------------------------------------------------------------------- i v test to paste the code here also .Same results
      if (pos == 180)                        // If we reach end of servo
       {        
         servoStep= -sStep;                  // Move it back
       }
      if (pos == 0)                          // If we are at the start
      {        
        servoStep = sStep;                   // Move it right
      }
      
       if((pos >= 0 && pos <= 80) || (pos >= 100 && pos <= 180))
      {
          myservo_vertical.write(90);
      }
      else if(pos > 80 && pos < 100)
      {
          myservo_vertical.write(180);
      }
    
      pos += servoStep;
      
     <<<<--------------------------------------------------------------------------- i v test to paste the code here also .Same results
    
    }

10  Forum 2005-2010 (read only) / Syntax & Programs / Re: 2 servo scann on: February 11, 2010, 03:02:24 pm
What i want to do is... the paning servo (1st)  to scan for obstacles in front of my robot and the 2nd (vertical) to scan in two potitions . 180 degrees for Gap in front of my robot and 90 degrees for an obstacle in the front of my robor. The final goal is to compare the 2 readings from the 2 front results in order to descide if the obstacle is tall enough (both sensors detect obstacle) and in this case to turn my robot OR if the lower (2nd) sensor detects an obstacle but the 1st is not , then the obstacle is "small" and my robot is able to climbe it.
11  Forum 2005-2010 (read only) / Syntax & Programs / Re: 2 servo scann on: February 11, 2010, 02:49:14 pm
Quote
I assume you mean "OR"?
Yes ...
Same results as PaulS code..
The 1st servo is panning correctly but the 2nd is not working at all smiley-sad
I thing that the part of code for the 2nd servo must be INSIDE the existent code something like
if (pos == 180)                        // If we reach end of servo
       {        
         servoStep= -sStep;                  // Move it back
        <<<<---Here to add somehow the code for the 2nd servo
       }

Thnx for your reply
12  Forum 2005-2010 (read only) / Syntax & Programs / Re: 2 servo scann on: February 11, 2010, 02:19:19 pm
Thnx PaulS for your reply.
..but i v added the your code and is NOR working  smiley-sad
whatever i v try .. the same results .. not working.
13  Forum 2005-2010 (read only) / Syntax & Programs / 2 servo scann on: February 10, 2010, 05:22:52 pm
Hi.
I m using this to pan a servo.
Code:
void scanObstacle ()
    {
      myservo.write(pos);                    // sets the servo position
      delay(aDelay);                         // waits for the servo to get there
      readDistance = analogRead(sensorPin);  // Take a reading from sensor
      delay(aDelay);                         // Wait to get the reading SOSOSOSOS !!!! We need this
      if (readDistance > minDistanceLimit)   // If we can scan an obstacle
      {
        avoidObstacle(pos);                  // Then do avoiding actions
      }

      if (pos == 180)                        // If we reach end of servo
       {
         servoStep= -sStep;                  // Move it back
       }
      if (pos == 0)                          // If we are at the start
      {
        servoStep = sStep;                   // Move it right
      }
    
      pos += servoStep;
    }

What i m trying to do is. to use a 2nd servo and
 when the pan servo value is between (0 and 80  ) and ( 100 to 180 ) to myservo_vertical.write(90); <<---- the 2nd servo
and when is between 80 and 100 to
myservo_vertical.write(100);

How can i do this ??? What ever i try is not working  :-[
Thnx in advance  smiley-wink
14  Forum 2005-2010 (read only) / Syntax & Programs / Re: Calculation of degree of accelerometer (nunchuck) on: February 04, 2010, 10:40:36 am
Quote
...... I prefer to see lean code - as someone here recently (charmingly) put it "to give the bugs fewer places to hide"
Thnx for the advice  smiley-wink
Once again thnx for your help  8-)
15  Forum 2005-2010 (read only) / Syntax & Programs / Re: Calculation of degree of accelerometer (nunchuck) on: February 03, 2010, 03:12:17 pm
Seems that my Modification WORKING fine. smiley-wink
Here is the final code to read cheap nunchuck in row values and in degrees.
If you notice that something is wrong pls reply.

Code:
/*
 * NunchuckPrint Values in DEGREEs
 * 2007 Tod E. Kurt, http://todbot.com/blog/
 * The Wii Nunchuck reading code is taken from Windmeadow Labs
 * http://www.windmeadow.com/node/42
 * modified by crimony in http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1264805255/0#5 to read cheap ebay nunchucks
 * Valuable infos from http://www.freescale.com/files/sensors/doc/app_note/AN3461.pdf
 * and http://rubenlaguna.com/wp/2008/11/03/arduino-tilt-sensor-using-mma7260q/
 * Last modification by ntgr (03-2-2010)
 */
 
#include <Wire.h>
uint8_t ctrlr_type[6];

void setup()
{
  Serial.begin(19200);
  nunchuck_setpowerpins(); // use analog pins 2&3 as fake gnd & pwr
  nunchuck_init(); // send the initilization handshake
  Serial.print ("Finished setup\n");
}

void loop()
{
  nunchuck_get_data();
  nunchuck_print_data();
  delay(100);
}


//
// Nunchuck functions
//

static uint8_t nunchuck_buf[6];   // array to store nunchuck data,

// Uses port C (analog in) pins as power & ground for Nunchuck
static void nunchuck_setpowerpins()
{
#define pwrpin PORTC3
#define gndpin PORTC2
    DDRC |= _BV(pwrpin) | _BV(gndpin);
    PORTC &=~ _BV(gndpin);
    PORTC |=  _BV(pwrpin);
    delay(100);  // wait for things to stabilize        
}

// initialize the I2C system, join the I2C bus,
// and tell the nunchuck we're talking to it
void nunchuck_init()
{
  byte cnt;

Wire.begin();
            
// init controller
delay(1);
Wire.beginTransmission(0x52);      // device address
Wire.send(0xF0);                    // 1st initialisation register
Wire.send(0x55);                    // 1st initialisation value
Wire.endTransmission();
delay(1);
Wire.beginTransmission(0x52);
Wire.send(0xFB);                    // 2nd initialisation register
Wire.send(0x00);                    // 2nd initialisation value
Wire.endTransmission();
delay(1);
            
// read the extension type from the register block        
Wire.beginTransmission(0x52);
Wire.send(0xFA);                    // extension type register
Wire.endTransmission();
Wire.beginTransmission(0x52);
Wire.requestFrom(0x52, 6);               // request data from controller
for (cnt = 0; cnt < 6; cnt++) {
    if (Wire.available()) {
        ctrlr_type[cnt] = Wire.receive(); // Should be 0x0000 A420 0101 for Classic Controller, 0x0000 A420 0000 for nunchuck
    }
}
Wire.endTransmission();
delay(1);
            
// send the crypto key (zeros), in 3 blocks of 6, 6 & 4.
Wire.beginTransmission(0x52);
Wire.send(0xF0);                    // crypto key command register
Wire.send(0xAA);                    // sends crypto enable notice
Wire.endTransmission();
delay(1);
Wire.beginTransmission(0x52);
Wire.send(0x40);                    // crypto key data address
for (cnt = 0; cnt < 6; cnt++) {
    Wire.send(0x00);                    // sends 1st key block (zeros)
}
Wire.endTransmission();
Wire.beginTransmission(0x52);
Wire.send(0x40);                    // sends memory address
for (cnt = 6; cnt < 12; cnt++) {
    Wire.send(0x00);                    // sends 2nd key block (zeros)
}
Wire.endTransmission();
Wire.beginTransmission(0x52);
Wire.send(0x40);                    // sends memory address
for (cnt = 12; cnt < 16; cnt++) {
    Wire.send(0x00);                    // sends 3rd key block (zeros)
}
Wire.endTransmission();
delay(1);
// end device init

}

// Send a request for data to the nunchuck
// was "send_zero()"
void nunchuck_send_request()
{
  Wire.beginTransmission(0x52);      // transmit to device 0x52
  Wire.send(0x00);            // sends one byte
  Wire.endTransmission();      // stop transmitting
}

// Receive data back from the nunchuck,
int nunchuck_get_data()
{
    int cnt=0;
    Wire.requestFrom (0x52, 6);      // request data from nunchuck
    while (Wire.available ()) {
      // receive byte as an integer
      nunchuck_buf[cnt] = nunchuk_decode_byte(Wire.receive());
      cnt++;
    }
    nunchuck_send_request();  // send request for next data payload
    // If we recieved the 6 bytes, then go print them
    if (cnt >= 5) {
     return 1;   // success
    }
    return 0; //failure
}

// Print the input data we have recieved
// accel data is 10 bits long
// so we read 8 bits, then we have to add
// on the last 2 bits.  That is why I
// multiply them by 2 * 2
void nunchuck_print_data()
{
  static int i=0;
  int joy_x_axis = nunchuck_buf[0];
  int joy_y_axis = nunchuck_buf[1];
  int accel_x_axis = nunchuck_buf[2]; // Readings from My wii in X axis
  int accel_y_axis = nunchuck_buf[3]; // Readings from My wii in Y axis
  int accel_z_axis = nunchuck_buf[4]; // Readings from My wii in Z axis

  int z_button = 0;
  int c_button = 0;
  
  //*******************************************************************************************
  
  int minx = 78;       //Minimum Measured value in X axis as readed in my tests.
  int maxx = 182;      //Maximum Measured value in X axis
  int miny = 78;       //Minimum Measured value in Y axis
  int maxy = 182;      //Maximum Measured value in Y axis
  int minz = 78;       //Minimum Measured value in Z axis
  int maxz = 182;      //Maximum Measured value in Z axis
  
  int g0x;
  int g0y;
  int g0z;
  g0x = ((maxx - minx)/2)+minx;
  g0y = ((maxy - miny)/2)+miny;
  g0z = ((maxz - minz)/2)+minz;
  
  int fx = (accel_x_axis - g0x);
  int fy = (accel_y_axis - g0y);
  int fz = (accel_z_axis - g0z);
  
  float ax = fx*(3.3/(1024.0*((maxx-minx))/180));  //The 3.3V supply volt is divided by 1024 steps from the A/D converter. This value is divided by the sensitivity in X axis
  float ay = fy*(3.3/(1024.0*((maxy-miny))/180));  //The 3.3V supply volt is divided by 1024 steps from the A/D converter. This value is divided by the sensitivity in Y axis
  float az = fz*(3.3/(1024.0*((maxz-minz))/180));  //The 3.3V supply volt is divided by 1024 steps from the A/D converter. This value is divided by the sensitivity in Z axis
  
  float rho = 0;             //MyAngle in X Axis
  float phi = 0;             //MyAngle in Y Axis
  float theta = 0;           //MyAngle in Z Axis
  rho =   atan(ax/sqrt(pow(ay,2)+pow(az,2)))*(360/(2*3.1415));  //Calculate the X , Y ,Z angle.
  phi =   atan(ay/sqrt(pow(ax,2)+pow(az,2)))*(360/(2*3.1415));  // this used (360/(2*3.1415) to convert radians to degrees.
  theta = atan(sqrt(pow(ay,2)+pow(ax,2))/az)*(360/(2*3.1415));  //More in http://www.freescale.com/files/sensors/doc/app_note/AN3461.pdf (PAGE 4)
  
  
  //*******************************************************************************************

  // byte nunchuck_buf[5] contains bits for z and c buttons
  // it also contains the least significant bits for the accelerometer data
  // so we have to check each bit of byte outbuf[5]
  if ((nunchuck_buf[5] >> 0) & 1)
    z_button = 1;
  if ((nunchuck_buf[5] >> 1) & 1)
    c_button = 1;

  if ((nunchuck_buf[5] >> 2) & 1)
    accel_x_axis += 2;
  if ((nunchuck_buf[5] >> 3) & 1)
    accel_x_axis += 1;

  if ((nunchuck_buf[5] >> 4) & 1)
    accel_y_axis += 2;
  if ((nunchuck_buf[5] >> 5) & 1)
    accel_y_axis += 1;

  if ((nunchuck_buf[5] >> 6) & 1)
    accel_z_axis += 2;
  if ((nunchuck_buf[5] >> 7) & 1)
    accel_z_axis += 1;

  Serial.print(i,DEC);
  Serial.print("\t");
  
  Serial.print("joy:");
  Serial.print(joy_x_axis,DEC);
  Serial.print(",");
  Serial.print(joy_y_axis, DEC);
  Serial.print("  \t");

  Serial.print("acc:");
  Serial.print(accel_x_axis, DEC);
  Serial.print(",");
  Serial.print(accel_y_axis, DEC);
  Serial.print(",");
  Serial.print(accel_z_axis, DEC);
  Serial.print("\t");

  Serial.print("but:");
  Serial.print(z_button, DEC);
  Serial.print(",");
  Serial.print(c_button, DEC);
  
  Serial.print("  \t");
  Serial.print(" ANGLE X --> ");
  Serial.print(rho, DEC);
  Serial.print("  \t");
  Serial.print(" ANGLE Y --> ");
  Serial.print(phi, DEC);
  Serial.print("  \t");
  Serial.print(" ANGLE Z --> ");
  Serial.print(theta, DEC);

  Serial.print("\r\n");  // newline
  i++;
}

// Encode data to format that most wiimote drivers except
// only needed if you use one of the regular wiimote drivers
char nunchuk_decode_byte (char x)
{
  x = (x ^ 0x17) + 0x17;
  return x;
}

Any comments are welcome :smiley
Pages: [1] 2 3 4