Slide Switch

Slide Switch

Slide Switch

June 2, 2017

Introduction

There are two inbuilt 3-way slide switches in evive.

Slide switch 1 is connected to Arduino pins 40 and 41, both active high. This means that when the switch is slid up, pin 40 is high. When it slides down, pin 41 is high while both are low when the switch is in the middle.

evive Slide Switch

Slide switch 2 is connected to pins 42 and 43, and behave similarly as above.

evive Notes Icon
Note that pins 40-43 are all pulled low, i.e. they will be at 0V (and not floating) when the switch is not engaged.

Slide switches are used in motor control to control the direction of the motor.

Programming in Arduino IDE

The test code for the slide switch is:

Programming in Scratch

To get the state of slide switch in Scratch, we will use Slide switch () is in state () block. This block can be found under the Robots palette in the extension evive Inbuilt tools.

This block checks takes the slide switch number (1 or 2) and state to be checked for (Up or Down) as input and returns “True” if the slide switch is in the specified state and “False” if it is not in the specified state.

This block can be used in Arduino Mode as well as in Scratch Mode.

Example

  • In this script, if the slide switch 2 is slided up (state 1), the LED on evive (connected to pin 13), glows.

Slide switch arduino mode

Share this Page
Facebook
Twitter
Google+
Pinterest
Reddit
Print
Related Tutorials
Featured Projects
Paper-Circuit
Beginner
Jennifer Christian
DIY Paper Circuit

IntroductionWho said to make a circuit you need wires, PCBs, and soldering machine and stuff? You know what, you don’t even need a breadboard! All

Explore this Project
Drip Irrigation System
Intermediate
Chetan
Drip Irrigation System

Introduction Drip irrigation system is a type of micro-irrigation of soil which has the potential to save water and nutrients by allowing water to drip slowly to the roots of

Explore this Project

Leave a Reply

Leave a Reply

Close Menu
×

Cart