Poll
Question: Did you like this project ?
yeah, it's cool !
it's okay
smiley-neutral

Pages: [1] 2   Go Down
Author Topic: Arduino based uber - cool wrist watch with LCD display  (Read 2679 times)
0 Members and 1 Guest are viewing this topic.
Delhi, India
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset




watch this video of how a wrist watch with nokia 6100's LCD can be made having all features a watch can have : shows time,date and day in numerous themes along with playing music... at a really cheap price !!
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 206
Posts: 12853
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Where is the Arduino?
Logged

Delhi, India
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Arduino is beneath the LCD. A sheild is mounted on Arduino which connects the MOSI pin of Arduino with the breakout board of LCD and sends data via SPI. Sheild for nokia 6100's LCD can either be made or can bes bought from sparksfun.com along with the library. I made it along with the library.
Logged

Delhi, India
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

once you have the library i can give you the program running this LCD display wrist watch which you just have to upload on your Arduino to have a watch similar to that you are watching now !!
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 206
Posts: 12853
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


I appreciate your willingness to share.

I do not appreciate the fact that you've posted the video ... let's count ... five times.  If you post that video just one more time, you get a time-out.
Logged

Delhi, India
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

three times smiley-razz .... i got your point !!
Logged

Delhi, India
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

this code uses only one pre-built lcd function -- SetLCDPixel(), rest all functions are derived from it

Code:
#include <avr/io.h>
#include        "LCD_driver.c"
#include "WProgram.h"
void line(float x1,float y1,float x2,float y2,int color)
{
  float m= ((y2-y1)/(x2-x1));
  while(x2>=x1)
  {
  y2 = m*(x2-x1)+y1;
  LCDSetPixel(color,x2,y2);
  x2--;
  }
  while(x2<=x1)
  {
  y2 = m*(x2-x1)+y1;
  LCDSetPixel(color,x2,y2);
  x2++;
  }
}

void lengthline(float x1,float y1,float length,float slope,int color)
{
  float x2,y2;
  x2 = x1 + length*(cos(slope*0.01746));
  y2 = y1 + length*(sin(slope*0.01746));
  line(x1,y1,x2,y2,color);
}

void lengthlinemid(float x,float y,float length,double slope,int color)
{
  float x1,y1,x2,y2;
  x1 = x +((length/2)*(cos(slope*0.01746)));
  y1 = y - ((length/2)*(sin(slope*0.01746)));
  x2 = x -((length/2)*(cos(slope*0.01746)));
  y2 = y +((length/2)*(sin(slope*0.01746)));
  line(x1,y1,x2,y2,color);
}
void square(float x,float y, float side,int color)
{
  float x1,y1;
  for(x1 = x,y1 = y; y1 <= (y + side);y1++)
  lengthline(x1,y1,side,0,color);
}

double j =150,k=290;

void second()
{
  for(float i =0;i<360;i+=0.6)
  {
  for(int l=(-1);l<=1;l++)
  lengthline(70,67,35,i+l,0x00F);
  delay(18);
   for(int l=(-2);l<=2;l++)
  lengthline(70,67,28,j+l,RED);
   for(int l=(-3);l<=3;l++)
  lengthline(70,67,21,k+l,RED);
  j+=0.01;
  k+=(0.01/(60));
  for(int l=(-2);l<=2;l++)
  lengthline(70,67,28,j+l,0x00F);
  for(int l=(-3);l<=3;l++)
  lengthline(70,67,21,k+l,0x00F);
  for(int l=(-1);l<=1;l++)
  lengthline(70,67,35,i+l,RED);
  }
  LCDCommand(P_DISPON);

}


