Table of Contents

read analog pin ()

Description

The block reads the analog value of the sensors connected to the specified pin. The block returns the int value between 0 to 4096.

Example

Learn about the fundamental working principle of a potentiometer and its versatile applications as a variable resistor or voltage divider

Potentiometer and It’s working

A potentiometer is a crucial three-terminal resistor featuring a sliding or rotating contact that forms an adjustable voltage divider. When using only two terminals (one end and the wiper), it functions as a variable resistor or rheostat. The potentiometer’s three pins consist of two connected to the resistive element (blue and green) and one connected to the adjustable wiper (black). The potentiometer can serve as a rheostat to vary resistance or as a voltage divider. The position of the wiper determines the amount of resistance imposed on the circuit, as demonstrated in the figure below.

Circuit Diagram

Code

  1. From the event palette add when flag clicked event.
  2.  Add forever loop 
  3.  From looks palette add say block.
  4. Now add read analog pin A0 in this say block.

Script

Output

Read More
All articles loaded
No more articles to load