Posts

Showing posts from November, 2017

Analog input Analog output of arduino

Image
analogWrite() Arduino uno has 8 bit DAC Actually analog output of Arduino is PWM. On most Arduino boards (those with the ATmega168 or ATmega328P), this function works on pins 3, 5, 6, 9, 10, and 11. On the Arduino Mega, it works on pins 2 - 13 and 44 - 46. Older Arduino boards with an ATmega8 only support analogWrite()   on pins 9, 10, and 11. Syntax analogWrite(pin, value) Example Code Sets the output to the LED proportional to the value read from the potentiometer.(Note:-make correction analog pin=A3 ). int ledPin = 9 ; // LED connected to digital pin 9 int analogPin = 3 ; // potentiometer connected to analog pin 3 int val = 0 ; // variable to store the read value void setup () { pinMode (ledPin, OUTPUT ); // sets the pin as output } void loop () { val = analogRead (analogPin); // read the input pin analogWrite (ledPin, val / 4 ); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255 }

Analog input and Serial Output(See output on serial monitor)

Arduino uno has 10 bit ADC(Analog to Digital converter).(Gives 0 to 1023 values as output.) Reads the value from the specified analog pin. The Arduino board contains a 6 channel (8 channels on the Mini and Nano, 16 on the Mega).  Resolution can be calculated as maximum 10 bit value divide by input voltage (example. for 5 volts input resolution will be [5volts/1024 units] i.e .0049volts/unit.). NOTE:-The input range and resolution can be changed using   analogReference() . Syntax:- analogRead(pin); Returns int(0 to 1023)       Example Code The code reads the voltage on analog Pin and displays it. int analogPin = 3 ; // potentiometer wiper (middle terminal) connected to analog pin 3 // outside leads to ground and +5V int val = 0 ; // variable to store the value read void setup () { Serial . begin ( 9600 ); // setup serial } void loop () { val = analogRead (analogPin); // read the input pin

LED BLINKING

Image
Follow this video for circuit diagram  COMPONENTS LIST:           1. Arduino uno board 2. LED 3. Resistor 100 ohm 4. Connection cables . LED: ARDUINO CODE: void setup () {   pinMode (13  OUTPUT ); } void loop () {   digitalWrite (13, HIGH );   // turn the LED on (HIGH is the voltage level)   delay(1000);                       // wait for a second   digitalWrite (13, LOW );    // turn the LED off by making the voltage LOW   delay(1000);                       // wait for a second }

T3_3:-How to simulate Arduino on Proteus.

Image

ARDUINO BOARD INFORMAION

Image
SPECIFICATION OF ARDUINO USO BOARD: MCU: ATMega 328 SIX ANALOG INPUT PINS /ADC                  (A0,A1,A2,A3,A4,A5). 14 DIGITAL GPIO'S                                         (0 TO 13) SIX ANALOG OUTPUT PINS/DAC /PWM   (3,5,6,9,10,11). ONE SPI PORT                                                 (13=SCK,12=MISO,11=MOSI). ONE UART PORT                                            (0=RxD,1=TxD) ONE I2C PORT                                                 (A4=SDA,A5=SDL)  FOR MORE DETAILS OF ARDUINO UNO BOARD CLICK ON IMAGE GIVEN BELOW  THERE ARE NUMBER OF BOARDS OF ARDUINO  1.ARDUINO MEGA 2.ARDUINO UNO 3.ARDUINO MICRO 4.ARDUINO NANO 5.ARDUINO PRO MICRO 6.ARDUINO PRO MINI AND MUCH MORES WE WILL SEE LATER ON ONCE YOU GET FAMILIAR WITH ARDUINO

Basic of Arduino...RGB led interfacing with Arduino(practical use of fading).

Basic of Arduino..Analog Output of Arduino(how to use DAC pins of Arduino).

Basic of Arduino..Interfacing Push Button to Arduino

Image
Circuit Diagram Components list: Program: Output:                                              1.Resisters (1k and 100ohm)                  2.LED                  3.Push button                  4.Arduino uno board //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////          int buttonState = 0;         // variable for reading the pushbutton status           void setup ()           {              pinMod e(13, OUTPUT );// initialize the LED pin as an output:          pinMode (2, INPUT );// initialize the pushbutton pin as an input:          }         void loop ()         {            buttonState = digitalRead (buttonPin);// read the state of the pushbutton value:            if (buttonState == LOW )                   {                        digitalWrite (13, HIGH );// turn LED on:                  }          else