Program:
Void setup()
{
// initialize digital pin LED_BUILTIN as an output.
pinMode (4, OUTPUT);
pinMode (5, OUTPUT);
pinMode (6, OUTPUT);
pinMode (7, OUTPUT);
// the loop function runs over and over again forever
void loop()
{
Digital Write (4, HIGH);
Digital Write (5, LOW);
Digital Write (6, HIGH);
Digital Write (7, LOW);// turn the LED on (HIGH is the voltage level)
Delay (1000); // wait for a second
digitalWrite(4, LOW);
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
digitalWrite(7, HIGH);// turn the LED off by making the voltage LOW
delay(1000); // wait for a second
Program:
#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 4, 5, 6, 7);
const int sensor=A2; // Assigning analog pin A1 to variable 'sensor'
float tempc; //variable to store temperature in degree Celsius
float tempf; //variable to store temperature in Fahreinheit
float vout; //temporary variable to hold sensor reading
void setup()
{
pinMode(sensor,INPUT); // Configuring pin A1 as input
[Link](9600);
[Link](16,2);
delay(500);
}
void loop()
{
vout=analogRead(sensor);
vout=(vout*500)/1023;
tempc=vout; // Storing value in Degree Celsius
tempf=(vout*1.8)+32; // Converting to Fahrenheit
[Link](0,0);
[Link]("in DegreeC= ");
[Link](tempc);
[Link](0,1);
[Link]("in Fahrenheit=");
[Link](tempf);
delay(1000); //Delay of 1 second for ease of viewing in serial monitor
}
Program:
const int ProxSensor=A0;
int inputVal = 0;
void setup()
{
pinMode(5, OUTPUT); // Pin 13 has an LED connected on most Arduino boards:
pinMode(ProxSensor,INPUT); //Pin A0 is connected to the output of proximity sensor
[Link](9600);
}
void loop()
{
if(digitalRead(ProxSensor)==HIGH) //Check the sensor output
{
digitalWrite(5, HIGH); // set the LED on
}
else
{
digitalWrite(5, LOW); // set the LED off
}
inputVal = analogRead(ProxSensor);
[Link](inputVal);
delay(1000); // wait for a second
}
Program:
// constants won't change. They're used here to
// set pin numbers:
const int button = 8; // the number of the pushbutton pin
const int relay = 10; // the number of the relay pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton1 status
void setup() {
pinMode(relay, OUTPUT); // initialize the relay pin as an output:
pinMode(button, INPUT_PULLUP); // initialize the pushbutton pin as an input:
void loop() {
// read the state of the pushbutton value:
Button State = digital Read(button);
// check if the pushbutton is pressed.
// if it is, the button State is LOW:
if (button State == LOW)
{
// pin 2 is pressed and connected to GND so it will be LOW
digital Write(relay, LOW);
// remove 5v from pin 11 so relay in1 will be 0v and this make relay on
delay (1000); // wait 1 second
}
else
{
Digital Write(relay, HIGH); // add 5v to arduino pin 11 so relay in1 will be 5v
and this make relay off
}
}
Program:
//Sensor Board Connections
//VCC -> +5V
//GND -> GND
//AO -> A0
#include <LiquidCrystal.h> // includes the LiquidCrystal Library
LiquidCrystal lcd(12, 11, 4, 5, 6, 7); // Creates an LCD object. Parameters: (rs, enable, d4, d5,
d6, d7)
#define sensorPin A0
void setup()
{
[Link](9600);
[Link](16, 2); // Initializes the interface to the LCD screen, and specifies the dimensions
(width and height) of the display
// wait until serial port opens for native USB devices
while (! Serial)
{
delay(1);
}
[Link]("Soil Moisture test");
}
// This function returns the analog data for moisture
int readSensor()
{
int sensorValue = analogRead(sensorPin); // Read the analog value from sensor
int outputValue = map(sensorValue, 0, 1023, 100, 0); // map the 10-bit data to %
[Link](0, 0); // Sets the location at which subsequent text written to the LCD will be
displayed
[Link]("Moisture:"); // Prints string on the LCD
[Link](outputValue); // Prints the value from the sensor
[Link]("% ");
return outputValue; // Return analog moisture value
}
void loop()
{
[Link]("Moisture: ");
[Link](readSensor());
delay(500);
}
Program:
#include <PulseSensorPlayground.h>
const int ProxSensor=A0;
int inputVal = 0;
void setup()
{
pinMode(5, OUTPUT); // Pin 13 has an LED connected on most Arduino boards:
pinMode(ProxSensor,INPUT); //Pin A0 is connected to the output of proximity sensor
[Link](9600);
}
void loop()
{
if(digitalRead(ProxSensor)==HIGH) //Check the sensor output
{
digitalWrite(5, HIGH); // set the LED on
}
else
{
digitalWrite(5, LOW); // set the LED off
}
inputVal = analogRead(ProxSensor);
[Link](inputVal);
delay(1000); // wait for a second
}