Difference between revisions of "Adam blik1.nxc"
From RoboWiki
m |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | [[Krúžok Robotiky]] | |
− | Program nahodne blika ziarovkou pripojenou na port C | + | /* adam_blik1.nxc |
− | + | ||
− | Autor: Adam Trizuljak | + | Program nahodne blika ziarovkou pripojenou na port C |
− | + | ||
− | */ | + | Autor: Adam Trizuljak |
− | + | ||
− | int on, off; //premenne on a off | + | */ |
− | + | ||
− | task main() | + | int on, off; //premenne on a off |
− | + | ||
− | + | task main() | |
{ | { | ||
− | OnFwd(OUT_C, 50); //zapni C na 50% | + | while(1) //nekonecna slucka |
− | + | { | |
− | + | OnFwd(OUT_C, 50); //zapni C na 50% | |
− | + | on=random(500); //premenna on = nahod. cislo do 500 | |
− | + | Wait(on); //cakaj podla on | |
− | + | ||
− | + | Float(OUT_C); //vypni C na 50% | |
− | + | off=random(1800)+200; //premenna off = nahod. cislo do 1800 + 200 | |
+ | Wait(off); //cakaj podla off | ||
+ | |||
+ | } | ||
} | } | ||
− |
Latest revision as of 10:16, 26 March 2008
/* adam_blik1.nxc Program nahodne blika ziarovkou pripojenou na port C Autor: Adam Trizuljak */ int on, off; //premenne on a off task main() { while(1) //nekonecna slucka { OnFwd(OUT_C, 50); //zapni C na 50% on=random(500); //premenna on = nahod. cislo do 500 Wait(on); //cakaj podla on Float(OUT_C); //vypni C na 50% off=random(1800)+200; //premenna off = nahod. cislo do 1800 + 200 Wait(off); //cakaj podla off } }