removing tacho (#382)
This commit is contained in:
parent
f1ea113fc0
commit
8536126e23
@ -19,6 +19,5 @@ motors.stopAll()
|
||||
```cards
|
||||
motors.largeA.speed()
|
||||
motors.largeA.angle()
|
||||
motors.largeA.tacho()
|
||||
motors.largeA.clearCounts()
|
||||
```
|
@ -17,11 +17,11 @@ let tachoCount = 0;
|
||||
motors.largeA.reset()
|
||||
motors.largeA.run(50)
|
||||
pause(10000)
|
||||
tachoCount = motors.largeA.tacho()
|
||||
tachoCount = motors.largeA.angle()
|
||||
motors.largeA.clearCounts()
|
||||
motors.largeA.run(50)
|
||||
pause(10000)
|
||||
if (tachoCount == motors.largeA.tacho()) {
|
||||
if (tachoCount == motors.largeA.angle()) {
|
||||
brick.showString("Motor turns equal.", 1)
|
||||
} else {
|
||||
brick.showString("Motor turns NOT equal.", 1)
|
||||
|
@ -1,48 +0,0 @@
|
||||
# tacho
|
||||
|
||||
Get the current number of degress of rotation.
|
||||
|
||||
```sig
|
||||
motors.largeA.tacho()
|
||||
```
|
||||
|
||||
The motors that come with your @boardname@ have a way to detect their own turning motion. They count the amount of motor rotation in degrees. The motor will count each degree of angle rotation up to 360 degrees for a full rotation. As the motor continues to turn, the _tacho_ count keeps adding up the degrees even past one full rotation. So, if the motor makes 3 complete rotations, the count will be 1080.
|
||||
|
||||
The name _tacho_ comes from the first part of the word [tachometer](https://en.wikipedia.org/wiki/Tachometer) which is a device to measure how fast something is turning. The motor controller in the brick uses the tacho count to regulate the motor's speed.
|
||||
|
||||
## ~hint
|
||||
|
||||
**Measure RPM**
|
||||
|
||||
A standard way to know how fast a motor is turning is by measuring its _revolutions per minute_ (rpm). One revolution is the same thing as a rotation, or one turn. How do you measure rpm? Well, here's a simple way:
|
||||
|
||||
1. Record the current tacho count
|
||||
2. Run the motor for 60 seconds
|
||||
3. Get the tacho count again
|
||||
4. Subtract the first tacho count from the second one
|
||||
5. Divide that number by `360`
|
||||
|
||||
## ~
|
||||
|
||||
## Returns
|
||||
|
||||
* a [number](/types/number) which is the total count of degrees of rotation that the motor has turned since it was first started or reset.
|
||||
|
||||
## Example
|
||||
|
||||
Run the motor connected to port **A** at half speed for 5 seconds. Display the number of full rotations on the screen.
|
||||
|
||||
```blocks
|
||||
motors.largeA.run(50)
|
||||
pause(5000)
|
||||
motors.largeA.stop()
|
||||
brick.showString("Motor rotations:", 1)
|
||||
brick.showNumber(motors.largeA.tacho() / 360, 3)
|
||||
motors.largeA.run(50)
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[angle](/reference/motors/motor/tacho), [speed](/reference/motors/motor/speed),
|
||||
[set regulated](/reference/motors/motor/set-regulated),
|
||||
[reset](/reference/motors/motor/reset), [clear counts](/reference/motors/motor/clear-counts)
|
@ -378,21 +378,6 @@ namespace motors {
|
||||
return getMotorData(this._port).count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets motor tachometer count.
|
||||
* @param motor the port which connects to the motor
|
||||
*/
|
||||
//% blockId=motorTachoCount block="%motor|tacho"
|
||||
//% weight=69
|
||||
//% blockGap=8
|
||||
//% group="Counters"
|
||||
//% help=motors/motor/tacho
|
||||
tacho(): number {
|
||||
this.init();
|
||||
return getMotorData(this._port).tachoCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the motor count
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user