PICAXE
(Rozdíly mezi verzemi)
(→Náměty:) |
|||
Řádka 93: | Řádka 93: | ||
<gallery> | <gallery> | ||
− | Image: | + | Image:D10_HW_picaxe.jpg| Modul s [[PICAXE]]-18X. Programování v Basicu a [[SD20]]. [http://shop.snailinstruments.com/index.php?main_page=advanced_search_result&search_in_description=1&zenid=f7ce17dec68c901d159d6c3ad334677f&keyword=picaxe] |
</gallery> | </gallery> | ||
Verze z 2. 5. 2013, 20:04
PICAXE | |
Download SW: Tutoriály:
|
Tasks | |
Náměty:
PICAXE-08M MCU pro programování v Basicu. [1]
PICAXE8 LED |
init: LET b0 = 0 main: IF pin3 = 1 THEN add 'i/o pin 3 = physical ic pin 4 IF pin3 = 0 THEN low 1 endif GOTO main add: pause 100 LET b0 = b0 + 1 IF b0 < 5 THEN main high 1 'i/o pin 1 = physical pin 6 GOTO main |
PICAXE81 |
[ info] |
LED blikání |
main: low 0 ' PIN 0 set OFF, LED will be shine ' linka 0 se vynuluje, LED bude svítit pause 500 ' wait 500 ms/ čekání 500 ms high 0 ' PIN 0 set ON, LED will not be shine ' linka 0 se nastavi do log. "1", LED nebude svítit pause 500 ' čekání 200 ms GOTO main 'jump to label main 'skok na návěští main |
Běžící had
Chyba při vytváření náhledu: Soubor patrně chybí: /var/www/wiki.sps-pi.cz/www/images/f/f3/Ukáza_programu.jpg
|
pins = %11111111 ;zhasne všechny diody main: pause 1000 ' čekání 1 000 ms = 1 s low 0 ' linka 0 se vynuluje log. "0" pause 200 ' čekání 200 ms high 0 ' linka 0 se nastavi do log. "1" low 1 pause 200 high 1 'dále postupně přepíná s 200 ms pauzou low 2 pause 200 high 2 low 3 pause 200 high 3 low 4 pause 200 high 4 low 5 pause 200 high 5 low 6 pause 200 high 6 low 7 pause 200 high 7 GOTO main 'skok na návěští main |
Robot Umík |
je postaven na podvozku UMU-01 Lze sestavit v konfiguraci stopař pro sledování čáry nebo minisumo
|
![]() |
PICAXE MICROCONTROLLERS |
PICAXE02 |
init: b2 = 0 ' reset targetbyte before the loop ' input C.0, active high, jump to ‘pushed’ label when = 1 myloop: button C.0,1,200,100,b2,1,pushed ' jump to cont when C.0 = 1 low B.7 ' output off pause 10 ' loop delay time GOTO myloop pushed: high B.7 ' output on GOTO myloop |
Push Switch |
init: LET b0 = 0 main: IF pinC.7 = 1 THEN add low B.7 GOTO main add: pause 100 'short delay LET b0 = b0 + 1 IF b0 < 5 THEN main high B.7 GOTO main |
For..Next |
symbol counter = b0 'define the variable counter symbol dp = 7 'define pin 7 with the name dp main: FOR counter = 1 TO 15 'start a for...next loop high dp 'switch pin 7 high pause 500 'wait for 0.5 second low dp 'switch pin 7 low pause 500 'wait for 0.5 second NEXT counter 'end of for...next loop END 'end program |
PICAXE03 |
symbol counter = b0 'define the variable counter symbol dp = 7 'define pin 7 with the name dp main: FOR counter = 1 TO 20 'start a for...next loop pins = %11000000 ' symbol 0 pause 100 'wait for 0.1 second pins = %11111001 ' symbol 1 pause 100 pins = %10010100 ' symbol 2 pause 100 pins = %10001111 ' symbol 3 pause 100 pins = %10011001 ' symbol 4 pause 100 pins = %11101101 ' symbol 5 pause 100 NEXT counter 'end of for...next loop END [ info] |
PICAXE04 |
symbol counter = b0 'define the variable counter symbol dp = 7 'define pin 7 with the name dp w1 = %00000000 main: FOR counter = 1 TO 255 'start a for...next loop pins = w1 'start pause 100 'wait for 0.1 second w1 = w1 + 1 'incrementace NEXT counter 'end of for...next loop END [ info] |
Counter |
rst: w1 = %00000000 pins = w1 main: IF pinC.6 = 1 THEN rst IF pinC.7 = 1 THEN add GOTO main add: pause 50 ' short delay LET b0 = b0 + 1 IF b0 < 5 THEN main pins = w1 ' symbol 0 w1 = w1 + 1 GOTO main END [ info] |
Servo |
servo 4, 150 ' start servo on pin four and move to center main: pause 500 ' wait a half second servopos 4, 200 ' move servo clockwise pause 500 ' wait a half second servopos 4, 150 ' move servo to center pause 500 ' wait a half second servopos 4, 100 ' move servo counter-clockwise pause 500 ' wait a half second servopos 4, 150 ' move servo to center GOTO main ' return to main program loop |