Forum » Programiranje » pic basic vprašanje
pic basic vprašanje
refosk ::
Lotil sem se programiranja s pic basicom. Zanima me kako bi rešil problem da mi led dioda 3x utripne. Če napišem program takole
led var portb.1
high led
pause 500
low led
pause 500
high led
pause 500
low led
pause 500
high led
pause 500
low led
pause 500
end
dela OK, ko pa uporabim FOR-NEXT zanko takole
led var portb.1
for led = 1 to 3
high led
pause 500
low led
pause 500
next led
end
ledica stalno utripa. Kje je napaka?
Kako bi rešil problem z zanko WHILE...WEND ali pa IF..THEN?
led var portb.1
high led
pause 500
low led
pause 500
high led
pause 500
low led
pause 500
high led
pause 500
low led
pause 500
end
dela OK, ko pa uporabim FOR-NEXT zanko takole
led var portb.1
for led = 1 to 3
high led
pause 500
low led
pause 500
next led
end
ledica stalno utripa. Kje je napaka?
Kako bi rešil problem z zanko WHILE...WEND ali pa IF..THEN?
Highlag ::
Verjetno imaš ime spejemljivke napačno.
Najprej ga definiraš kot
led var portb.1 to pomeni da z led spremenjlivko krmiliš portb
Potem pa to spremenljivko uporabiš za štetje:
for led ....
Tu je verjetno napaka. Napiši namesto for led :
for korak
in na koncu
next korak ali kaj podobnega.
Najprej ga definiraš kot
led var portb.1 to pomeni da z led spremenjlivko krmiliš portb
Potem pa to spremenljivko uporabiš za štetje:
for led ....
Tu je verjetno napaka. Napiši namesto for led :
for korak
in na koncu
next korak ali kaj podobnega.
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | Bascom AVROddelek: Programiranje | 1017 (835) | listje123 |
» | PIC18F4550 in ds18s20Oddelek: Elektrotehnika in elektronika | 1993 (1672) | snow |
» | Zelo pocasno utripanje LED diode (strani: 1 2 )Oddelek: Elektrotehnika in elektronika | 8714 (7919) | a13misko |
» | Leteče luči; AT90S2313, AT89C2051Oddelek: Elektrotehnika in elektronika | 2475 (2296) | Red_Mamba |
» | PIC 16f84A - utripanjeOddelek: Elektrotehnika in elektronika | 2219 (2019) | ql000 |