user13389: Please help me with this code it's shows some error [but I can't be bothered to tell you what].
#include <TimerOne.h>

/**

 Analog Clock

 Paul Cox Dec 2010

*/

#define    PI       3.141592653589793e-06;

byte rows[8] = {9, 14, 8, 12, 1, 7, 2, 5};

byte cols[8] = {13, 3, 4, 10, 6, 11, 15, 16};

byte pins[16] = {5, 4, 3, 2, 14, 15, 16, 17, 13, 12, 11, 10, 9, 8, 7, 6};

byte screen[8] = {0, 0, 0, 0, 0, 0, 0, 0};

volatile byte screenRow = 0;

volatile byte screenCol = 0;

int iHour = 0;

int iMin = 0;

int iSec = 0;

void setup()

{

  Timer1.initialize(100);

  for (int i = 2; i <= 17; i++)

  {

     pinMode(i, OUTPUT);

  }

  Timer1.attachInterrupt(doubleBuffer);

  Serial.begin(9600);

  resetAnim();

}

void doubleBuffer()

{

  digitalWrite(translatePin(rows[screenRow]), LOW);

  digitalWrite(translatePin(cols[screenCol]), HIGH);

  screenCol++;

  if (screenCol >= 8)

  {

     screenCol = 0;

     screenRow++;

     if (screenRow >= 8)

     {

       screenRow = 0;

     }

   }

   if((screen[screenRow] >> screenCol) & B1 == B1)

   {

     digitalWrite(translatePin(rows[screenRow]), HIGH);

     digitalWrite(translatePin(cols[screenCol]), LOW);

   }

   else

   {

     digitalWrite(translatePin(rows[screenRow]), LOW);

     digitalWrite(translatePin(cols[screenCol]), HIGH);

   }

}

byte translatePin(byte original)

{

  return pins[original - 1];

}

void allOFF()

{

  for (int i = 0; i < 8; i++)

  {

     screen[i] = 0;

  }

}

void on(byte row, byte column)

{

  screen[column-1] |= (B1 << (row - 1));

}

void off(byte row, byte column)

{

  screen[column-1] &= ~(B1 << (row - 1));

}

void resetAnim()

{

  for (int i = 0; i < 8; i++)

  {

     screen[i] = B11111111;

     delay(25);

  }

  for (int i = 0; i < 8; i++)

  {

     screen[i] = B00000000;

     delay(25);

  }

}

void loop()

{

  drawClock();

  iSec++;

  if (iSec == 60)

  {

    iSec = 1;

    iMin++;

    if (iMin == 60)

    {

       iMin = 0;

       iHour++;

       if (iHour == 12)

       {

          iHour = 0;

       }

    }

  }

  delay(10);

}

void drawClock()

{

  allOFF();

  setHand(iHour,12,3);

  setHand(iMin,60,4);

  setHand(iSec,60,5);

}

// work out the pixel for a hand - val is out of a possible max val

// radius is distance from the centre

void setHand(int iVal, int iMax, int iRadius)

{

  double  dAngle = (iVal * 2 * PI) / iMax;

  double  dPosX = 4.5 + (iRadius * cos(dAngle));

  double  dPosY = 4.5 + (iRadius * sin(dAngle));

  drawLine(5,5,constrain(round(dPosX),1,8),constrain(round(dPosY),1,8));

}

void drawLine(int x0, int y0, int x1, int y1)

{

  int      iTemp;

  boolean  bSteep = abs(y1 - y0) > abs(x1 - x0);

  if (bSteep)

  {

     iTemp = x0; x0 = y0; y0 = iTemp;    // swap x0,y0

     iTemp = x1; x1 = y1; y1 = iTemp;    // swap x1,y1

  }

  if (x0 > x1)

  {

     iTemp = x0; x0 = x1; x1 = iTemp;    // swap x0,x1

     iTemp = y1; y1 = y0; y0 = iTemp;    // swap y0,y1

  }

  int deltax = x1 - x0;

  int deltay = abs(y1 - y0);

  int error = deltax / 2;

  int ystep = ((y0 < y1) ? 1 : -1);

  int y = y0;

  int x = x0;

  while(x <= x1)

  {
    if (bSteep)
    {
       on(y,x);
    }
    else
    {
       on(x,y);
    }
    error = error - deltay;
    if (error < 0)
    {
       y = y + ystep;
       error = error + deltax;
    }
    x++;
  }
}


user4143: It's amazing the difference one character can make:

You must NEVER terminate a #define with a ; unless you absolutely know that you need one when it is expanded.

You have a macro defined:
#define    PI       3.141592653589793e-06;

That macro is then used here:
double  dAngle = (iVal * 2 * PI) / iMax;

Expand the macro PI and you get:
double  dAngle = (iVal * 2 * 3.141592653589793e-06;) / iMax;

Which obviously is a syntax error - you have a rogue ; in there where you really don't want one.
Oh, and one other thing - you shouldn't define PI - the Arudino core already defines it for you to a greater accuracy than you are:
arduino/Arduino.h:#define PI 3.1415926535897932384626433832795

... though you seem to be working in microPi's whatever those are...

13389: <p>Please help me with this code it's shows some error [but I can't be bothered to tell you what].</p>

<pre><code>#include &lt;TimerOne.h&gt;

/**

 Analog Clock

 Paul Cox Dec 2010

*/

#define    PI       3.141592653589793e-06;

