AnalogPin.P0 not supported
This commit is contained in:
parent
ce24e9d923
commit
d6cc95112c
@ -5,23 +5,23 @@ Control currents in Pins for analog/digital signals, servos, i2c, ...
|
||||
```cards
|
||||
pins.digitalReadPin(DigitalPin.P0);
|
||||
pins.digitalWritePin(DigitalPin.P0, 0);
|
||||
pins.analogReadPin(AnalogPin.P0);
|
||||
pins.analogWritePin(AnalogPin.P0, 1023);
|
||||
pins.analogSetPeriod(AnalogPin.P0, 20000);
|
||||
pins.analogReadPin(AnalogPin.P1);
|
||||
pins.analogWritePin(AnalogPin.P1, 1023);
|
||||
pins.analogSetPeriod(AnalogPin.P1, 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.servoWritePin(AnalogPin.P1, 180);
|
||||
pins.servoSetPulse(AnalogPin.P1, 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);
|
||||
pins.analogSetPitchPin(AnalogPin.P1);
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
@ -4,7 +4,7 @@ Read an **analog** signal (`0` through `1023`) from the
|
||||
[pin](/device/pins) you say.
|
||||
|
||||
```sig
|
||||
pins.analogReadPin(AnalogPin.P0)
|
||||
pins.analogReadPin(AnalogPin.P1)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
@ -5,7 +5,7 @@ analog [pin](/device/pins).
|
||||
Before you call this function, you should set the specified pin as analog.
|
||||
|
||||
```sig
|
||||
pins.analogSetPeriod(AnalogPin.P0, 20000)
|
||||
pins.analogSetPeriod(AnalogPin.P1, 20000)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
@ -17,8 +17,8 @@ The following code first sets `P0` to analog with **analog write
|
||||
pin**, and then sets the PWM period of `P0` to 20,000 microseconds.
|
||||
|
||||
```blocks
|
||||
pins.analogWritePin(AnalogPin.P0, 512)
|
||||
pins.analogSetPeriod(AnalogPin.P0, 20000)
|
||||
pins.analogWritePin(AnalogPin.P1, 512)
|
||||
pins.analogSetPeriod(AnalogPin.P1, 20000)
|
||||
```
|
||||
|
||||
### See also
|
||||
|
@ -3,7 +3,7 @@
|
||||
Specify which [pin](/device/pins) (P0, P1, P2) is used to generate tones.
|
||||
|
||||
```sig
|
||||
pins.analogSetPitchPin(AnalogPin.P0)
|
||||
pins.analogSetPitchPin(AnalogPin.P1)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
@ -13,7 +13,7 @@ pins.analogSetPitchPin(AnalogPin.P0)
|
||||
### Example
|
||||
|
||||
```blocks
|
||||
pins.analogSetPitchPin(AnalogPin.P0)
|
||||
pins.analogSetPitchPin(AnalogPin.P1)
|
||||
let frequency = 440
|
||||
let duration = 1000
|
||||
pins.analogPitch(frequency, duration)
|
||||
|
@ -4,7 +4,7 @@ Write an **analog** signal (`0` through `1023`) to the
|
||||
[pin](/device/pins) you say.
|
||||
|
||||
```sig
|
||||
pins.analogWritePin(AnalogPin.P0, 400)
|
||||
pins.analogWritePin(AnalogPin.P1, 400)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
@ -17,7 +17,7 @@ pins.analogWritePin(AnalogPin.P0, 400)
|
||||
This program writes `1023` to pin `P0`.
|
||||
|
||||
```blocks
|
||||
pins.analogWritePin(AnalogPin.P0, 1023)
|
||||
pins.analogWritePin(AnalogPin.P1, 1023)
|
||||
```
|
||||
|
||||
#### ~hint
|
||||
|
@ -28,7 +28,7 @@ This example maps the value read from the analog pin `P0` to an LED
|
||||
coordinate between `0` and `4`.
|
||||
|
||||
```blocks
|
||||
let value1 = pins.analogReadPin(AnalogPin.P0)
|
||||
let value1 = pins.analogReadPin(AnalogPin.P1)
|
||||
let index = pins.map(value1, 0, 1023, 0, 4)
|
||||
led.plot(0, index)
|
||||
```
|
||||
|
@ -17,7 +17,7 @@ pins.servoSetPulse(AnalogPin.P1, 1500)
|
||||
The following code sets the servo pulse to `1000` microseconds.
|
||||
|
||||
```blocks
|
||||
pins.servoSetPulse(AnalogPin.P0, 1000)
|
||||
pins.servoSetPulse(AnalogPin.P1, 1000)
|
||||
```
|
||||
|
||||
### See also
|
||||
|
@ -9,7 +9,7 @@ full speed in one direction, `180` specifies full speed in the other,
|
||||
and approximately `90` specifies no movement.)
|
||||
|
||||
```sig
|
||||
pins.servoWritePin(AnalogPin.P0, 180)
|
||||
pins.servoWritePin(AnalogPin.P1, 180)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
@ -22,7 +22,7 @@ pins.servoWritePin(AnalogPin.P0, 180)
|
||||
#### Setting the shaft angle to midpoint on a servo
|
||||
|
||||
```blocks
|
||||
pins.servoWritePin(AnalogPin.P0, 90)
|
||||
pins.servoWritePin(AnalogPin.P1, 90)
|
||||
```
|
||||
|
||||
#### Controlling the shaft by using the tilt information of the accelerometer
|
||||
@ -32,14 +32,14 @@ basic.forever(() => {
|
||||
let millig = input.acceleration(Dimension.X)
|
||||
// map accelerometer readings to angle
|
||||
let angle = pins.map(millig, -1023, 1023, 0, 180)
|
||||
pins.servoWritePin(AnalogPin.P0, angle)
|
||||
pins.servoWritePin(AnalogPin.P1, angle)
|
||||
})
|
||||
```
|
||||
|
||||
#### Setting the full speed on a continuous servo
|
||||
|
||||
```blocks
|
||||
pins.servoWritePin(AnalogPin.P0, 0)
|
||||
pins.servoWritePin(AnalogPin.P1, 0)
|
||||
```
|
||||
|
||||
### See also
|
||||
|
Loading…
Reference in New Issue
Block a user