Difference between revisions of "Tony2.nxc"

From RoboWiki
Jump to: navigation, search
 
m
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 +
[[Krúžok Robotiky]]
 +
 
  /*
 
  /*
 
   nasledovny program nam nieco zahra
 
   nasledovny program nam nieco zahra

Latest revision as of 10: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]);
     }
}