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 PictoBlox

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

This block 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.

slide switch is in state

This block can be used in Upload Mode as well as in Stage 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 example 2

Share this Documentation
Share on facebook
Facebook
Share on twitter
Twitter
Share on pinterest
Pinterest
Share on reddit
Reddit
Share on print
Print
Related Tutorials & Projects
What is a DC Motor

What is a Dual-Shaft (DC) Motor?

Learn what is dual-shaft(DC) motor, how does DC motor work, interface it with evive using PictoBlox and what projects to make using a DC motor.
slide switch is in state

slide switch () is in the state ()?

The block check 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.

How to use evive’s Slide Switch

This tutorial discusses different types of switches based on their pole and throw, what are slide switches, and a simple Arduino IDE sketch to display the state of evive's slide switch on the TFT screen.

Interfacing Relay with evive

This tutorial explains interfacing of a relay module with evive for controlling high power circuits like AC bulb with help of evive.
Featured Projects

Leave a Reply