Difference between revisions of "Tony2.nxc"

From RoboWiki
Jump to: navigation, search
m
m
 
Line 1: Line 1:
[[Krúžok robotiky]]
+
[[Krúžok Robotiky]]
  
 
  /*
 
  /*

Latest revision as of 11:24, 26 March 2008

Krúžok Robotiky

/*
  nasledovny program nam nieco zahra

  following program should play something
*/
#include "NXCDefs.h"



task main()
{
int c= 523;
int d= 587;
int e= 659;
int f= 698;
int g= 784;
int a= 880;
int h= 988;
int c2= 1046;

 //array that stores melody
 int tones[50]={c,d,e,f,g,a,h,c2};
 //array storing duration of tone
 int duration[50]={100,100,100,100,100,100,100,100};
 //array storing delay between tones
 int delay[50]={100,100,100,100,100,100,100,100};

   int i;
    // tones song;
     for (i=0;i<ArrayLen(tones);i++)
     {
      PlayTone(tones[i],duration[i]);
      Wait(delay[i]);
     }
}