byte rows[8] = {9, 14, 8, 12, 1, 7, 2, 5};

byte cols[8] = {13, 3, 4, 10, 6, 11, 15, 16};

byte pins[16] = {5, 4, 3, 2, 14, 15, 16, 17, 13, 12, 11, 10, 9, 8, 7, 6};

byte screen[8] = {0, 0, 0, 0, 0, 0, 0, 0};

volatile byte screenRow = 0;

volatile byte screenCol = 0;

int iHour = 0;

int iMin = 0;

int iSec = 0;

void setup()

{

  Timer1.initialize(100);

  for (int i = 2; i &lt;= 17; i++)

  {

     pinMode(i, OUTPUT);

  }

  Timer1.attachInterrupt(doubleBuffer);

  Serial.begin(9600);

  resetAnim();

}

void doubleBuffer()

{

  digitalWrite(translatePin(rows[screenRow]), LOW);

  digitalWrite(translatePin(cols[screenCol]), HIGH);

  screenCol++;

  if (screenCol &gt;= 8)

  {

     screenCol = 0;

     screenRow++;

     if (screenRow &gt;= 8)

     {

       screenRow = 0;

     }

   }

   if((screen[screenRow] &gt;&gt; screenCol) &amp; B1 == B1)

   {

     digitalWrite(translatePin(rows[screenRow]), HIGH);

     digitalWrite(translatePin(cols[screenCol]), LOW);

   }

   else

   {

     digitalWrite(translatePin(rows[screenRow]), LOW);

     digitalWrite(translatePin(cols[screenCol]), HIGH);

   }

}

byte translatePin(byte original)

{

  return pins[original - 1];

}

void allOFF()

{

  for (int i = 0; i &lt; 8; i++)

  {

     screen[i] = 0;

  }

}

void on(byte row, byte column)

{

  screen[column-1] |= (B1 &lt;&lt; (row - 1));

}

void off(byte row, byte column)

{

  screen[column-1] &amp;= ~(B1 &lt;&lt; (row - 1));

}

void resetAnim()

{

  for (int i = 0; i &lt; 8; i++)

  {

     screen[i] = B11111111;

     delay(25);

  }

  for (int i = 0; i &lt; 8; i++)

  {

     screen[i] = B00000000;

     delay(25);

  }

}

void loop()

{

  drawClock();

  iSec++;

  if (iSec == 60)

  {

    iSec = 1;

    iMin++;

    if (iMin == 60)

    {

       iMin = 0;

       iHour++;

       if (iHour == 12)

       {

          iHour = 0;

       }

    }

  }

  delay(10);

}

void drawClock()

{

  allOFF();

  setHand(iHour,12,3);

  setHand(iMin,60,4);

  setHand(iSec,60,5);

}

// work out the pixel for a hand - val is out of a possible max val

// radius is distance from the centre

void setHand(int iVal, int iMax, int iRadius)

{

  double  dAngle = (iVal * 2 * PI) / iMax;

  double  dPosX = 4.5 + (iRadius * cos(dAngle));

  double  dPosY = 4.5 + (iRadius * sin(dAngle));

  drawLine(5,5,constrain(round(dPosX),1,8),constrain(round(dPosY),1,8));

}

void drawLine(int x0, int y0, int x1, int y1)

{

  int      iTemp;

  boolean  bSteep = abs(y1 - y0) &gt; abs(x1 - x0);

  if (bSteep)

  {

     iTemp = x0; x0 = y0; y0 = iTemp;    // swap x0,y0

     iTemp = x1; x1 = y1; y1 = iTemp;    // swap x1,y1

  }

  if (x0 &gt; x1)

  {

     iTemp = x0; x0 = x1; x1 = iTemp;    // swap x0,x1

     iTemp = y1; y1 = y0; y0 = iTemp;    // swap y0,y1

  }

  int deltax = x1 - x0;

  int deltay = abs(y1 - y0);

  int error = deltax / 2;

  int ystep = ((y0 &lt; y1) ? 1 : -1);

  int y = y0;

  int x = x0;

  while(x &lt;= x1)

  {
    if (bSteep)
    {
       on(y,x);
    }
    else
    {
       on(x,y);
    }
    error = error - deltay;
    if (error &lt; 0)
    {
       y = y + ystep;
       error = error + deltax;
    }
    x++;
  }
}
</code></pre>
 4143: <p>It's amazing the difference one character can make:</p>

<ul>
<li>You must NEVER terminate a #define with a <code>;</code> unless you absolutely know that you need one when it is expanded.</li>
</ul>

<p>You have a macro defined:</p>

<pre><code>#define    PI       3.141592653589793e-06;
</code></pre>

<p>That macro is then used here:</p>

<pre><code>double  dAngle = (iVal * 2 * PI) / iMax;
</code></pre>

<p>Expand the macro PI and you get:</p>

<pre><code>double  dAngle = (iVal * 2 * 3.141592653589793e-06;) / iMax;
</code></pre>

<p>Which obviously is a syntax error - you have a rogue <code>;</code> in there where you really don't want one.</p>

<p>Oh, and one other thing - you shouldn't define PI - the Arudino core already defines it for you to a greater accuracy than you are:</p>

<pre><code>arduino/Arduino.h:#define PI 3.1415926535897932384626433832795
</code></pre>

<p>... though you seem to be working in microPi's whatever those are...</p>
