This function returns the x position of the object detected. You can specify the object for which the value is needed. The position is mapped with the stage coordinates.
Parameters
Name
Type
Description
Expected Values
Default Value
object
int
Object number for which the information is required.
Now we will connect the Ultrasonic Sensor to the Robot. The sensor and the robot have the following pins:
Ultrasonic Sensor Pins:
VCC
GND
Trig
Echo
Quarky Pins:
GND
V
D1
D2
We will start with connecting the ultrasonic sensor with Quarky using the 4 set wire provided in the kit. But, first, make the connection in the following way:
First, connect the VCC of the ultrasonic sensor with the V pin on the Quarky.
Connect the GND of the ultrasonic sensor with the Ground pin on the Quarky.
Connect Trig of the ultrasonic sensor with D1 pin on the Quarky.
Finally, connect the Echo of the ultrasonic sensor with the D2 pin on the Quarky.
Now we will connect the Ultrasonic Sensor to the Robot. The sensor and the robot have the following pins:
We will start with connecting the ultrasonic sensor with Quarky using the 4 set wire provided in the kit. But, first, make the connection in the following way:
First, connect the VCC of the ultrasonic sensor with the V pin on the Quarky.
Connect the GND of the ultrasonic sensor with the Ground pin on the Quarky.
Connect Trig of the ultrasonic sensor with D1 pin on the Quarky.
Finally, connect the Echo of the ultrasonic sensor with the D2 pin on the Quarky.
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()
A waste management system that will differentiate the waste based on its type. If it detects biodegradable waste, the LEDs Quarky’s matrix will turn green. If it’s non-biodegradable waste, the LEDs will turn blue.
A waste management system that will differentiate the waste based on its type in Python Coding Environment. If it detects biodegradable waste, the LEDs Quarky’s matrix will turn green. If it’s non-biodegradable waste, the LEDs will turn blue.
sprite = Sprite('Tobi')
pose = Posenet()
pose.video("on", 0)
pose.enablebox()
while True:
pose.analysecamera()
bodyPartCount = 0
for i in range(21):
if pose.isdetected(i, 1):
bodyPartCount += 1
sprite.say(str(bodyPartCount) + " Parts Detected")