Difference between revisions of "Touch (use with mDesigner)"
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | The Touch sensor (also | + | The Touch sensor (also known as Touch button) is a sensor which is able to detect if it is pressed or not pressed based on capacitance [https://en.wikipedia.org/wiki/Capacitive_sensing (read more)]. Although It can serve similar functions to the [[Crash_(use_with_mDesigner)|Crash switch]] which is a mechanical switch. The Touch sensor can only be triggered by things with capacitance, such as a finger. The state of the Touch sensor can be detected and can be used to trigger events or conditions in scripts. Support for this sensor is found in mDesigner. |
=Compatible Pins= | =Compatible Pins= | ||
The following pins on the '''Hub''' or '''mCenter+'s Hub''' support this module: | The following pins on the '''Hub''' or '''mCenter+'s Hub''' support this module: | ||
Line 99: | Line 99: | ||
<br style="clear: left;" /> | <br style="clear: left;" /> | ||
</div> | </div> | ||
+ | |||
+ | =Blocks= | ||
+ | ==Digital Read Pin== | ||
+ | This block reads the state of the pin. In Arduino, this is known as a digital read (digitalRead). A value of either 0 or 1 will be returned. | ||
+ | *When Touch sensor is '''NOT PRESSED''', '''1''' is returned. | ||
+ | *When Touch sensor is '''PRESSED''', '''0''' is returned. | ||
+ | ::[[File:MDesigner_Digital_Read.png]] | ||
+ | :*'''Pin Number''' - the pin number to read from. | ||
+ | |||
+ | ==Pin Is== | ||
+ | This block reads the state of the pin, then compares it to the configured state. | ||
+ | *If the state of the pin '''DOES MATCH''' the configured state, then this block returns '''true''' | ||
+ | *If the state of the pin '''DOES NOT MATCH''' the configured state, then this block returns '''false''' | ||
+ | ::[[File:MDesigner_Pin_Is.png]] | ||
+ | :*'''Pin Number''' - the pin number to read from. | ||
+ | :*'''State''' - state to match in order for this block to return '''true'''. | ||
+ | ::*'''HIGH''' tests if the Crash switch is '''NOT PRESSED'''. | ||
+ | ::*'''LOW''' tests if the Crash switch is '''PRESSED'''. |
Latest revision as of 00:30, 9 October 2018
The Touch sensor (also known as Touch button) is a sensor which is able to detect if it is pressed or not pressed based on capacitance (read more). Although It can serve similar functions to the Crash switch which is a mechanical switch. The Touch sensor can only be triggered by things with capacitance, such as a finger. The state of the Touch sensor can be detected and can be used to trigger events or conditions in scripts. Support for this sensor is found in mDesigner.
Compatible Pins
The following pins on the Hub or mCenter+'s Hub support this module:
Pin Name | Compatibility | Notes |
---|---|---|
Pin 0 | Yes | Not recommended, Pin 0 & 1 used by mDesigner (serial communication). |
Pin 1 | Yes | Not recommended, Pin 0 & 1 used by mDesigner (serial communication). |
Pin 2 | Yes | |
Pin 3 | Yes | |
Pin 4 | Yes | |
Pin 5 | Yes | |
Pin 6 | Yes | |
Pin 7 | Yes | |
Pin 8 | Yes | |
Pin 9 | Yes | |
Pin 10 | Yes | |
Pin 11 | Yes | |
Pin 12 | Yes | |
Pin 13 | Yes | |
Pin A0 | Yes | |
Pin A1 | Yes | |
Pin A2 | Yes | |
Pin A3 | Yes | |
Pin A6 | Yes | |
Pin A7 | Yes | |
Pin I2C | No |
Blocks
Digital Read Pin
This block reads the state of the pin. In Arduino, this is known as a digital read (digitalRead). A value of either 0 or 1 will be returned.
- When Touch sensor is NOT PRESSED, 1 is returned.
- When Touch sensor is PRESSED, 0 is returned.
Pin Is
This block reads the state of the pin, then compares it to the configured state.
- If the state of the pin DOES MATCH the configured state, then this block returns true
- If the state of the pin DOES NOT MATCH the configured state, then this block returns false