The function is used to open a camera for video capture.
We are using OpenCV. OpenCV is a vast library that helps in providing various functions for image and video operations. With OpenCV, we can capture a video from the camera. It lets you create a video capture object which is helpful to capture videos through a webcam and then you may perform desired operations on that video.
Parameters
Name
Type
Description
Expected Values
Default Value
camera_id
int
id of the video capturing device to open. To open default camera using default backend just pass 0.
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")