EV3PHP Documentation
Functions
ev3_lcd_start
ev3_lcd_pixel
ev3_lcd_pixel_remove
ev3_lcd_clear
ev3_lcd_tiny
ev3_lcd_small
ev3_lcd_normal
ev3_lcd_big
ev3_lcd_rectangle
ev3_lcd_rectangle_filled
ev3_lcd_circle
ev3_lcd_circle_filled
ev3_lcd_ellipse
ev3_lcd_ellipse_filled
ev3_lcd_line
ev3_lcd_end
ev3_button_start
ev3_button_pressed
ev3_button_get_pressed
ev3_button_end
ev3_battery_current
ev3_battery_voltage
ev3_led_start
ev3_led_set
ev3_led_color
ev3_led_color_brightness
ev3_led_end
ev3_motor_start
ev3_motor_info
ev3_motor_run
ev3_motor_run_without_brake
ev3_motor_stop
ev3_motor_run_forever
ev3_motor_get_position
ev3_motor_set_position
ev3_motor_wait
ev3_motor_end
ev3_sensor_start
ev3_sensor_info
ev3_sensor_touch
ev3_sensor_ultrasonic
ev3_sensor_color
ev3_sensor_color_rgb
ev3_sensor_infrared_distance
ev3_sensor_infrared_pressed
ev3_sensor_end
ev3_speak
ev3_speak_background
ev3_lcd_start
ev3_lcd_start();
Starts the LCD mode
ev3_lcd_pixel
ev3_lcd_pixel(int $x, int $y);
Adds a black pixel
ev3_lcd_pixel_remove
ev3_lcd_pixel_remove(int $x, int $y);
Removes a black pixel
ev3_lcd_clear
ev3_lcd_clear();
Clears the LCD
ev3_lcd_tiny
ev3_lcd_tiny(int $x, int $y, string $text);
Write tiny $text at $x, $y
ev3_lcd_small
ev3_lcd_small(int $x, int $y, string $text);
Write small $text at $x, $y
ev3_lcd_normal
ev3_lcd_normal(int $x, int $y, string $text);
Write normal $text at $x, $y
ev3_lcd_big
ev3_lcd_big(int $x, int $y, string $text);
Write big $text at $x, $y
ev3_lcd_rectangle
ev3_lcd_rectangle(int $x, int $y, int $w, int $h);
Add rectangle at $x, $y with width $w and height $h.
ev3_lcd_rectangle_filled
ev3_lcd_rectangle_filled(int $x, int $y, int $w, int $h [, bool $black]);
Add filled rectangle at $x, $y with width $w and height $h.
If $black is false, the rectangle will be white and all black pixels inside removed.
ev3_lcd_circle
ev3_lcd_circle(int $x, int $y, int $r);
Add circle at $x, $y with radius $r. ($x, $y are the center of the circle)
ev3_lcd_circle_filled
ev3_lcd_circle_filled(int $x, int $y, int $r [, bool $black]);
Add filled circle at $x, $y with radius $r. ($x, $y are the center of the circle)
If $black is false, the circle will be white and all black pixels inside removed.
ev3_lcd_ellipse
ev3_lcd_ellipse(int $x, int $y, int $rx, int $ry);
Add ellipse at $x, $y with radius $rx and $ry. ($x, $y are the center of the ellipse)
ev3_lcd_ellipse_filled
ev3_lcd_ellipse_filled(int $x, int $y, int $rx, int $ry [, bool $black]);
Add filled ellipse at $x, $y with radius $rx and $ry. ($x, $y are the center of the ellipse)
If $black is false, the ellipse will be white and all black pixels inside removed.
ev3_lcd_line
ev3_lcd_line(int $x0, int $y0, int $x1, int $y1);
Add line with $x0, $y0 as start and $x1 and $y1 as end.
ev3_lcd_end
ev3_lcd_end();
Exits the LCD mode
ev3_button_start();
Starts the button mode
bool ev3_button_pressed(string $button_name);
Checks whether the button is pressed
Available buttons:
BUTTON_LEFT
BUTTON_RIGHT
BUTTON_UP
BUTTON_DOWN
BUTTON_CENTER
BUTTON_BACK
string|false ev3_button_get_pressed();
Get the currently pressed button (BUT ONLY ONE! USE ev3_button_pressed INSTEAD!)
Available buttons:
BUTTON_BACK
BUTTON_CENTER
BUTTON_DOWN
BUTTON_UP
BUTTON_LEFT
BUTTON_RIGHT
ev3_button_end();
Exits the button mode
ev3_battery_current
int ev3_battery_current();
Returns the current of the battery in µA
ev3_battery_voltage
int ev3_battery_voltage();
Returns the voltage of the battery in µV
ev3_led_start
ev3_led_start();
Starts the LED mode
ev3_led_set
ev3_led_set(string $led_name, string $color, int $brightness);
Changes the mode of $led_name to color: $color and brightness: $brightness
Supported LEDs:
Supported colors:
Brightness is between 0 and 255
ev3_led_color
ev3_led_color(string $color);
Changes the mode of both LEDs to color: $color
Supported colors:
ev3_led_color_brightness
ev3_led_color_brightness(string $color, int $brightness);
Changes the mode of both LEDs to color: $color
Supported colors:
ev3_led_end
ev3_led_end();
Exits the LED mode
ev3_motor_start
ev3_motor_start();
Loads all motors
ev3_motor_info
string|false ev3_motor_info(string $port);
Returns the name of a motor
$port is A, B, C or D
ev3_motor_run
bool ev3_motor_run(string $port, int $speed, int $degree);
Turns a motor around $degree degrees.
$port is A, B, C or D
$speed is 0 - 100
ev3_motor_run_without_brake
bool ev3_motor_run_without_brake(string $port, int $speed, int $degree);
Turns a motor around $degree degrees and let it roll out.
$port is A, B, C or D
$speed is 0 - 100
ev3_motor_stop
bool ev3_motor_stop(string $port);
Stops a motor
$port is A, B, C or D
ev3_motor_run_forever
bool ev3_motor_run_forever(string $port, int $speed);
Runs a motor forever.
$port is A, B, C or D
$speed is 0 - 100
ev3_motor_get_position
int|false ev3_motor_get_position(string $port);
Returns the position of the motor in degree.
$port is A, B, C or D
ev3_motor_set_position
bool ev3_motor_set_position(string $port, int $degree);
Sets the position of the motor in degree.
$port is A, B, C or D
ev3_motor_wait
bool ev3_motor_wait(string $port);
Waits until motor is not moving
$port is A, B, C or D
ev3_motor_end
ev3_motor_end();
Unload the motors
ev3_sensor_start
ev3_sensor_start();
Loads all sensors
ev3_sensor_info
string|false ev3_sensor_info(string $port);
Returns the driver/name of a sensor
$port is 1, 2, 3 or 4
ev3_sensor_touch
bool ev3_sensor_touch(string $port);
Checks whether the touch button is pressed
$port is 1, 2, 3 or 4
ev3_sensor_ultrasonic
int|false ev3_sensor_ultrasonic(string $port);
Returns the distance of the utrasonic sensor (in mm)
If return value is 0, it is assumed that there is no known value!
$port is 1, 2, 3 or 4
ev3_sensor_color
string|false ev3_sensor_color(string $port);
Returns the current measured color of the color sensor
Available colors:
COLOR_RED
COLOR_GREEN
COLOR_BLACK
COLOR_NONE
COLOR_BLUE
COLOR_YELLOW
COLOR_WHITE
COLOR_BROWN
$port is 1, 2, 3 or 4
ev3_sensor_color_rgb
string|false ev3_sensor_color_rgb(string $port);
Returns the current measured color (rgb) in format "RED,GREEN,BLUE" of the color sensor
$port is 1, 2, 3 or 4
ev3_sensor_infrared_distance
int|false ev3_sensor_infrared_distance(string $port);
Returns the distance measured by the infrared sensor in percent
$port is 1, 2, 3 or 4
ev3_sensor_infrared_pressed
bool ev3_sensor_infrared_pressed(string $port, int $channel, string $button);
Checks whether $button is pressed
$port is 1, 2, 3 or 4
$channel is 1, 2, 3 or 4 (the selected channel on the remote controller)
Available buttons:
IR_BUTTON_LEFT_UP
IR_BUTTON_LEFT_DOWN
IR_BUTTON_RIGHT_UP
IR_BUTTON_RIGHT_DOWN
The top button is NOT available because of it seems like that the sensor is stopping sending while the top button is pressed!
ev3_sensor_end
ev3_sensor_end();
Unload the sensors
ev3_speak
ev3_speak(string $lang, string $text [, int $volume, int $speed]);
Speaks a text and waits until finished.
$lang is en (English), fr (French), de (German) and similar
$volume is 0 - 200, default: 100
$speed is words per minute (80 - 450), default: 175
$text maxlength is 2500 (changable in the c constant SPEAKER_MAX_TEXT_LENGTH)
DO NOT USE " IN $text!
ev3_speak_background
ev3_speak_background(string $lang, string $text [, int $volume, int $speed]);
Speaks a text in background.
$lang is en (English), fr (French), de (German) and similar
$volume is 0 - 200, default: 100
$speed is words per minute (80 - 450), default: 175
$text maxlength is 2500 (changable in the c constant SPEAKER_MAX_TEXT_LENGTH)
DO NOT USE " IN $text!
Constants
Common
EV3PHP_VERSION
: ev3php version, e.g. 0.8
Ports
PORT_A
: A
PORT_B
: B
PORT_C
: C
PORT_D
: D
PORT_1
: 1
PORT_2
: 2
PORT_3
: 3
PORT_4
: 4
Buttons
BUTTON_LEFT
: BUTTON_LEFT
BUTTON_RIGHT
: BUTTON_RIGHT
BUTTON_UP
: BUTTON_UP
BUTTON_DOWN
: BUTTON_DOWN
BUTTON_CENTER
: BUTTON_CENTER
BUTTON_BACK
: BUTTON_BACK
Infrared-Buttons
IR_BUTTON_LEFT_UP
: IR_BUTTON_LEFT_UP
IR_BUTTON_LEFT_DOWN
: IR_BUTTON_LEFT_DOWN
IR_BUTTON_RIGHT_UP
: IR_BUTTON_RIGHT_UP
IR_BUTTON_RIGHT_DOWN
: IR_BUTTON_RIGHT_DOWN
Infrared-Channels
CHANNEL_1
: 1
CHANNEL_2
: 2
CHANNEL_3
: 3
CHANNEL_4
: 4
LEDs
LED_LEFT
: LED_LEFT
LED_RIGHT
: LED_RIGHT
Colors
COLOR_NONE
: COLOR_NONE
COLOR_RED
: COLOR_RED
COLOR_GREEN
: COLOR_GREEN
COLOR_BLACK
: COLOR_BLACK
COLOR_BLUE
: COLOR_BLUE
COLOR_YELLOW
: COLOR_YELLOW
COLOR_WHITE
: COLOR_WHITE
COLOR_BROWN
: COLOR_BROWN
LCD
LCD_X
: 178
LCD_Y
: 128
FONT_TINY_HEIGHT
: 7
FONT_TINY_WIDTH
: 5
FONT_SMALL_HEIGHT
: 8
FONT_SMALL_WIDTH
: 8
FONT_NORMAL_HEIGHT
: 9
FONT_NORMAL_WIDTH
: 8
FONT_BIG_HEIGHT
: 16
FONT_BIG_WIDTH
: 16
Speaker
LANG_EN
: en
LANG_FR
: fr
LANG_DE
: de
Copyright (C) 2022 Lukas Tautz