Skip to main content

Octopus Libraries Explanations

Functions DefinitionNameMethods NameParameterReturn Value
Setting the LEDs on and offLEDset_led(value:1)value: Parameter type: int Default parameter: 0 Parameter range: 0\1No
Set LED brightness, brightness range (0~100), 0 means completely extinguished 100 means maximum brightnessset_led_bright(brightness:100)brightness: Parameter type: int Default parameter: 0 Parameter range: 0~100No
Control the speed of the motor fanFanset_fan(speed:100)speed: Parameter type: int Default parameter: 100 Parameter range: 0~100No
Set the angel of the 180° servoServoset_servo(angle:90)angle: parameter type: int default parameter: 90 parameter range: 0~180No
Obtain ultrasonic sensor detection distance in cmSonarget_distance()NoDistance value from ultrasonic sensor to obstacle
Get the light intensity value in lux detected by the light sensorLightget_lightlevel()NoLight intensity values
Get the temperature value detected by the temperature and humidity sensor in (°C)DHT11get_temperature()NoReturn temperature value
Get the humidity value detected by the temperature and humidity sensor in (RH)DHT11get_humidity()NoReturn humidity value
Obtain water level sensor detection value in mmWaterlevelget_waterlevel()NoReturn water level value
Get the decibel value of the noise sensor in dBNoiseget_noise()NoReturn noise value
Get trimpot sensor valuesTrimpotget_trimpot()NoReturn trimpot sensor value
Light up the OLED display at the specified coordinate pixel pointOLEDset_pixel(x:63, y:31)x:
Parameter type: int
Default parameter: 63
Parameter range: 0~127
y:
Parameter type: int
Default parameter: 31
Parameter range: 0~63
No
Draw a line with specified start and end coordinates on the OLED displayOLEDdraw_line(x1:0, y1:0, x2:127, y2:63)x1:
Parameter type: int
Default parameter: 0
Parameter range: 0~127
y1:
Parameter type: int
Default parameter: 0
Parameter range: 0~63
x2:
Parameter type: int
Default parameter: 127
Parameter range: 0~127
y2:
Parameter type: int
Default parameter: 63
Parameter range: 0~63
No
Draw a circle with a specified centre and radius on the OLED display and decide whether to fill it or not depending on the parameters, 0 for no fill, 1 for fillOLEDdraw_circle(x:10, y:10, r:10, d:0)x:
Parameter type: int
Default parameter: 10
Parameter range: 0~127
y:
Parameter type: int
Default parameter: 10
Parameter range: 0~63
r:
Parameter type: int
Default parameter: 10
Parameter range: 0~64
d:
Parameter type: int
Default parameter: :0
Parameter range: 0\1
Draws a rectangle on the OLED display with specified upper left corner coordinates, width and length values and decides whether to fill it or not according to the parameters, 0 for no fill, 1 for fillOLEDdraw_rectangle(x:32, y:16, w:64, h:16, d:0)x:
Parameter type: int
Default parameter: 32
Parameter range:0~127
y:
Parameter type: int
Default parameter: 16
Parameter range: 0~63
w:
Parameter type: int
Default parameter: 64
Parameter range: 0~127
h:
Parameter type: int
Default parameter: 16
Parameter range: 0~63
d:
Parameter type: int
Default parameter: 0
Parameter range: 0\1
Display of input string/number/character on OLED displayOLEDset_show(s:"ELECFREAKS")s:
Parameter type: str
Default parameter: "ELECFREAKS"
Parameter range: Characters covered by the Unicode encoding table
Clear OLED displaysOLEDset_clear()No