void cube()
{
  
  for(int i=0;i<=132;i++)
  lengthline(1,i,132,0,WHITE);
  for(int i = 0;i<=25;i++)
  lengthline(56,1+i,25,30,0x0EF);
  for(int i = 0;i<=25;i++)
  lengthline(56,1+i,25,150,0x5FF);
 for(float i = 0;i<=25;i+=0.5)
 lengthline(56 + i*(cos(150*0.01746)),26 + i*(sin(150*0.01746)),25,30,0x1FF);
 
  for(int i = 0;i<=30;i++)
  lengthline(20,25+i,30,30,0x0B0);
  for(int i = 0;i<=30;i++)
  lengthline(20,25+i,30,150,0x0E0);
 for(float i = 0;i<=30;i+=0.5)
 lengthline(20 + i*(cos(150*0.01746)),55 + i*(sin(150*0.01746)),30,30,0x0A0);
 
 for(int i = 0;i<=50;i++)
  lengthline(30,80+i,50,30,0x00E);
  for(int i = 0;i<=50;i++)
  lengthline(30,80+i,50,150,0x00F);
 for(float i = 0;i<=50;i+=0.5)
 lengthline(30 + i*(cos(150*0.01746)),130 + i*(sin(150*0.01746)),50,30,0x008);
 
 for(int i = 0;i<=50;i++)
  lengthline(100,75+i,50,30,0xDE0);
  for(int i = 0;i<=50;i++)
  lengthline(100,75+i,50,150,0xFF0);
 for(float i = 0;i<=50;i+=0.5)
 lengthline(100 + i*(cos(150*0.01746)),125 + i*(sin(150*0.01746)),50,30,0xED0);
 
 for(int i = 0;i<=35;i++)
  lengthline(110,5+i,35,30,0xFB0);
  for(int i = 0;i<=35;i++)
  lengthline(110,5+i,35,150,0xFC0);
 for(float i = 0;i<=35;i+=0.5)
 lengthline(110 + i*(cos(150*0.01746)),40 + i*(sin(150*0.01746)),35,30,0xFA0);
 
  for(int i = 0;i<=45;i++)
  lengthline(76,33+i,45,30,0xA00);
  for(int i = 0;i<=45;i++)
  lengthline(76,33+i,45,150,RED);
 for(float i = 0;i<=45;i+=0.5)
 lengthline(76 + i*(cos(150*0.01746)),78 + i*(sin(150*0.01746)),45,30,0x800);
 
 while(1)
  {
  for(float i =0;i<360;i+=0.6)
  {
  for(int l=(0);l<=0;l++)
  {lengthline(57,65,18,i+l,0xFFF);
  }
  delay(18);
   for(int l=(-1);l<=1;l++)
  {lengthline(57,65,15,j+l,RED);
  }
   for(int l=(-3);l<=3;l++)
  {lengthline(57,65,11,k+l,RED);
  }
  j+=0.01;
  k+=(0.01/(60));
  for(int l=(-1);l<=1;l++)
  {lengthline(57,65,15,j+l,0xFFF);
  }
  for(int l=(-3);l<=3;l++)
  {lengthline(57,65,11,k+l,0xFFF);
  }
  for(int l=(0);l<=0;l++)
  {lengthline(57,65,18,i+l,RED);
  }
  }
  LCDCommand(P_DISPON);

  
  }
}
  
void second1()
{
  
  for(float i =0;i<360;i+=0.6)
  {
  for(int l=(0);l<=0;l++)
  lengthline(66,67,24,i+l,0xFFF);
  delay(18);
   for(int l=(-1);l<=1;l++)
  lengthline(66,67,20,j+l,0x000);
   for(int l=(-3);l<=3;l++)
  lengthline(66,67,16,k+l,0x000);
 j+=0.01;
  k+=(0.01/(60));
  for(int l=(-1);l<=1;l++)
  lengthline(66,67,20,j+l,0xFFF);
  for(int l=(-3);l<=3;l++)
  lengthline(66,67,16,k+l,0xFFF);
 for(int l=(0);l<=0;l++)
  lengthline(66,67,24,i+l,0x000);
   LCDCommand(P_DISPON);
  
  }

}
void edge(float x,float y,float length,int angle, int color)
{
  for(float i = (-12+angle);i<=(12+angle);i+=0.5)
  lengthline(x,y,22,i,BLACK);
for(float i = (-8+angle);i<=(8+angle);i+=0.5)
  lengthline(x,y,20,i,BLUE);
}


