Sensing
Extension Description
Sensing blocks are associate with sprites and stage detecting conditions.
- Available in: Block Coding, Python Coding
- Mode: Stage Mode
- WiFi Required: No
- Compatible Hardware in Block Coding: evive, Quarky, Arduino Uno, Arduino Mega, Arduino Nano, ESP32, T-Watch, Boffin, micro:bit, TECbits, LEGO EV3, LEGO Boost, LEGO WeDo 2.0, Go DFA, None
- Compatible Hardware in Python: evive, Quarky, Arduino Uno, Arduino Mega, Arduino Nano, ESP32, T-Watch, Boffin, micro:bit, TECbits, LEGO EV3, LEGO Boost, LEGO WeDo 2.0, Go DFA, None
- Object Declaration in Python: sprite = Sprite("Sprite-Name")
- Extension Catergory: Default
Introduction
Sensing is one of the ten categories of default Scratch blocks. They are color-coded cyan and are used to detect different factors of a project.
Read More
PictoBlox Blocks
All articles loaded
No more articles to load
Block Coding Examples
All articles loaded
No more articles to load
Python Functions
The function checks if its sprite is touching the mouse-pointer, edge, or another sprite. If the sprite is touching the selected object, the block returns true; if it is not, it returns false.
Syntax: istouching(object_name = “_edge_”)
The function reports the Euclidean distance, in pixels, between it and the mouse-pointer or a specified sprite’s costume center.
Syntax: distance(object_name = “_edge_”)
The function will make an input box (with the specified text above it) show at the bottom of the screen. Users can input text into it and submit it, and the input is stored then in the Answer. The Answer automatic updates to the most recent input.
Syntax: input(question = “What is your name”)
The function returns the most recent text imputed with the input() function. When nothing has been inputted yet, the value will hold nothing.
Syntax: answer()
The function checks if the specified key is pressed. If the key is being pressed, the block returns “true”; if it is not, it returns “false”.
Syntax: iskeypressed(key = “space”)
The function reports the mouse pointer’s current X position on the stage.
Syntax: mousex()
The function reports the mouse pointer’s current y position on the stage.
Syntax: mousey()
The function reports how loud the noise that a microphone receives, on a scale of 0 to 100.
Syntax: loudness()
The function reports the time lapsed since the PictoBlox is launched and increases gradually; every second it will have increased by 1.
Syntax: timer()
The function sets the timer’s value back to 0.
Syntax: resettimer()
The function reports the number of days (and fractions of a day) since 00:00:00 1 January 2000 (UTC).
Syntax: dayssince2000()
All articles loaded
No more articles to load
Python Coding Examples
All articles loaded
No more articles to load
Table of Contents