3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Worldwide microcontroller link for under $20

Step 4Program the chips

Program the chips
We will call one program Tx and one Rx. Tx is the controlling chip and has a switch and a led. Rx also has a led. When the switch changes the signal goes from Tx to Rx, changes the led and also changes a second variable which then goes back to Tx. So flick the switch and in less than a minute the led changes on both circuits indicating that the message got there and the Rx is acting on the new switch position.

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 StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
29
Followers
3
Author:Dr_Acula