gaServoWrite(int,int)

Syntax

gaServoWrite(int,int)

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 write the specified value into the specified arduino digital servo pin. For servo pins use the 0-255 range. Do not forget to previously set the arduino pins in the GAmuza Arduino module, available in main menu, Modules/Arduino.

Parameters

int,int