pxt-calliope/docs/reference/pins.md
2016-08-17 11:18:15 -07:00

1.5 KiB

Pins

Control currents in Pins for analog/digital signals, servos, i2c, ...

pins.digitalReadPin(DigitalPin.P0);
pins.digitalWritePin(DigitalPin.P0, 0);
pins.analogReadPin(AnalogPin.P0);
pins.analogWritePin(AnalogPin.P0, 1023);
pins.analogSetPeriod(AnalogPin.P0, 20000);
pins.map(0, 0, 1023, 0, 4);
pins.onPulsed(DigitalPin.P0, PulseValue.High, () => {
    
});
pins.pulseDuration();
pins.pulseIn(DigitalPin.P0, PulseValue.High);
pins.servoWritePin(AnalogPin.P0, 180);
pins.servoSetPulse(AnalogPin.P0, 1500);
pins.i2cReadNumber(0, NumberFormat.Int8LE);
pins.i2cWriteNumber(0, 0, NumberFormat.Int8LE);
pins.spiWrite(0);
pins.setPull(DigitalPin.P0, PinPullMode.PullDown);
pins.analogPitch(0, 0);
pins.analogSetPitchPin(AnalogPin.P0);

See Also

digitalReadPin, digitalWritePin, analogReadPin, analogWritePin, analogSetPeriod, map, onPulsed, pulseDuration, pulseIn, servoWritePin, servoSetPulse, i2cReadNumber, i2cWriteNumber, setPull, analogPitch, analogSetPitchPin, spiWrite