introduction:
A switch is an essential electrical component that can disconnect or connect the conducting path in an electrical circuit, effectively interrupting or diverting the electric current. It plays a critical role in ON-OFF control for various applications across industries such as telecommunications, industrial control equipment, commercial devices, and home appliances.
Applications
The primary application of switches is to enable the ON-OFF control of circuits. They are widely used in industries including:
- Telecommunication: Switches play a key role in telecommunication equipment, allowing users to turn devices ON or OFF.
- Industry Control Equipment: Industrial machinery and equipment often rely on switches for circuit control and operation.
- Commercial Equipment: Switches are used in various commercial devices to facilitate user control and energy-saving features.
- Home Appliances: Household appliances such as fans, lights, and kitchen appliances utilize switches for convenient operation.
Circuit Diagram
Code
- Add the “when flag clicked” event from the event palette.
- Use the “go to x() y()” block from the motion palette and set the coordinates to 0,0..
- Introduce the “forever” block from the control palette.
- From control palette select if -else condition, use block read the state of digital pin 6 of Arduino.
- Add the “if – else” condition block from the control palette to read the state of digital pin 6 of Arduino.
- If the button is pressed (state of digital pin 6 is high), make Tobi jump by changing y() by 40 steps, If the button is not pressed (state of digital pin 6 is low), make Tobi jump back to the original position by using the “go to x() y()” block and setting the coordinates to 0,0.
- Insert this section of code inside the “forever” block and merge all the parts.
Script
Output