Step 4Program the chips
At the simplest level the picaxe has 14 single-byte registers. When a virtual network is created we link all those registers together so if a byte changes in one picaxe it changes in all the picaxes. Clearly if two picaxes are trying to change the same byte then it will get very confusing but if each picaxe only changes one byte then all the other picaxes can see that change and can act on it. Simple messages can be passed back and forward if a certain byte is only changed by one picaxe. A pot can change the value in a register and one or more other picaxes can sense that change and move a servo or whatever and turn on a heater. A second register could send back the temperature in the room.
Copy and paste the programs in turn into the picaxe programmer and download them to each of the respective chips using the blue download arrow from within the picaxe programmer.
Tx:
main:serin 3,N2400,("Data"),b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13' get packet from computer
if pin2=0 then' test the switch and set register b0 depending on status
b0=0
else
b0=1
endif
if b1=0 then' other picaxe sets b1 depending b0
low 1' led off
else
high 1' led on
endif
serout 0,N2400,("Data", b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13)' send back to computer
goto main
and Rx:
main:serin 3,N2400,("Data"),b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13' get packet from computer
b1=b0' change register b1 to equal register b0
if b1=0 then
low 1' led off
else
high 1' led on
endif
serout 0,N2400,("Data", b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13)' send back to computer
goto main
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|



















































