returnToMenu()->bool
With this function you jump back to the menu.
The return value indicates whether the user has really left the program.
if getButton():
if returnToMenu():
return
exit()
Exits the current script and returns to the menu.
restart()
Restarts the card.
setPrecision(val:byte)
Formats the decimal places when outputting float values:
f = 1.23931
setPrecision(2)
print(f) # "1.24"
setPrecision(4)
print(f) # "1.2393"
0 can also be specified. In this case, the integer value is displayed (rounded, without decimal point):
a = 1.2345
setPrecision(1)
print a # 1.2
setPrecision(0)
print a # 1
print(str:byte[])
Sends the defined string parameter to the terminal in the NanoPy editor.
print("Hello world!")
If a number or a variable is passed to the print() function, it is automatically converted to a string (respectively a byte[]):
print(123) # "123"
a = 1.23
print(a) # "1.23"
It is even possible to mix texts and numbers or variables:
v = vector(x=5,y=10)
print("x = " + v.x + "; y = " + v.y) # "x = 5.0; y = 10.0"
setAutostart()
If the autostart function has been enabled, the Oxocard will switch directly to the startup program when it is restarted (after connecting to the Internet).
setAutostart(true)
setAutostart(false)
turnOff()
Turns off the oxocard.
sleep(sec:long)
Turns off the Oxocard and restarts it after x seconds.
isConnected()->bool
Returns true if the card is connected to the Internet.
ipAddress()->byte[16]
Returns the current IP address as a string (byte array).
If the card is not connected to the Internet, “0.0.0.0” is returned.
ipAddress() # => "192.168.42.164"
backlight(value:float)
Switches the background light of the TFT display on (value=1) or off (value=0).
With values between 0 and 1 (e.g. 0.1) the TFT display can also be dimmed.
Note: Since the human eye does not perceive light linearly (but logarithmically), you will only notice a striking difference at smaller values.
background(0, 255, 0)
drawText(60, 80, "Test123")
update()
for i in 20:
backlight(1.0 - 0.05*i)
delay(500)
runScript(path:byte[])
Starts a previously downloaded script or a script saved as a file.
The current script is terminated and replaced with the new script.
If the script does not exist, a “file not found” runtime error is issued.
Downloaded scripts are placed in the “user_scripts” folder. The file name corresponds to the name in the editor, e.g. “My downloaded script” plus “.npy” file ending.
runScript("user_scripts/My downloaded script.npy")
File example:
if fileExists("hello.npy"):
deleteFile("hello.npy")
open(C_WRITE, "hello.npy")
code = "drawText(35, 10, \"Hello World!\")\nupdate()"
i = 0
ch = code[i]
while ch != 0:
writeByte(ch)
i++
ch = code[i]
close()
runScript("hello.npy")
textInput(title:byte[], text:byte[])->byte[120]
Opens a text input field and returns the entered text as soon as the OK icon is selected and confirmed.
str = textInput("Test", "123")
print(str)
getHardwareType()->byte
Returns the type of the currently used oxocard.
C_HW_GALAXY = 0
C_HW_ARTWORK = 1
C_HW_SCIENCE = 2
C_HW_SCIENCE_PLUS = 3
C_HW_CONNECT = 4
getLanguage()->byte
Returns the currently set system language.
Available languages:
C_LANGUAGE_EN
C_LANGUAGE_DE
C_LANGUAGE_FR
setLanguage(lang:byte)
Sets the system language of the device.
Available languages:
C_LANGUAGE_EN
C_LANGUAGE_DE
C_LANGUAGE_FR
isCartridgeConnected()
Only Oxocard Connect
Returns true if a cartridge is connected, false otherwise
isCartridgeEmpty()
Only Oxocard Connect
Returns true if the connected cartridge has no script flashed on the memory, false if a script is set.
pauseCartridgeDetection()
Only Oxocard Connect
Pause the auto detection of cartridges. If the cartridge detection is disabled, the auto start script will not start.
resumeCartridgeDetection()
Only Oxocard Connect
Resume the detection if a cartridge is connected. If the detection is enabled, the auto start script will run if one is set on the cartridge
getSystemTime()
Returns the time in micro seconds since system start. This function is useful to measure the time passed between two measurements.
t1 = getSystemTime()
# some code
t2 = getSystemTime()
delta = t2 - t1
wifiPause()
The function interrupts the WiFi communication until wifiResume() is called.
Caution: after the call, the connection to the server is interrupted. It is therefore no longer possible to transfer scripts.
wifiResume()
The function re-establishes the wifi connection after it has been interrupted with wifiPause().
The new storeDisplay() and resumeDisplay() functions can be used to temporarily save the current screen content. storeDisplay() saves the current status. The content is transferred back to the screen memory with resumeDisplay().
This function can be used to create an overlay menu, for example, without having to redraw the background again and again.
The new storeDisplay() and resumeDisplay() functions can be used to temporarily save the current screen content. storeDisplay() saves the current status. The content is transferred back to the screen memory with resumeDisplay().
This function can be used to create an overlay menu, for example, without having to redraw the background again and again.