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.

will this code work?

Q1-here is the code for picaxe 08m2 will it work or something is wrong
Q2-to repeat a code what value do i have to give for the FOR loop i have assumed it to be 0 to 0

THE CODE---------

main: if pinc.4 = 1 then main2
      if pinc.0 = 1 then main3
      if pinc.1 = 1 then main4
      goto main
     
main2:for b0 = 0 to 0
      play 2,0
      next b0
      pause 2000
      goto main
     
main3:for b0 = 0 to 0
      play 2,1
      next b0
      pause 2000
      goto main     
     
main4:for b0 = 0 to 0
      play 2,3
      next b0
      pause 2000
      goto main

7 answers
sort by: active | newest | oldest
Dec 2, 2011. 11:18 AMrickharris says:
Have you tried to run it in the simulator?

Your code runs and I can get it to play all 3 tunes so in that respect I guess it works. (simulated)

As for Q2 you don't need the for next as the tune will play a single run through once it is started automatically.

Dec 3, 2011. 4:42 AMrickharris says:
Assuming the commands are correct I would think so - You will have to do it and have a go - you may need to make minor alterations as you go along.
Dec 3, 2011. 4:44 AMrickharris says:
If I understand what your saying - You don't need the for next loop at all - When a switch is pressed a tune will play.

Once it is playing it will continue until the tune is finished without you doing anything.

Is that what you want it to do.
Dec 3, 2011. 1:15 PMrickharris says:
Then that's what it does - at least in the simulator.

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!