void hexagon()
{
 
  int u=1,e=0;
   for(int x1 = 1,y1 = 1; y1 <= 132;y1++)
lengthline(x1,y1,132,0,BLACK);
for(e=0;e<=1;e++,u++)
 lengthline(1,u,132,0,0xF00);
for(e=0;e<=1;e++,u++)
 lengthline(1,u,132,0,0xE00);
 for(e=0;e<=1;e++,u++)
 lengthline(1,u,132,0,0xD00);
 for(e=0;e<=1;e++,u++)
 lengthline(1,u,132,0,0xC00);
 for(e=0;e<=1;e++,u++)
 lengthline(1,u,132,0,0xB00);
for(e=0;e<=1;e++,u++)
 lengthline(1,u,132,0,0xA00);
 for(e=0;e<=3;e++,u++)
 lengthline(1,u,132,0,0x900);
 for(e=0;e<=3;e++,u++)
 lengthline(1,u,132,0,0x800);
 for(e=0;e<=3;e++,u++)
 lengthline(1,u,132,0,0x700);
 for(e=0;e<=3;e++,u++)
 lengthline(1,u,132,0,0x600);
 for(e=0;e<=3;e++,u++)
 lengthline(1,u,132,0,0x500);
 for(e=0;e<=3;e++,u++)
 lengthline(1,u,132,0,0x400);
 for(e=0;e<=3;e++,u++)
 lengthline(1,u,132,0,0x300);
 for(e=0;e<=3;e++,u++)
 lengthline(1,u,132,0,0x200);
 for(e=0;e<=3;e++,u++)
 lengthline(1,u,132,0,0x100);


for(float i = 0,x1=10,y1=132;i<=30;i+=0.1)
line(x1+i,132,40,y1-(4.2*i),0xFFF);
for(float i = 0,x1=70,y1=132;i<=30;i+=0.1)
line(x1-i,132,40,y1-(4.2*i),0xFFF);
 for(int s =0;s<132;s+=4)
lengthline(1+s,132,100,315,BLACK);
 for(int s =0;s<30;s+=4)
lengthline(1,132-s,100,315,BLACK);
 for(int s =0;s<132;s+=4)
lengthline(132-s,132,100,235,BLACK);
 for(int s =0;s<20;s+=4)
lengthline(132,132-s,100,235,BLACK);

for(int x1 = 0,y1 = 50; y1 <= 132;y1++)
lengthline(x1,y1,25,0,BLACK);
for(int x=0;x<=25;x+=6)
{
  for(int y = 50;y<=132;y+=5)
{
 for(int i = 0;i<=2;i++)
 lengthline(x-i,y+i,i*2,0,0xFFF);
 for(int i = 0;i<=1;i++)
 lengthline(x-2,y+2+i,4,0,0xFFF);
 for(int i = 0;i<=1;i++)
 lengthline(x-2,y+3+i,4,0,0xFFF);
 for(int i = 2;i>=0;i--)
 lengthline(x-i,y+6-i,i*2,0,0xFFF);
}
}
for(int i = 0;i<=72;i++)
 lengthline(110-(i),60+(i),i*2,0,0xFFF);
 for(int s =0;s<=140;s+=5)
 lengthline(38+s,132,100,315,BLACK);
for(int x1 =85,y1 = 100; y1 <= 132;y1++)
lengthline(x1,y1,48,0,BLACK);
for(int x=87;x<=135;x+=5)
{
  for(int y = 100;y<=132;y+=4)
{
 for(int i = 0;i<=1;i++)
 lengthline(x-i,y+i,i,0,0xFFF);
 for(int i = 0;i<=2;i++)
 lengthline(x-1,y+1+i,1,0,0xFFF);
 for(int i = 0;i<=2;i++)
 lengthline(x-1,y+3+i,1,0,0xFFF);
 for(int i = 1;i>=0;i--)
 lengthline(x-i,y+6-i,i,0,0xFFF);
}
}
for(int x1 = 57,y1 = 60; y1 <= 132;y1++)
lengthline(x1,y1,20,0,BLACK);
for(int x=57;x<=77;x+=5)
{
  for(int y = 60;y<=132;y+=5)
{
 for(int i = 0;i<=1;i++)
 lengthline(x-i,y+i,i*2,0,0xFFF);
 for(int i = 0;i<=1;i++)
 lengthline(x-1,y+1+i,2,0,0xFFF);
 for(int i = 0;i<=1;i++)
 lengthline(x-1,y+2+i,2,0,0xFFF);
 for(int i = 1;i>=0;i--)
 lengthline(x-i,y+3-i,i*2,0,0xFFF);
}
}

   for(int i = 0;i<=25;i++)
 lengthline(77,5+i,50,0,0xFFF);
 for(int i = 0;i<=25;i++)
 lengthline(77,30+i,50,0,0xCFF);
 
 
  while(1)
  {
  for(float i =0;i<360;i+=0.6)
  {
  for(int l=(0);l<=0;l++)
  lengthline(102,30,22,i+l,0x000);
  delay(18);
   for(int l=(-1);l<=1;l++)
 {if((i>0)&&(i<180))
  lengthline(102,30,18,j+l,0xCFF);
  else
  lengthline(102,30,18,j+l,0xFFF);}
   for(int l=(-3);l<=3;l++)
  { if((i>0)&&(i<180))
  lengthline(102,30,14,k+l,0xCFF);
  else
  lengthline(102,30,14,k+l,0xFFF);}
  j+=0.01;
  k+=((0.01)/60);
  for(int l=(-1);l<=1;l++)
  lengthline(102,30,18,j+l,0x000);
  for(int l=(-3);l<=3;l++)
  lengthline(102,30,14,k+l,0x000);
 for(int l=(0);l<=0;l++)
 {
   if((i>0)&&(i<180))
  lengthline(102,30,22,i+l,0xCFF);
  else
  lengthline(102,30,22,i+l,0xFFF);}
   LCDCommand(P_DISPON);
  
  }
 }
}



