char. Color of text. 1: black text. 0: wihteteext with black background. .... LED color canno
Commands for EV3-API Initialization: command #include InitEV3(); FreeEV3();
explanation including Header Initialization of all EV3-Functions Closing of all EV3-Functions
Display: command bool LcdClean(); LcdPrintf(,,…);
explanation Erase Display Working like printf()
Help: parameter type char
explanation Color of text
Pointer to text
char*
value 1: black text 0: wihteteext with black background e.g. “Hello EV3“
Break: command void Wait();
explanation Break code for a given time
Help: parameter type explanation unsigned time in ms long possible to use the given macros or type directly the value
©Simón Rodriguez Perez, 2016
value MS_1…10 :1 10…100 :10 50…500 :50 100…900 :100 SEC_1…10 :1 5…20 :5 30 MIN_1
Inputs (Sensoren): Commands: command int setAllSensorMode(, ,,); int readSensor(); int setIRBeaconCH(, );
explanation Allocate of the sensor types of all 4 ports in the correct order (IN_1, IN_2, IN_3, IN_4) Readout of the actual sensor data Set Channel of the Beacon for Readout (default: Ch. 1 )
Help: parameter
type int char int
explanation Input-Ports Name und Mode of the connected Sensors Channel of the Beacon. Needed for: IR_SEEK and IR_REMOTE
value IN_1, IN_2, IN_3, IN_4 See next table BEACON_CH_1, BEACON_CH_2, BEACON_CH_3, BEACON_CH_4
Sensor type: Sensor No Sensor
NO_SEN
Touch sensor
TOUCH_PRESS
Light sensor
COL_REFLECT COL_AMBIENT COL_COLOR
Sonar sensor Gyroscope EV3 Infrared
US_DIST_MM GYRO_ANG GYRO_RATE IR_PROX IR_SEEK IR_REMOTE
©Simón Rodriguez Perez, 2016
explanation No sensor to the port connected Return of state (2 states possible) Return of the reflected light intensities in % Return of room light intensities in % Return of color
Return of distance in mm Return of angle in ° Return of gear rate in °/s Return of distance in % (up to 70cm) Position of the Beacon Controlling EV3 with Beacon
return value -1 Not pressed: 0 pressed: 1 0 to 100 0 to 100 0: transparent 1: black 2: blue 3: green 4: yellow 5: red 6: white 7: brown 0 to 2550 -180 to 180 -440 to 440 0 (Near) to 100 (Far) -25 to 25 BEACON_OFF BEACON_UP_LEFT BEACON_DOWN_LEFT BEACON_UP_RIGHT BEACON_DOWN_RIGHT BEACON_UP BEACON_DIAG_UP_LEFT
NXT Infrared NXT Temperature
NXT_IR_SEEKER NXT_TEMP_C Temperature in °C NXT_TEMP_F Temperature in °F
BEACON_DIAG_UP_RIGHT BEACON_DOWN BEACON_ON BEACON_LEFT BEACON_RIGHT 1 to 9 -55 to 128 -67 to 262
Outputs (Motoren): Controlling: command void OnFwdReg(, ); void OnRevReg(, ); void OnFwdSync(, ); void OnRevSync(, ); void Off(); void RotateMotor(, , );
explanation Forwards/backwards with given speed synchronized forwards/backwards with given speed (only working with two motors) Switch off motors Rotate with given speed for a defined angle (Code stops till the angle is reached)
Reading out: command int MotorRotationCount(); void ResetRotationCount(); char MotorPower();
explanation Rotation angle of the motors in ° Reset of rotation angle Actual motor speed
Help: parameter type int
explanation Output-ports
speed angle in °
char int
©Simón Rodriguez Perez, 2016
value OUT_A, OUT_B, OUT_C, OUT_D, OUT_AB, OUT_AC, OUT_AD, OUT_BC, OUT_BD, OUT_CD, OUT_ABC, OUT_BCD, OUT_ABCD, OUT_ALL 0 to 100
Buttons und LED: Functions for LED: command void SetLedPattern(); void SetLedWarning ();
explanation Changing color of LED behind buttons Activate/deactivate of warning. LED color cannot be changed while warning is set.
Functions for buttons: command word ButtonWaitForAnyPress(); bool ButtonIsUp(); bool ButtonIsDown(); void ButtonWaitForPress(); void ButtonWaitForPressAndRelease();
explanation Waiting for button press for given time Check if button is pressed or not (1: true, 0: false) Waiting till a specific button is pressed Waiting till a specific button is pressed and released
Help: parameter type byte
explanation Color and modus of LED
value
bool
Activate or deactivate
uint byte
time in ms Name of button
0: deactivate 1: activate 0: for endless waiting BTNEXIT, BTNRIGHT, BTNLEFT, BTNCENTER, BTNUP, BTNDOWN
©Simón Rodriguez Perez, 2016
LED_BLACK LED_GREEN LED_RED LED_ORANGE LED_GREEN_FLASH LED_RED_FLASH LED_ORANGE_FLASH LED_GREEN_PULSE LED_RED_PULSE LED_ORANGE_PULSE
(0) (1) (2) (3) (4) (5) (6) (7) (8) (9)
Sounds: Commands: command void PlayTone(, ); void PlayTones(); void PlaySound(); int SoundState(); void StopSound(); bool SoundTest(); void MuteSound (); void UnmuteSound (); void ClearSound ();
explanation Play one tone for a defined time Play multiple tones Play a system sound Returns the current Stop any playing sounds Returns TRUE when a Sound can be played Mute sounds (No sound can be played) Unmute sounds Synonym for StopSound()
Help: parameter
type explanation unsigned Frequency of tone short Defined: Second to seventh octave Example: All Tones of second octave
value
unsigned Time in ms or with defines short
NOTE_WHOLE, NOTE_HALF, NOTE_QUARTER, NOTE_EIGHT, NOTE_SIXTEEN Example: Tone a[2] = { {TONE_C4, NOTE_HALF}, {TONE_F6, NOTE_EIGHT} }; SOUND_CLICK, SOUND_DOUBLE_BEEP, SOUND_DOWN, SOUND_UP, SOUND_LOW_BEEP, SOUND_FAST_UP SOUND_STATE_IDLE, SOUND_STATE_SETUP_FILE, SOUND_STATE_FILE, SOUND_STATE_FILE_LOOPING, SOUND_STATE_TONE, SOUND_STATE_TONE_LOOPING SOUND_STATE_STOP
Tone
Array of the structure Tone Tone: &
byte
Names of system sounds
int
States of the sound module
©Simón Rodriguez Perez, 2016
TONE_C2, TONE_CS2, TONE_D2, TONE_DS2, TONE_E2, TONE_F2, TONE_FS2, TONE_G2, TONE_GS2, TONE_A2, TONE_AS2, TONE_B2