كل يوم أقوم بنشر معلومة مفيدة أو فكرة جديدة أو نشاط جديد أو ابتكار . ستجد معلومات عن القراءة والكتابة والابتكارات والرياضة والطبيعة والزراعة وكل ماهو مفيد وجديد . ستجد معلومات عن طائرات الكوادكوبتر ومكوناتها وأحدث التقنيات الجديدة فى هذا المجال. This is my outlet to the world. Here I put new post everyday.

tank offer

Monday, March 12, 2018

Digital Input for Arduino

What is Arduino Digital Input?



Digital input to Arduino is the simplest and most direct form of input. 

The digital pin can be either High or Low. Which can mean in logic Zero or One.

This input can be the state of push button, input voltage in binary form or you may use analog input to Arduino digital inputs as a way of quantization.





In real life you can use it to sense the logic state of a button (ON/OFF Switch or Push Button) to check its position.






You can also use it to sense the presence of voltage as an input to Arduino form another circuit.


Use of relays can be considered as a digital input to Arduino.



From Arduino Website:



digitalRead()

[Digital I/O]

Description

Reads the value from a specified digital pin, either HIGH or LOW.

Syntax

digitalRead(pin)

Parameters

pin: the number of the digital pin you want to read

Returns

HIGH or LOW

Example Code

Sets pin 13 to the same value as pin 7, declared as an input.
int ledPin = 13;   // LED connected to digital pin 13
int inPin = 7;     // pushbutton connected to digital pin 7
int val = 0;       // variable to store the read value

void setup()
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin 13 as output
  pinMode(inPin, INPUT);        // sets the digital pin 7 as input
}

void loop()
{
  val = digitalRead(inPin);     // read the input pin
  digitalWrite(ledPin, val);    // sets the LED to the button's value
}



 


Paid Online Surveys
Check our books on Amazon we created on our way to find happiness.
A Trip To Siwa Oasis: Tourist guide to an Egyptian Oasis by [ElSakhawy, Sara M.]

A Trip To Siwa Oasis

The Ultimate travel bag list by [ Elskhawy, Sara M.]

No comments:

Post a Comment