Moderator edit: [code] [/code] tags added.
« Last Edit: January 01, 2012, 03:23:53 pm by Coding Badly » Logged

Delhi, India
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

code continued ...

Code:
void theme2()
{
  
 square(1,1,132,0xF00);
 square(4,4,126,0xE00);
 square(7,7,120,0xD00);
 square(10,10,114,0xC00);
 square(13,13,108,0xB00);
 square(16,16,102,0xA00);
 square(19,19,96,0x900);
 square(22,22,90,0x800);
 square(25,25,84,0x700);
 square(28,28,78,0x600);
 square(31,31,72,0x500);
 square(34,34,66,0x400);
 square(37,37,60,0x300);
 square(40,40,54,0x200);
 square(43,43,48,0x100);
 square(46,46,42,0x000);
 while(1)
 {
  second1();
 }
}

void setup()
{
Serial.begin(9600);
pinMode(10,INPUT);

//Initialize ARM I/O
ioinit();
        delay(100);
ioinit();
        delay(100);
        ioinit();
pinMode(13,OUTPUT);
delay(100);
LCDInit(); //Initialize the LCD

}

void theme1()
{
   for(int i=0;i<=132;i++)
 lengthline(1,i,132,0,RED);
 edge(106,69,15,0,BLUE);
 edge(100,87,15,30,BLUE);
 edge(87,100,15,60,BLUE);
 edge(70,106,15,90,BLUE);
 edge(50,100,15,120,BLUE);
 edge(35,87,15,150,BLUE);
 edge(30,69,15,180,BLUE);
 edge(35,50,15,210,BLUE);
  edge(50,35,15,240,BLUE);
 edge(70,26,15,270,BLUE);
 edge(87,35,15,300,BLUE);
 edge(103,47,15,330,BLUE);

 for(int i=26;i<=100;i++)
  lengthline(64,i,6,0,RED);

 while(1)
 {
second();
 }
}

void cuboid(int x,int y,int lt,int ht,int bt)
{
 for(int i = 0;i<=ht;i++)
 lengthline(x,y+i,bt,30,0x0B0);
 for(int i = 0;i<=ht;i++)
 lengthline(x,y+i,lt,150,0x0E0);
 for(float i = 0;i<=lt;i+=0.5)
 lengthline(x + i*(cos(150*0.01746)),y+ht + i*(sin(150*0.01746)),bt,30,0x0A0);
}

void cuboid1(int x,int y,int lt,int ht,int bt)
{
 for(int i = 0;i<=ht;i++)
 lengthline(x,y+i,bt,30,0x500);
 for(int i = 0;i<=ht;i++)
 lengthline(x,y+i,lt,150,0xA00);
 for(float i = 0;i<=lt;i+=0.5)
 lengthline(x + i*(cos(150*0.01746)),y+ht + i*(sin(150*0.01746)),bt,30,0x000);
}

void cuboid2(int x,int y,int lt,int ht,int bt)
{
 for(int i = 0;i<=ht;i++)
 lengthline(x,y+i,bt,30,0xFFF);
 for(int i = 0;i<=ht;i++)
 lengthline(x,y+i,lt,150,0xFFF);
 for(float i = 0;i<=lt;i+=0.5)
 lengthline(x + i*(cos(150*0.01746)),y+ht + i*(sin(150*0.01746)),bt,30,0xFFF);
}

