Function |
Action |
forward() |
sets robot in forward motion |
delay(ms) |
stops program for ms milliseconds |
backward() |
sets robot in reverse motiong |
left() |
sets robot in a left turn (one motor in forward, the other in backward rotation) |
right() |
sets robot in a right turn (one motor in forward, the other in backward rotation) |
leftArc(radius) |
sets robot to a left curve with given radius (in m) |
rightArc(radius) |
sets robot to a right curve with given radius (in m) |
stop() |
stops the movement |
setSpeed() |
sets the speed for all movements (10...100), default 50 |
setLED(n) |
n = 1: turns both LEDs on, n = 0: turns both LEDs off
|
setAlarm(n) |
n = 1: sets the alarm on, n = 0: sets the alarm off |
getDistance() |
returns the distance (in cm, in range 2..200 approx.) measured with the ultrasonic sensor (255: illegal measurement)) |
motL.rotate(speed) |
rotatate motor left (speed > 0: forwad, speed < 0: backward, speed= 0: stop) (speed -255 - 255) |
motR.rotate(speed) |
rotatate motor rightt (speed > 0: forwad, speed < 0: backward, speed= 0: stop) (speed -255 - 255) |
setLEDLeft(n)
setLEDRight(n)) |
turns LED on (n = 1) or off (n = 0) |
setServo(port, angle) |
rotates the servo motor at port S1 or S2 to the given angular position.(angle: 0 to 180) |
playTone(freq., duration |
plays the sound at the given frequency for the given time |
set_pixel(x, y, value) |
sets the intensity of pixel at position x, y. value in range 0..9 |
get_pixel(x, y) |
returns the intensity of the pixel at position x, y |
clear() |
clears all pixels |
on()/off() |
switches the display on/off. When switched off, the following pins are also available as I/O: pin4, pin6, pin7, pin9 |
show(str) |
shows given str on LED display. If str has more than 1 character, the text ist scrolled until the last character becomes visible |
show(img) |
shows given str on LED display. If str has more than 1 character, the text ist scrolled until the last character becomes visible |
show(list_of_img, delay = 400, loop = False, wait = True, clear = False) |
shows all images of the list in a timed sequence. If loop = True ist, the sequence is repeated infinitely. For wati = True the method is blocking, otherwise it returns while the sequence continues in the background. delay is the display time for each image in ms (default: 400). For clear = True, the display is clear after the last image is shown |
scroll(str) |
shows str as scrolling text. The last character disappears |
scroll(str, delay = 150, loop = False, wait = True, monospace = False) |
show str as scrolling text . If loop = True, the sequence is repeated infinitely. For wait = True the method is blocking, otherwise it returns while the sequence continues in the background. delay is the display time for a single column (default: 150) |
set_pixel(x, y, value) |
sets the intensity of pixel at position x, y. value in range 0..9 |
fill(value) |
sets all pixel intensities to the given value (0..9) |
get_pixel(x, y) |
returns the intensity of the pixel at position x, y |
shift_left(n) |
returns an Image object by shifting the picture left by n columns (inserted columns at the right are turned off) |
shift_right(n) |
returns an Image object by shifting the picture right by n columns (inserted columns at the left are turned off) |
shift_up(n) |
returns an Image object by shifting the picture up by n rows (inserted rows at the bottom are turned off) |
shift_down(n) |
returns an Image object by shifting the picture down by n rows (inserted rows at the top are turned off) |
copy() |
returns a clone of the image |
invert() |
returns an Image object by inverting the intensity of all pixels (new_value = 9 - value) |
get_x(), get_y(), get_z() |
returns the current value of acceleration in x, y or z direction (int, range approx.. -2047 to +2048, corresponding approx. -20 m/s^2 to +20 m/s^2, gravitational acceleration of approx. 10 m/s^2 included). x direction: ButtonA-ButtonB; y direction: Pin2-USB; z direction: perpenticular to the board |
get_values() |
returns a tuple with the acceleration in x, y and z direction (ints, units as above) |
current_gesture() |
returns the current gesture. The following gestures are detected: " up", " down", " left", " right", " face up", " face down", " freefall", " 3g", " 6g", " 8g", " shake" |
makeGlow() |
creates a visible glowbug at position (0, 0) directed to the north with its trace enabled. Coordinate system: -2 <=x <=2 (+ to the right), -2 <= y <= 2 (+ upwards), (0, 0) at center pixel |
forward() |
moves the glowbug one step in the forward direction |
back() |
moves the glowbug one step in the backward direction |
left(angle) |
turns the glowbug in 45 degrees increments to the left (angle = 45, 90, 135, 180, 215, 270, 315) |
right(angle) |
turns the glowbug in 45 degrees increments to the right (angle = 45, 90, 135, 180, 215, 270, 315) |
setSpeed() |
sets the speed for movements (0..100) |
show() |
makes the glowbug visible at the current position and for the next movements |
hide() |
makes the glowbug invisible for the next movements |
clear() |
clears all visible pixels. The glowbug remains at the current position (but is invisible) |
showTrace(False/True) |
enables/disables the trace for the following movements (pixels are turned on at the glowbug position) |
setPos(x, y) |
sets the glowbug at position (x, y) |
getPos() |
returns the current position of the glowbug (as tuple) |
isLit() |
returns True, if the pixel at the current glowbug position is turned on |