Simple Optical/Rotary Encoder Generator

Rating: 2 votes, 4.50 average.
Was building a simple Rotary Encoder for the ARP platofrm yesterday. Could not find a simple tool to generate the pattern according to my needs, there were some POstscript based tools but they did not work on WIndows.

So here is my little script to generate it ...

PHP Code:

("Content-type: image/gif");

$size = isset($_GET['size'])?intval($_GET['size']):200;
$size1 = isset($_GET['size1'])?intval($_GET['size1']):0;
$count = isset($_GET['count'])?intval($_GET['count']):10;

$image imagecreate$size$size );

$size $size 2;

$white imagecolorallocate($image255,255,255);
$black imagecolorallocate($image0,0,);

$step 360 / ($count);

imagefilledarc  $image$size/$size/$size$size,$i*$step,($i+1)*$step$black,IMG_ARC_PIE );
$size1) {
imagefilledarc  $image$size/$size/$size1$size1,$i*$step,($i+1)*$step$white,IMG_ARC_PIE );

Anyhow you can make your own as i have also put it online

Usage ={size of image}&count={No of divisions}&size1={Inner circle size}

Examples -

Click image for larger version. 

Name:	encoder.php?size=300&count=12&d=.jpg 
Views:	704 
Size:	8.9 KB 
ID:	219

Click image for larger version. 

Name:	encoder.php?size=300&size1=200&count=24&d=.jpg 
Views:	605 
Size:	10.2 KB 
ID:	220

Hope this helps someone