void one(int x,int y)
{
 int ht,bt,lt;
 ht = 5;bt = 5;lt = 10;
 cuboid(x,y,lt,ht,bt);
 x=x;y=y+ht-1;ht = 22;lt = 5; bt = 5;
 cuboid(x,y,lt,ht,bt);
}
void seven(int x,int y)
{
 int ht,bt,lt;
 ht = 5;bt = 5;lt = 17;
 cuboid(x,y,lt,ht,bt);
 x=x;y=y+ht-1;ht = 22;lt = 5; bt = 5;
 cuboid(x,y,lt,ht,bt);
}
void three(int x,int y)
{
  int ht,bt,lt;
  lt=17;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
  x=x;y=y+ht-1;lt=5;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
   x=x;y=y+ht-1;lt=17;bt=5;ht=6;
   cuboid(x,y,lt,ht,bt);
   x=x;y=y+ht-1;lt=5;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
  x=x;y=y+ht-1;lt=17;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
}
void two(int x,int y)
{
   int ht,bt,lt;
  lt=17;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
  x=x;y=y+ht-1;lt=5;bt=5;ht=5;
  cuboid(x,y,lt,ht,bt);
   x=x;y=y+ht-1;lt=17;bt=5;ht=6;
   cuboid(x,y,lt,ht,bt);
   x=x-10;y=y+ht+6-1;lt=5;bt=5;ht=7;
  cuboid(x,y,lt,ht,bt);
  x=x+10;y=y+ht-6-1;lt=17;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
}
void five(int x,int y)
{
   int ht,bt,lt;
  lt=17;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
  x=x-10;y=y+ht+6-1;lt=5;bt=5;ht=5;
  cuboid(x,y,lt,ht,bt);
   x=x+10;y=y+ht-6-1;lt=17;bt=5;ht=6;
   cuboid(x,y,lt,ht,bt);
   x=x;y=y+ht-1;lt=5;bt=5;ht=7;
  cuboid(x,y,lt,ht,bt);
  x=x;y=y+ht-1;lt=17;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
}
void s(int x,int y)
{
   int ht,bt,lt;
  lt=17;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
  x=x-10;y=y+ht+6-1;lt=5;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
   x=x+10;y=y+ht-6-1;lt=17;bt=5;ht=7;
   cuboid(x,y,lt,ht,bt);
   x=x;y=y+ht-1;lt=5;bt=5;ht=8;
  cuboid(x,y,lt,ht,bt);
  x=x;y=y+ht-1;lt=17;bt=5;ht=7;
  cuboid(x,y,lt,ht,bt);
}
void dot(int x,int y)
{
  int lt,bt,ht;
  lt = 5;ht= 5;bt =5;
  cuboid(x,y,lt,ht,bt);
}

void eight(int x,int y)
{
   int ht,bt,lt;
  lt=17;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
  x=x;y=y+ht-1;lt=5;bt=5;ht=5;
  cuboid(x,y,lt,ht,bt);
  x=x-10;y=y+6;lt=5;bt=5;ht=5;
  cuboid(x,y,lt,ht,bt);
   x=x+10;y=y+ht-6-1;lt=17;bt=5;ht=6;
   cuboid(x,y,lt,ht,bt);
   x=x;y=y+ht-1;lt=5;bt=5;ht=7;
  cuboid(x,y,lt,ht,bt);
   x=x-10;y=y+6;lt=5;bt=5;ht=7;
  cuboid(x,y,lt,ht,bt);
  x=x+10;y=y+ht-6-1;lt=17;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
}
void four(int x,int y)
{
   int ht,bt,lt;
  x=x;y=y;lt=5;bt=5;ht=10;
  cuboid(x,y,lt,ht,bt);
  x=x-10;y=y+6;lt=5;bt=5;ht=10;
  cuboid(x,y,lt,ht,bt);
   x=x+10;y=y+ht-6-1;lt=17;bt=5;ht=8;
   cuboid(x,y,lt,ht,bt);
   x=x;y=y+ht-1;lt=5;bt=5;ht=12;
  cuboid(x,y,lt,ht,bt);
}

void zero(int x,int y)
{
   int ht,bt,lt;
  lt=17;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
  x=x;y=y+ht-1;lt=5;bt=5;ht=18;
  cuboid(x,y,lt,ht,bt);
  x=x-10;y=y+6;lt=5;bt=5;ht=18;
  cuboid(x,y,lt,ht,bt);
  x=x+10;y=y+ht-6-1;lt=17;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
}

void nine(int x,int y)
{
   int ht,bt,lt;
  lt=17;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
  x=x;y=y+ht-1;lt=5;bt=5;ht=5;
  cuboid(x,y,lt,ht,bt);
  x=x-10;y=y+6;lt=5;bt=5;ht=5;
  cuboid(x,y,lt,ht,bt);
   x=x+10;y=y+ht-6-1;lt=17;bt=5;ht=6;
   cuboid(x,y,lt,ht,bt);
   x=x;y=y+ht-1;lt=5;bt=5;ht=7;
  cuboid(x,y,lt,ht,bt);
  x=x;y=y+ht-1;lt=17;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
}

