Oxoscript turns into NanoPy - more infos

Classes

logValue

The logValue class consists of a timestamp (dateTime) and a sensor data value (float).
It serves as the return type of the “logRead()” function.

logData(C_TEMP)
lv = logRead(C_TEMP, 0)
lv.timeStamp.getEpoch() # => 1651765847
lv.data # => 23.251343

dateTime

The dateTime class consists of a epoch time value (long) and a millisecond value (int).
Analogous to the time functions, clock time functions such as dateTime.getHour() or dateTime.getMillis() can be applied.
It is used for example for time stamps when logging sensor values.

dt:dateTime
dt.setTime(22, 33, 44)
dt.getHour()   # => 22
dt.getMinute() # => 33
dt.getSecond() # => 44

vector

This class represents a two-dimensional Cartesian vector with the object variables x and y (floats).

The following functions are implemented:

normalize()
add(v:vector)
sub(v:vector)
addScalar(s:float)
subScalar(s:float)
mulScalar(s:float)
fromAngle(angle:float)
random()
magnitude()->float
distance(v:vector)->float
angle()->float
dot(v:vector)->float
limitToScreen(offset:float)
limit(xMin:float, xMax:float, yMin:float, yMax:float)
toString()->byte[30]

buttons

The Buttons class has a boolean variable for each button: up, down, left, right and middle.

This class has no other functions and serves only as return type of the function “getButtons()”.

Pattern:

def onDraw()
    b = getButtons()
    if b.up:
        # ...
    if b.down:
        # ...
    if b.left:
        # ...
    if b.right:
        # ...
    if b.middle:
        # ...

vector3D

This class represents a three-dimensional vector with the object variables x,y, and z (floats).

The following functions are implemented:

normalize()
add(v:vector3D)
sub(v:vector3D)
addScalar(s:float)
subScalar(s:float)
mulScalar(s:float)
fromAngle(alpha:float, theta:float)
random()
magnitude()->float
distance(v:vector3D)->float
dot(v:vector3D)->float
cross(v:vector3D)->vector3D
toString()->byte[40]