gaSetServoPin(int,bool)

Syntax

gaSetServoPin(int,bool)

Example

servoPin = 9
servoValue = 0

function setup()
    // activate pin 9 as servo pin
    gaSetServoPin(servoPin,true)
end

function update()
    gaServoWrite(servoPin,servoValue)
end

function draw()
    gaBackground(0.0,1.0)

    ofSetColor(255)
    ofCircle(servoValue/255*OUTPUT_W,OUTPUT_H/2,50)

end

function keyPressed()
    if gaKey() == string.byte('r') then
        servoValue = math.floor(ofRandom(255))
    end
end

Description

This function activate/deactivate the specified arduino pin as a servo motor control pin. Be sure to choose an arduino pin prepared to work as servo pin, for example in the Arduino ONE board you'll have digital pin 9 and 10 available as a servo pin.

Parameters

int,bool