void six(int x,int y)
{
   int ht,bt,lt;
  lt=17;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
  x=x-10;y=y+6+ht-1;lt=5;bt=5;ht=5;
  cuboid(x,y,lt,ht,bt);
   x=x+10;y=y+ht-6-1;lt=17;bt=5;ht=6;
   cuboid(x,y,lt,ht,bt);
   x=x;y=y+ht-1;lt=5;bt=5;ht=7;
  cuboid(x,y,lt,ht,bt);
   x=x-10;y=y+6;lt=5;bt=5;ht=7;
  cuboid(x,y,lt,ht,bt);
  x=x+10;y=y+ht-6-1;lt=17;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
}
void day(int date,int month,int year)
{
  long unsigned int p=0,l=0,r=0,s=0;
  for(l=0;l<=year;l++)
  {
  if(((year-1)/100)^((year-1)/400)^((year-1)/4))
  p++;
  }
  p = p + (year*365);
  switch(month){
    case 1:p = p+date;
    break;
    case 2:p=p+31+date;
    break;
    case 3:{
    if(((year)/100)^((year)/400)^((year)/4))
    p = p+31+date+29;
    else
    p=p+31+date+28;
    }
    case 4:p = p=p+31+date+28+31;
    break;
    case 5:p = p=p+31+date+28+31+30;
    break;
    case 6:p = p=p+31+date+28+31+30+31;
    break;
    case 7:p = p=p+31+date+28+31+30+31+30;
    break;
    case 8:p = p=p+31+date+28+31+30+31+30+31;
    break;
    case 9:p = p=p+31+date+28+31+30+31+30+31+31;
    break;
    case 10:p = p=p+31+date+28+31+30+31+30+31+31+30;
    break;
    case 11:p = p=p+31+date+28+31+30+31+30+31+31+30+31;
    break;
    case 12:p = p=p+31+date+28+31+30+31+30+31+31+30+31+30;
    break;
  }
  p = (p%7);
  }
void t(int x,int y)
{
 int ht,bt,lt;
 ht = 5;bt = 5;lt = 20;
 cuboid(x,y,lt,ht,bt);
 x=x-7;y=y+ht+4;ht = 24;lt = 5; bt = 5;
 cuboid(x,y,lt,ht,bt);
}
void u(int x,int y)
{
  int ht,bt,lt;
   x=x;y=y;lt=5;bt=5;ht=24;
  cuboid(x,y,lt,ht,bt);
  x=x-10;y=y+6;lt=5;bt=5;ht=24;
  cuboid(x,y,lt,ht,bt);
  x=x+10;y=y+ht-6-1;lt=17;bt=5;ht=7;
  cuboid(x,y,lt,ht,bt);
}

void nt(int x,int y)
{
   int ht,bt,lt;
  lt=21;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
  x=x;y=y+ht-1;lt=5;bt=5;ht=25;
  cuboid(x,y,lt,ht,bt);
  x=x-10;y=y+6;lt=5;bt=5;ht=25;
  cuboid(x,y,lt,ht,bt);
  x=x+10;y=y+ht-6-1;lt=17;bt=5;ht=7;
 // cuboid(x,y,lt,ht,bt);
}
void a(int x,int y)
{
   int ht,bt,lt;
  lt=17;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
  x=x;y=y+ht-1;lt=5;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
  x=x-10;y=y+6;lt=5;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
   x=x+10;y=y+ht-6-1;lt=17;bt=5;ht=7;
   cuboid(x,y,lt,ht,bt);
   x=x;y=y+ht-1;lt=5;bt=5;ht=14;
  cuboid(x,y,lt,ht,bt);
   x=x-10;y=y+6;lt=5;bt=5;ht=14;
  cuboid(x,y,lt,ht,bt);
}

Moderator edit: [code] [/code] tags added.
« Last Edit: January 01, 2012, 03:24:31 pm by Coding Badly » Logged

Delhi, India
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

code continued ....

Code:
void r(int x,int y)
{
   int ht,bt,lt;
  lt=17;bt=5;ht=6;
  cuboid(x-3,y,lt,ht,bt);
  x=x-3;y=y+ht-1;lt=5;bt=5;ht=8;
  cuboid(x,y,lt,ht,bt);
  x=x-7;y=y+6;lt=5;bt=5;ht=6;
  cuboid(x,y,lt,ht,bt);
   x=x+10;y=y+ht-6-1;lt=17;bt=5;ht=7;
   cuboid(x,y,lt,ht,bt);
   x=x;y=y+ht-1;lt=5;bt=5;ht=14;
  cuboid(x,y,lt,ht,bt);
   x=x-10;y=y+6;lt=5;bt=5;ht=14;
  cuboid(x,y,lt,ht,bt);
}

