Programming clarification for a target practice


Active member
Hi there everyone:

This is a two minute clip:

I was wondering, how could I do this using a PICAXE microcontroller 08M2/14M2?

Is it possible?

What would be the circuitry + components I would require?

Thank you so much in advance!


Technical Support
Staff member
Given the way the board is reset by pressing the two top targets, it looks like it is using illuminated push buttons rather than anything more clever.

The hard part might be finding or making illuminated buttons which are both sensitive and robust enough.

Beyond that it's just a matter of choosing and lighting a random a LED, wait for the corresponding button to be pushed, then on to the next. That 'randomness' might have to be slightly more than simply 'random' or raw 'pseudo random'.

The harder part is determining how long it takes between lighting the LED and its button being pushed. But it should be possible to run an internal timer at microsecond rates while polling for a button push and keeping the display updated.

The differing games and variances can all be built on top of that base.

It all seems to be possible to me using any PICAXE with enough I/O. The LED's can be implemented with a short RGB LED strip and just two signal wires, the seven buttons would probably be best handled as a port wide input for speed of detection. A three-wire 7-segment display module is all that's needed for the output display.

So a 14M2, 20M2 or 20X2 would seem suitable to me. The 20X2 would make timing easier to handle and, by careful selection of which inputs were used for the buttons, they can all be mapped on to the same underlying PIC port so they can all be read with one "PEEKSFR PORTC_SFR, b0" command which would make timing accuracy more consistent.

So a 20X2 is what I would choose.

Hardware-wise; 7 x buttons with 7 x pull-down resistors. An 8-LED+ APA102 RGB LED strip. A 4-digit 7-segment display module, probably a MAX7219.


Technical Support
Staff member
                      20X2                                    -.- V+
                  .----__----.                                 |
                 -| V+    0V |-                                O |_
                 -| SI    SO |-                                  |_|
                 -| C.7  B.0 |--> Display DAT                  O |
                 -| C.6  B.1 |--> Display CLK                  |
(RC5) Button 5 -->| C.5  B.2 |<-- Button 0     (RC0)       <---{    x 7
(RC4) Button 4 -->| C.4  B.3 |<-- Button 1     (RC1)           |
(RC3) Button 3 -->| C.3  B.4 |<-- Button 2     (RC2)          .|.
(RC6) Button 6 -->| C.2  B.5 |-   N/C          (HSPI SDI)     | | 10K
(RC7)        .----| C.1  B.6 |--> Display LOAD                |_|
             |   -| C.0  B.7 |--> RGB LED CLK  (HSPI CLK)      |
             |    `----------'                                _|_ 0V
             `------------------> RGB LED DAT  (HSPI SDO)
The three display signals could be any combination of the B.0, B.1, B.6, C.0, C.6, and C.7 pins.


Technical Support
Staff member
And a piezo beeper output.

I think "number of microseconds" might actually be "number of milliseconds". Which would make it easier to implement on a 20M2.

The 14M2 doesn't seem to have enough I/O to handle it all but there might be a way to do it if the buttons were on a matrix.
Last edited:


Active member
Thank you so much hippy for your responses and the time you took to help me :).

I'm still fairly new to PICAXE so I didn't understand a few of the things you said.

I am in Year 11 but am trying to push myself. However, I think for know I don't want to make the device too complicated (i.e.the video one is maybe too hard). I making it for my club so may change some of the functions but that will be decided soon (probably in a week or so!).

Just to clarify (if I only have an 08M2/14M2 available (at a large strech 18M2 but in reality not really :(
How could I do the "random" function of which LED comes on?

Many thanks once again.


Technical Support
Staff member
You could create a fairly simple random 1 through 7 number using something like the following -
#Picaxe 08M2
#Terminal 4800

  random w0
  Let  w1 = w0 // 7 + 1
  sertxd( #w1, " " )
  pause 1000
  goto main
That "w0 // 7" divides by 7 and leaves the remainder 0 through 6, then adds 1 to it to be 1 through 7, puts the result into 'w1'.

The #TERMINAL and SERTXD commands allow the output to be shown on the screen in the Terminal windows once the program has been downloaded.

The number shown could be used as the number of the LED to light.


Active member
Thank you hippy for your help. I hope you don't mind me coming back to you when I have developed the product's functions a bit more!