Table of Contents

Function Definition: ispadtouched(touch_pin = 1)

Parameters

NameTypeDescriptionExpected ValuesDefault Value
touch_pinintThe specific touch pad.1, 2, 3, 4, or 51

Description

The function returns the state of the specified touch sensor of Quarky. If the touch pad is touched it will return True, else False.

Example

The example demonstrates using the Quarky touch display to make a touch piano in the Python Coding Mode.

Code

sprite = Sprite('Tobi')
quarky = Quarky()

while True:
  if quarky.ispadtouched("T1"):
    quarky.drawpattern("bbbjjbjjbjjbbjjbjjjbjjbjjjbjjbjjbbb")
    quarky.playtone("C4", 8)

  if quarky.ispadtouched("T2"):
    quarky.drawpattern("cccjcccjcjjjjcjcjjcccjcjjcjjjcjjccc")
    quarky.playtone("D4", 8)

  if quarky.ispadtouched("T3"):
    quarky.drawpattern("fffjfffjfjjjjfjfjjfffjfjjjjfjfjjfff")
    quarky.playtone("E4", 8)

  if quarky.ispadtouched("T4"):
    quarky.drawpattern("dddjdjdjdjjdjdjdjjdddjdjjjjdjdjjjjd")
    quarky.playtone("F4", 8)

  if quarky.ispadtouched("T5"):
    quarky.drawpattern("gggjgggjgjjgjjjgjjgggjgjjjjgjgjjggg")
    quarky.playtone("G4", 8)

Output

Read More
The example demonstrates how to run different actions with the Quarky touch sensor to make a disco party in Python Coding Environment.

Code

sprite = Sprite('Cassy Dance')
quarky = Quarky()

import time

sprite.switchcostume('cassy-a')
sprite.gotoxy(0, 0)

while True:
  if quarky.ispadtouched("T1"):
    quarky.playsound("QuarkyIntro")

  if quarky.ispadtouched("T2"):
    quarky.showpattern("party colors")

  if quarky.ispadtouched("T3"):
    time.sleep(0.2)
    sprite.nextcostume()

  if quarky.ispadtouched("T4"):
    quarky.stopaudio()

Output

Read More
All articles loaded
No more articles to load