void test()
{float x,y,m,m1,x1;
  for(int i =0;i<=132;i++)
lengthline(1,i,132,0,WHITE);
x=66;y=66;
m= tan(130*0.01746);
m1 = tan(150*0.01746);
for(float i =0; i<=30;i++,y++)
{
x = ((y-66)/m)+66;
x1 = ((y-66)/m1)+66;
line(x,y,x1,y,((i/2)*16*16));
}
for(;x>=x1;x1+=0.3,y+=0.5)
{
 x = ((y-66)/m)+66;
line(x,y,x1,y,0xF00);
}
x=66;y=66;
m= tan(150*0.01746);
m1 = tan(170*0.01746);
for(float i =0; i<=30;i++,y++)
{
x = ((y-66)/m)+66;
x1 = ((y-66)/m1)+66;
line(x,y,x1,y,(((i/2)+2)*16*16));
}
for(;x<=x1;x--,y++)
{
 x1 = ((y-66)/m1)+66;
line(x,y,x1,y,0xF00);
}
}


int pl ;
void play(int x,int y)
{
 

  for(int j =0;j<4;j++)
  {int i=4;
    i=i-j;
  for(;i>0;i--)
  {
    if(pl==0)
  cuboid(x+(j*8),y+(i*8)+(j*4),4,4,4);
  else
  cuboid1(x+(j*8),y+(i*8)+(j*4),4,4,4);
  }
  }
}


void ff(int x,int y)
{

  for(int j =0;j<3;j++)
  {int i=4;
    i=i-j;
  for(;i>0;i--)
  {
  cuboid(x+(j*6),y+(i*6)+(j*3),3,3,3);
  }
  }

for(int j =0;j<4;j++)
  {int i=4;
    i=i-j;
  for(;i>0;i--)
  {
  cuboid(x+19+(j*6),y+(i*6)+(j*3),3,3,3);
  }
  }

}


void bb(int x,int y)
{

  for(int j =4;j>0;j--)
  {int i=4;
  i=i-j;
  for(;i>=0;i--)
  {
  cuboid(x+((4-j)*6),y+(i*6)+(j*3),3,3,3);
  }
  }

for(int j =3;j>0;j--)
  {int i=4;
    i=i-j;
  for(;i>=0;i--)
  {
  cuboid(x+18+((4-j)*6),y+(i*6)+(j*3),3,3,3);
  }
  }

}


void sat()
{
   for(int i=0;i<=132;i++)
 lengthline(1,i,132,0,0xFFF);

 cuboid(40,0,70,10,110);
  cuboid(110,0,70,10,110);
   cuboid(15,30,10,10,110);
 cuboid(60,25,70,10,110);

 cuboid(75,85,100,10,60);
 cuboid(115,90,100,10,10);
 cuboid(20,75,20,20,20);
 
  five(50,80);
  a(75,60);
  t(100,40);
 cuboid(120,25,20,20,20);
}


