Picaxe-08 Electronic Dice Project

IJ21

New Member
I have tried to program the dice with program 2 on page 33 of the PICAXE-08 ELECTRONIC DICE PROJECT PDF. Am I doing something wrong as it will only light up LED 2 when the switch is pressed? The PCB has been checked and its ok.
 

Andrew Cowan

Senior Member
Maybe the some LEDs are wired up the wrong way round? Can you show us a photo (or scan) of both the top and bottom of the PCB?

A
 

IJ21

New Member
As previously stated the PCB is ok, all the LEDs and the switch have been tested with individual programs. I have noted that the same thing happens in the simulaion software as happpens with the PCB. It's got to be something with the program, although I have checked several times and also had someone else chect it.
 

eclectic

Moderator
@IJ21

Is this the EXACT program ?
(I copied it from the PE Samples folder)

Code:
' ****** Dice using random command *****

	low 0		' make LED pins outputs
	low 1
	low 2
	low 4

main:
	let pins=0	' switch all LEDs off
	random b1	' get a random number
	if input3 is on then makenumber	' test switch
	goto main

makenumber:
	if b1>210  then showsix		' test random number and jump
	if b1>168 then showfive
	if b1>126  then showfour
	if b1>84  then showthree
	if b1>42 then showtwo

showone:
	let pins=4	' show LEDs for 1
	wait 2
	goto main

showtwo:
	let pins=16	' show LEDs for 2
	wait 2
	goto main

showthree:
	let pins=20	' show LEDs for 3
	wait 2
	goto main

showfour:
	let pins=18	' show LEDs for 4
	wait 2
	goto main

showfive:
	let pins=22	' show LEDs for 5
	wait 2
	goto main

showsix:
	let pins=19	' show LEDs for 6
	wait 2
	goto main
It works in the simulator.

e
 

BCJKiwi

Senior Member
# update
Posts crossed.
The PDF accessed via the PE (it appears to be the pdf in the datasheets folder) has different code from that in .bas in the samples folder and does not include the random command!
#update

Hmm,
Just had a look at the code in the PDF.

It says at the top "Dice using random command".

However there appears to be no code for the random command.

There is a random b1 in the flowchart however.

Suggest you add the line

random b1

between the low 4
and
if input3 ......

and see how it goes.
 
Last edited:

eclectic

Moderator
Glad to see that it's all OK now.

As an aside, has anyone tried to copy the program from the PDF page33?

I tried copy then paste and got gobbledegook!

e
 

eclectic

Moderator
"I tried copy then paste and got gobbledegook!"

Thanks BCJ.

I thought me or my computer were going mad!

Why do some Picaxe PDF's allow perfect copy and paste,
whilst others just
errr... don't?

e
 

BCJKiwi

Senior Member
I use Foxit Reader which has a text capture function. It is usually good on PDF text but does not like graphics - there are separate functions for that.

Have just tested the text capture again and it puts black bars into the PE but in Notepad2 (an enhanced notepad program) it displays most of the text as control codes - e.g. ETX, BOT, NAK, SI, BS, FF, DC1 etc plus the odd printable like !, +, . etc

Foxit reader also has a text viewer mode which does not display any of the program 2 code in the PDF but is quite happy with the page header and footer.

The screen caputure mode in Foxit reader also quite happily dispays the program2 section as a graphic.
 
Top