2016-04-05 22:23:42 +02:00
|
|
|
# Pins
|
|
|
|
|
2016-05-05 20:16:14 +02:00
|
|
|
Control currents in Pins for analog/digital signals, servos, i2c, ...
|
2016-04-05 22:23:42 +02:00
|
|
|
|
|
|
|
```cards
|
2016-04-05 22:54:48 +02:00
|
|
|
pins.digitalReadPin(DigitalPin.P0);
|
|
|
|
pins.digitalWritePin(DigitalPin.P0, 0);
|
2019-12-02 05:58:26 +01:00
|
|
|
pins.analogReadPin(AnalogPin.P0);
|
|
|
|
pins.analogWritePin(AnalogPin.P0, 1023);
|
|
|
|
pins.analogSetPeriod(AnalogPin.P0, 20000);
|
2016-05-27 17:55:40 +02:00
|
|
|
pins.map(0, 0, 1023, 0, 4);
|
2016-05-17 07:18:58 +02:00
|
|
|
pins.onPulsed(DigitalPin.P0, PulseValue.High, () => {
|
|
|
|
|
|
|
|
});
|
|
|
|
pins.pulseDuration();
|
2016-08-17 20:18:15 +02:00
|
|
|
pins.pulseIn(DigitalPin.P0, PulseValue.High);
|
2019-12-02 05:58:26 +01:00
|
|
|
pins.setPull(DigitalPin.P0, PinPullMode.PullDown);
|
|
|
|
pins.analogPitch(0, 0);
|
|
|
|
pins.analogSetPitchPin(AnalogPin.P0);
|
|
|
|
```
|
|
|
|
|
|
|
|
## Servos
|
|
|
|
|
|
|
|
```cards
|
|
|
|
pins.servoWritePin(AnalogPin.P0, 180);
|
|
|
|
pins.servoSetPulse(AnalogPin.P0, 1500);
|
|
|
|
```
|
|
|
|
|
|
|
|
## I2C
|
|
|
|
|
|
|
|
```cards
|
2016-05-17 07:18:58 +02:00
|
|
|
pins.i2cReadNumber(0, NumberFormat.Int8LE);
|
|
|
|
pins.i2cWriteNumber(0, 0, NumberFormat.Int8LE);
|
2019-12-02 05:58:26 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
## SPI
|
|
|
|
|
|
|
|
```cards
|
2016-08-11 08:26:58 +02:00
|
|
|
pins.spiWrite(0);
|
2019-12-02 05:58:26 +01:00
|
|
|
pins.spiFrequency(1000000);
|
|
|
|
pins.spiFormat(8,3);
|
|
|
|
pins.spiPins(DigitalPin.P0, DigitalPin.P1, DigitalPin.P2);
|
2016-04-05 22:23:42 +02:00
|
|
|
```
|
2016-08-08 22:08:15 +02:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## See Also
|
2016-08-08 22:08:15 +02:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
[digitalReadPin](/reference/pins/digital-read-pin), [digitalWritePin](/reference/pins/digital-write-pin), [analogReadPin](/reference/pins/analog-read-pin), [analogWritePin](/reference/pins/analog-write-pin), [analogSetPeriod](/reference/pins/analog-set-period), [map](/reference/pins/map), [onPulsed](/reference/pins/on-pulsed), [pulseDuration](/reference/pins/pulse-duration), [pulseIn](/reference/pins/pulse-in), [servoWritePin](/reference/pins/servo-write-pin), [servoSetPulse](/reference/pins/servo-set-pulse), [i2cReadNumber](/reference/pins/i2c-read-number), [i2cWriteNumber](/reference/pins/i2c-write-number), [setPull](/reference/pins/set-pull), [analogPitch](/reference/pins/analog-pitch), [analogSetPitchPin](/reference/pins/analog-set-pitch-pin), [spiWrite](/reference/pins/spi-write),
|
|
|
|
[spiPins](/reference/pins/spi-pins),[spiFormat](/reference/pins/spi-format),[spiFrequency](/reference/pins/spi-frequency)
|