void calender(int date,int month,int year)
{

  int x=20,y=80;
  for(int i=0;i<=132;i++)
 lengthline(1,i,132,0,0xFFF);

 cuboid(40,0,70,10,110);
  cuboid(110,0,70,10,110);
   cuboid(15,30,10,10,110);
 cuboid(60,25,70,10,110);

 cuboid(75,85,100,10,60);
 cuboid(115,90,100,10,10);
  
 if((date/10)==0)
  zero(x,y);
  if((date/10)==1)
  one(x,y);
  if((date/10)==2)
  two(x,y);
  if((date/10)==3)
  three(x,y);
  
  if((date%10)==1)
  one(x+17,y-11);
  if((date%10)==2)
  two(x+17,y-11);
  if((date%10)==3)
  three(x+17,y-11);
  if((date%10)==4)
  four(x+17,y-11);
  if((date%10)==5)
  five(x+17,y-11);
  if((date%10)==6)
  six(x+17,y-11);
  if((date%10)==7)
  seven(x+17,y-11);
  if((date%10)==8)
  eight(x+17,y-11);
  if((date%10)==9)
  nine(x+17,y-11);
  if((date%10)==0)
  zero(x+17,y-11);
  
  dot(x+26,y-4);
  
   if((month/10)==0)
  zero(x+44,y-26);
  if((month/10)==1)
  one(x+44,y-26);
 
   if((month%10)==1)
  one(x+61,y-37);
  if((month%10)==2)
  two(x+61,y-37);
  if((month%10)==3)
  three(x+61,y-37);
  if((month%10)==4)
  four(x+61,y-37);
  if((month%10)==5)
  five(x+61,y-37);
  if((month%10)==6)
  six(x+61,y-37);
  if((month%10)==7)
  seven(x+61,y-37);
  if((month%10)==8)
  eight(x+61,y-37);
  if((month%10)==9)
  nine(x+61,y-37);
  if((month%10)==0)
  zero(x+61,y-37);

dot(x+70,y-30);
  
 if(((year%100)/10)==1)
  one(x+88,y-52);
  if(((year%100)/10)==2)
  two(x+88,y-52);
  if(((year%100)/10)==3)
  three(x+88,y-52);
  if(((year%100)/10)==4)
  four(x+88,y-52);
  if(((year%100)/10)==5)
  five(x+88,y-52);
  if(((year%100)/10)==6)
  six(x+88,y-52);
  if(((year%100)/10)==7)
  seven(x+88,y-52);
  if(((year%100)/10)==8)
  eight(x+88,y-52);
  if(((year%100)/10)==9)
  nine(x+88,y-52);
  if(((year%100)/10)==0)
  zero(x+88,y-52);
  
  if(((year%100)%10)==1)
  one(x+105,y-63);
  if(((year%100)%10)==2)
  two(x+105,y-63);
  if(((year%100)%10)==3)
  three(x+105,y-63);
  if(((year%100)%10)==4)
  four(x+105,y-63);
  if(((year%100)%10)==5)
  five(x+105,y-63);
  if(((year%100)%10)==6)
  six(x+105,y-63);
  if(((year%100)%10)==7)
  seven(x+105,y-63);
  if(((year%100)%10)==8)
  eight(x+105,y-63);
  if(((year%100)%10)==9)
  nine(x+105,y-63);
  if(((year%100)%10)==0)
  zero(x+105,y-63);
   LCDCommand(P_DISPON);
   while(1);

}
int kk;
void bar(int y)
{
  if(kk>=y)
  {
  for(float vol = 1;vol<=(12-(y/10));vol++)
   cuboid2(130-(vol*10),110,4,16,4);
  }
  if(kk<=y)
  {
 for(float vol = 1;vol<=(y/10);vol++)
 cuboid1((vol*10),110,4,16,4);
  }
  kk=y;

}
//************************************************************************
// Loop
//************************************************************************
float i=0;
void loop()
{ int p=0,n =2;
if(n==6)
{
  sat();
  while(1);
}
 if(n==0)
 {
 for(int i =0;i<=132;i++)
lengthline(1,i,132,0,0xFFF);
pl =1;
play(5,0);
ff(5,40);
bb(5,70);
kk=50;
int o=(-10);
while(1)
{
o=(-1)*o;
for(int y= 0;y<=120 && y>=0;y+=o)
bar(y);
}
}
if(n==3)
 cube();
 if(n==2)
 theme2();
 if(n==1)
 theme1();
 if(n==4)
 hexagon();
 if(n==5)
 calender(31,12,2011);
digitalWrite(13,HIGH);

}

//************************************************************************
void ioinit(void)
{
DDRD = ((1<<CS)|(1<<DIO)|(1<<SCK)|(1<<LCD_RES)); //Set the control pins as outputs
}




//************************************************************************


Moderator edit: [code] [/code] tags added.
« Last Edit: January 01, 2012, 03:26:36 pm by Coding Badly » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 610
Posts: 49077
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
three times smiley-razz .... i got your point !!
Apparently not, since you've posted code incorrectly all over the place, too.
Logged

Delhi, India
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i was asked to do so... thank you !!
Logged

Offline Offline
Faraday Member
**
Karma: 65
Posts: 2500
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yahska,
I'd like to see the "watch" assembly.
Must be like a timepiece gauntlet or something?
I used to get a lot of flak for an LED watch that I wore well into the 90s.  No sooner did I get an LCD than these over-sized mechanical watch-tanks came into vogue.  Hey, it's all good.
Instead of posting the code, attach it (the .PDE) -- click on Additional Options... (it's right under the text box, to the left)
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12631
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i was asked to do so... thank you !!


If you're going to post code then please put it inside [ code] [ /code ] tags so that the forum software doesn't mangle it. If the code is too big to be included in a single message, you could attach it rather than put it in the body of the message. In fact that's probably best anyway since you're only publishing the code and not asking anyone to comment on it.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Delhi, India
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i'll do as mentioned by you guys next time i upload a code. Thank You.
Logged

Offline Offline
God Member
*****
Karma: 1
Posts: 547
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please fire the cameraman for not maintaining a vantage point and maintaining focus.....
Logged

Pages: [1] 2   Go Up
Jump to: