Project

General

Profile

What PWM frequency » testpattern.ls

peteruithoven, 2013-03-13 02:35

 
var space = 1;
var rectangleWidth = 3;
var rectangleHeight = 3;
var numX = 5;
var numY = 5;
var startPower = 1;
var endPower = 100;
var startSpeed = 100;
var endSpeed = 1;

var powerStep = (endPower-startPower)/(numX-1);
var speedStep = (endSpeed-startSpeed)/(numY-1);

for (var i = 0; i < numX; i++)
{
var power = startPower+i*powerStep;
set("power", power);
for (var j = 0; j < numY; j++)
{
var speed = startSpeed+j*speedStep;
set("speed", speed);
var x = (rectangleWidth+space)*i;
var y = (rectangleHeight+space)*j;
rectangle(x, y, rectangleWidth, rectangleHeight);
}
}

function rectangle(x, y, width, height)
{
move(x, y);
line(x+width, y);
line(x+width, y+height);
line(x, y+height);
line(x, y);
}
(2-2/2)