CPUFan : CPU fan control

更新时间:
2024-05-13
下载文档

CPUFan : CPU fan control

This module is used to control the CPU cooling fan.

User can use the following code to import the CPUFan module.

var CPUFan = require('cpufan');

Support

The following shows CPUFan module APIs available for each permissions.

 User ModePrivilege Mode
CPUFan 
CPUFan.exists 
cpufan.close 
cpufan.value 

CPUFan Class

new CPUFan()

  • Returns: {Object} A new CPU fan object.

Create a cpufan object.

CPUFan.exists()

  • Returns: {Boolean} Whether there is an CPU fan device.

Whether there is an CPU fan device, if there is no new operation will throw an exception.

Example

if (CPUFan.exists()) {
  var cpufan = new CPUFan();
}

CPUFan Object

cpufan.close()

Close CPU fan object.

cpufan.value

  • {Integer} Current CPU fan work level.

Get or Set CPU fan current work level, 0 is fan off. 1 is the lowest speed, 100 is the highest speed.

The fan speed can be adjusted according to the CPU temperature, for example, the PID algorithm can be used for fan speed control.

cpufan.value is a setter and getter function.

Example

if (cpufan.value === 0) { // If the fan is off
  cpufan.value = 50; // Set fan speed to 50
}
文档内容是否对您有所帮助?
有帮助
没帮助