Introduction: Getting Started With PICAXE
Hello. Today you'll be learning how to use PICAXE. Hooray!
So what is PICAXE? PICAXE is, essentially, a little piece of metal and plastic you can make do stuff. Simple enough? You tell the board to send and receive various electrical pulses, which you can in turn manipulate to drive motors, blink lights, play sounds, and do lots of other fun stuff.
Before we go any further, I just want to get something straight: P-I-C-A-X-E. No K. It's an easy mistake that will really follow you if you don't get rid of it now! Don't believe me? Google "pickaxe help". Yeah, that's right.
Step 1: Purchasing the Board
Got it? Good. Our next order of business: getting the board! Here are links to some. (last one is the recommended one) Note: the board is not a PICAXE board; it's running on a PICAXE microcontroller.
Make sure not to order a board that requires soldering to assemble it if you don't know how to solder! Although if you're up for it it may be a good undertaking... there's many wonderful tutorials on soldering avaiable on Instructables alone and it's a great skill to have.
Step 2: Components...ASSEMBLE!!
This step varies too much on a case by case basis to be covered in-depth, so I won't dwell too much upon it.
If you need to solder your board, solder it. If you don't, don't!
After that, plug the power source (be it a 9V battery or a cord that plugs into the wall) into the board. Connect the serial/USB cable to your computer and continue on to Step 3!
Step 3: Downloading the PICAXE Software
The software that I will be demonstrating programming on is PICAXE's very own very authentic AXEpad software. Check out the link, it's pretty great. Download it for your respective OS, and double click it -- that's it!
One note on configuration: You have to change your settings from the default to whatever chip your board is (you can find this on the website you ordered it from, mine is 18M2). The drop down menu for the boards can be found at VIEW-->OPTIONS.
After you've installed the software, click "NEXT".
Step 4: Your First Program (Blinky Blinky Light!)
Time to write your first program! Open up AXEpad.
First, we need to define the first method, which I'm going to call main. So, type "main: " simple enough, right? Good. press enter. Next line of code.
Now, the objective here is to blink a light. To simplify that one step further for the computer, we need to turn on and off one input indefinitely. So, first, let's turn it on! In PICAXE, to do this, type "high 1" to activate pin 1.
Now a pause. You can just type "pause x" with x being the amount of milliseconds that you'd like to pause. In here, we'll use 1000 milliseconds for a 1 second pause. So, "pause 1000".
Now we need to turn the light back off. Can you guess what that command is? You got it! Or maybe you didn't. Either way, it's gonna be "low 1".
Then another pause ("pause 1000"). Without this pause, the light would turn back on the instant after it powered off.
Now, you're almost there! Homestretch! Let's take her home: the loop. In this program, all we need to do is call the "main" method again. Type "goto main"... and guess what? You've written your first program! Congrats! Here's a copy of the code that we just wrote:
Now when you upload this code to your board, it should turn on and off whatever is on input 1! (If you don't know how to attach something to an input, don't fret, it's very simple :) check out this tutorial -- it's designed for Arduino, not PICAXE, but it should work just fine!)
Step 5: You're Finished!
Let me know in the comments if you have any questions. So guess what?
You've just ordered, assembled, and tested your first PICAXE board! Congratulations! This is a feat that few accomplish. You're off to great places! You're off and away!