Adam zvukograf2.nxc

From RoboWiki
Revision as of 10:18, 26 March 2008 by Palo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Krúžok Robotiky

/* adam_zvukograf2.nxc

  Nova verzia programu adam_zvukograf.nxc,
  lisi sa tym, ze ked sa zaplni display, vycisti ho a pokracuje v kresleni.
  
  Autor: Adam Trizuljak
*/

task main()
{
int dB; //premenna dB
int x; //premenna x
int y; //premenna y
for(x=0; x<=100; x++) // slucka ,,pri kazdom novom ,kole´ pricitaj k cas 1, kym cas nebude mensi alebo rovny ako 100"
 {
 SetSensorSound(S4); //nastav port S4 ppre zvukovy senzor
 dB = SENSOR_4; //dB = hodnota zo zenzora S4
 if (dB>80) //ak je dB>80
  {
  dB=dB/2; //vydel dB dvomi
  }
 PointOut(x, dB); //na LCD nakresli bod podla x a dB
 if (x==99) //ak sa x=99
  {
  ClearScreen(); //vycisti LCD
  x=0; //nastav x na 0
  }
 Wait(10); //cakaj 10ms
 }
}