Movatterモバイル変換


[0]ホーム

URL:


Arduino Programming Basic

This document provides an overview of Arduino programming concepts including:- Microcontrollers contain a CPU, memory, input/output pins and other peripherals on a single integrated circuit. - Arduino is an open-source electronics platform with a microcontroller, pins to connect circuits, and software to program it.- The core Arduino functions include setup(), loop(), pinMode(), digitalWrite(), digitalRead(), analogWrite(), analogRead(), and delay().- Examples demonstrate blinking LEDs, reading input, using conditions and loops, arrays, LCD displays, and controlling servo motors.- Arduino programming provides an accessible way to learn embedded systems and interact with circuits.

Embed presentation

Downloaded 26 times
Arduino Programming ForESDBy Md.Dedarul Hasan
Arduino Programming Basic❖ Introduction❖ Programming Concept❖ Digital And Analog Input Receive❖ Use Of Condition❖ Use Of Loop❖ Use Of Array❖ LCD Display Simulation With Arduino❖ Servo Motor Simulation With Arduino❖ Extra Work❖ Conclusions
IntroductionMicrocontrollerA microcontroller can be considered a self-contained system with a processor, memoryand peripherals and can be used as an embedded system.The majority of microcontrollersin use today are embedded in other machinery, such as automobiles, telephones,appliances, and peripherals for computer systems.Microcontrollers are designed forembedded applications, in contrast to the microprocessors used in personal computers orother general purpose applications consisting of various discrete chips.Microcontroller Configuration of Arduino: ATmega328P (used on most recent boards)-Digital I/OPins 14 (of which 6 provide PWM output), Analog Input Pins 6 (DIP) or 8 (SMD), DC Current per I/O Pin40 mA, Flash Memory-32 KB, SRAM -2 KB, EEPROM-1KB
A microcontroller is a single integrated circuit, commonly with the following features:❖ central processing unit – ranging from small and simple 4-bit processors to complex 32-bit or 64-bit processors❖ volatile memory (RAM) for data storage❖ ROM, EPROM, EEPROM or Flash memory for program and operating parameter storage❖ discrete input and output bits, allowing control or detection of the logic state of anindividual package pin❖ serial input/output such as serial ports (UARTs)❖ other serial communications interfaces like I²C, Serial Peripheral Interface and ControllerArea Network for system interconnect❖ peripherals such as timers, event counters, PWM generators, and watchdog❖ clock generator – often an oscillator for a quartz timing crystal, resonator or RC circuit❖ many include analog-to-digital converters, some include digital-to-analog converters❖ in-circuit programming and in-circuit debugging support
MicroprocessorMicroprocessor has only a CPU inside them in one or few Integrated Circuits. Likemicrocontrollers it does not have RAM, ROM and other peripherals. They are dependent onexternal circuits of peripherals to work. But microprocessors are not made for specific task but theyare required where tasks are complex and tricky like development of software’s, games and otherapplications that require high memory and where input and output are not defined. It may be calledheart of a computer system.Parts of CPU-❖ ALU❖ REGISTER❖ COUNTER❖ FLAG❖ BUS❖ PROGRAM COUNTER
What is Arduino?Arduino refers to an open-source electronics platform or board and the software used to program forembedded system. Arduino is designed to make electronics more accessible to artists, designers,hobbyists and anyone interested in creating interactive objects or environments.Component Of Arduino :❖ Microcontroller-ATmega328P❖ Power (USB / Barrel Jack)❖ Pins (5V, 3.3V, GND, Analog, Digital, PWM, AREF)❖ Reset Button.❖ Power LED Indicator.❖ TX RX LEDs.❖ Voltage Regulator.
Different type of Arduino :❖ Arduino Uno❖ Arduino Due❖ Arduino Mega❖ Arduino Leonardo❖ LilyPad❖ Nano❖ Mini❖ Mini Pro❖ BTAdvantages & Disadvantages of Arduino :❖ Not much knowledge required to get started.❖ Fairly low cost, depending on shields you need.❖ Lots of sketches and shields available.❖ No external programmer or power supply needed.
Description of Arduino PORT or PINS :
Description of Arduino PORT or PINS :❖ Analog Reference pin (orange)❖ Digital Ground (light green)❖ Digital Pins 2-13 (green)❖ Digital Pins 0-1/Serial In/Out - TX/RX (dark green) - These pins cannot be used for digital i/o(digitalRead and digitalWrite) if you are also using serial communication (e.g. Serial.begin).❖ Reset Button - S1 (dark blue)❖ In-circuit Serial Programmer (blue-green)❖ Analog In Pins 0-5 (light blue)❖ Power and Ground Pins (power: orange, grounds: light orange)❖ External Power Supply In (9-12VDC) - X1 (pink)❖ Toggles External Power and USB Power (place jumper on two pins closest to desired supply) -SV1 (purple)❖ USB (used for uploading sketches to the board and for serial communication between the boardand the computer; can be used to power the board) (yellow)
Basic Programming ConceptArduino uses its own programming language, which is similar to C++. However, it'spossible to use Arduino with Python or another high-level programming language like C,Java. In fact, platforms like Arduino work well with Python, especially for applicationsthat require integration with sensors and other physical devices
Useful Functions For Arduino:
Void setup() Function :Void setup is technically a function that you create at the top of each program. Inside the curly brackets is thecode that you want to run one time as soon as the program starts running. You set things like pinMode in thissection. The loop is another function that Arduino uses as a part of its structure.Declaration :Void setup() {//write code here}Void Loop() Function :This is where the bulk of your Arduino sketch is executed. The program starts directly after the opening curlybracket ( } ), runs until it sees the closing curly bracket ( } ), and jumps back up to the first line in loop() andstarts all over.Declaration :Void loop(){//write code here}
pinMode() Function :The pinMode() function is used to configure a specific pin to behave either as an input or an output. It ispossible to enable the internal pull-up resistors with the mode INPUT_PULLUP. Additionally, the INPUT modeexplicitly disables the internal pull-ups.Declarations :pinMode(pin-number, OUTPUT); // pin as outputpinMode(pin-number, INPUT); //pin as inputdigitalWrite() Function :Write a HIGH or a LOW value to a digital pin. If the pin has been configured as an OUTPUT with pinMode() ,its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH , 0V (ground) forLOW.Declaration :digitalWrite(pin number, HIGH); //set the pin as highdigitalWrite(pin number, LOW); //set the pin as low
digitalRead () Function :This function use to read the value from a specified digital pin, either HIGH or LOW. Syntax: digitalRead(pin)Where, pin: the number of the digital pin you want to read (int).Declaration :digitalRead (pin-number) ; //pin value should be HIGH/LOW as outputanalogWrite () Function :The analogWrite Arduino command is used to update the status of analog pins and also used to address thePWM pins on the board. The PWM pins are 8-bit pins, terming that you can set the duty cycle somewherebetween 0 -255.Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varyingbrightnesses or drive a motor at various speeds.Declaration :analogWrite(pin number, 0); // set low analog valueanalogWrite(pin number, 255); //set high analog value
analogRead() Function :Reads the value from the specified analog pin. The Arduino board contains a 6 channel (8 channels on theMini and Nano, 16 on the Mega), 10-bit analog to digital converter. This means that it will map input voltagesbetween 0 and 5 volts into integer values between 0 and 1023.Declaration :analogRead(pin Number); //it returns high or lowdelay() Function :The way the delay() function works is pretty simple. It accepts a single integer (or number) argument. Thisnumber represents the time (measured in milliseconds). The program should wait until moving on to the nextline of code when it encounters this function.Declaration :delay(1000); //delay for 1000ms
Tools & Installations :To write code we will use arduino development tools by installing it ;-https://www.arduino.cc/en/main/softwareWe can also use Tinkarcad.com online autodesk software to code & simulations for arduino both.-https://www.tinkercad.com/dashboard?type=circuits&collection=designs
LED blink Program With Arduino :
LED blinks With Contrast :
Multiple LED Blinks :
Digital And Analog Input ReceiveDigital Input Receive :
Analog Input Receive :
Analog Input Delay :
Use Of Conditioncondition : each time through the loop, condition is tested; if it's true , the statement block,and the increment is executed, then the condition is tested again. When the conditionbecomes false , the loop ends. increment : executed each time through the loop whencondition is true .If ...else condition, boolean condition etc
LED Blink Using Condition :
Condition With Analog Value :
Multiple LED Blink Without Loop :
Use Of LoopMultiple LED Blink Using For Loop :
Multiple LED Blink Using For Loop :
Use Of ArrayArray :An array is a consecutive group of memory locations that are of the same type. To refer toa particular location or element in the array, we specify the name of the array and theposition number of the particular element in the array.All of the methods below are valid ways to create (declare) an array. int myInts[6]; intmyPins[] = {2, 4, 8, 3, 6}; int mySensVals[6] = {2, 4, -8, 3, 2}; char message[6] = "hello";You can declare an array without initializing it as in myInts. In myPins we declare an arraywithout explicitly choosing a size.
LED Blink Using Array :
LCD Display Simulation With Arduino
LCD Display Using Arduino :
Servo Motor Simulation With ArduinoA servomotor is a rotary actuator or linear actuator that allows for precise control ofangular or linear position, velocity and acceleration. It consists of a suitable motor coupledto a sensor for position feedback.
Servo Motor 90 Degree Rotation :
Servo Motor 180 Rotation :
Extra Work : LED Blink Using Push Button
Conclusions :As a beginner with arduino i am pleased to learn using Tinkarcad.com.Wishing that ,thefeedback by practice i’ll be able to be an expert with that embedded system design.Next, Ishall go for expert and advanced level using arduino.
Thanks

Recommended

PPS
What is Arduino ?
PPT
Arduino Platform with C programming.
PDF
Introduction to Arduino Programming
PPTX
Car Black Box
PPT
Arduino
PPSX
CPLD xc9500
PPTX
Humidity & Temperature monitoring using arduino
PPTX
Embedded systems
PPTX
Basics of arduino uno
PPTX
Arduino course
PPTX
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
PPTX
PPT ON Arduino
PPTX
Introduction to arduino ppt main
PDF
Arduino Workshop Day 1 - Basic Arduino
 
PDF
Introducing the Arduino
PPTX
Introduction to Arduino Hardware and Programming
PPTX
Introduction to arduino
PPTX
UNIT 3 - General Purpose Processors
PPTX
2. block diagram and components of embedded system
PPTX
Chapter 8 Embedded Hardware Design and Development (third portion)
PPTX
Introduction to Arduino
PPTX
Architecture of 16C6X
PPTX
Chapter 4 Embedded System: Application and Domain Specific
PPTX
Simple Presentation On Raspberry pi
PPTX
Raspberry Pi (Introduction)
PDF
01 Node-RED Basic
PPTX
Embedded system design process
PPTX
PDF
Syed IoT - module 5
PDF
Introduction of Arduino Uno

More Related Content

PPS
What is Arduino ?
PPT
Arduino Platform with C programming.
PDF
Introduction to Arduino Programming
PPTX
Car Black Box
PPT
Arduino
PPSX
CPLD xc9500
PPTX
Humidity & Temperature monitoring using arduino
PPTX
Embedded systems
What is Arduino ?
Arduino Platform with C programming.
Introduction to Arduino Programming
Car Black Box
Arduino
CPLD xc9500
Humidity & Temperature monitoring using arduino
Embedded systems

What's hot

PPTX
Basics of arduino uno
PPTX
Arduino course
PPTX
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
PPTX
PPT ON Arduino
PPTX
Introduction to arduino ppt main
PDF
Arduino Workshop Day 1 - Basic Arduino
 
PDF
Introducing the Arduino
PPTX
Introduction to Arduino Hardware and Programming
PPTX
Introduction to arduino
PPTX
UNIT 3 - General Purpose Processors
PPTX
2. block diagram and components of embedded system
PPTX
Chapter 8 Embedded Hardware Design and Development (third portion)
PPTX
Introduction to Arduino
PPTX
Architecture of 16C6X
PPTX
Chapter 4 Embedded System: Application and Domain Specific
PPTX
Simple Presentation On Raspberry pi
PPTX
Raspberry Pi (Introduction)
PDF
01 Node-RED Basic
PPTX
Embedded system design process
PPTX
Basics of arduino uno
Arduino course
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
PPT ON Arduino
Introduction to arduino ppt main
Arduino Workshop Day 1 - Basic Arduino
 
Introducing the Arduino
Introduction to Arduino Hardware and Programming
Introduction to arduino
UNIT 3 - General Purpose Processors
2. block diagram and components of embedded system
Chapter 8 Embedded Hardware Design and Development (third portion)
Introduction to Arduino
Architecture of 16C6X
Chapter 4 Embedded System: Application and Domain Specific
Simple Presentation On Raspberry pi
Raspberry Pi (Introduction)
01 Node-RED Basic
Embedded system design process

Similar to Arduino Programming Basic

PDF
Syed IoT - module 5
PDF
Introduction of Arduino Uno
PPTX
Introduction to the Arduino
PPTX
PPTX
Ardui no
PPTX
IOT-UNIT 3.pptxaaaasasasasasasaasasasasas
PDF
Arduino-workshop.computer engineering.pdf
PPT
Arduino_CSE ece ppt for working and principal of arduino.ppt
PDF
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
PPTX
INTODUCTION OF IOT AND INTERFACING WITH ARDUINO UNO
PPT
01 Intro to the Arduino and it's basics.ppt
PPTX
Arduino programming
PPTX
Introduction To Arduino-converted for s.pptx
 
PPTX
Arduino Foundations
PDF
introductiontoarduino-111120102058-phpapp02.pdf
DOCX
Arduino and Circuits.docx
PDF
arduinocourse-180308074529 (1).pdf
PPTX
Arduino cic3
PPTX
Micro_Controllers_lab1_Intro_to_Arduino.pptx
 
PPT
13223971.ppt
Syed IoT - module 5
Introduction of Arduino Uno
Introduction to the Arduino
Ardui no
IOT-UNIT 3.pptxaaaasasasasasasaasasasasas
Arduino-workshop.computer engineering.pdf
Arduino_CSE ece ppt for working and principal of arduino.ppt
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
INTODUCTION OF IOT AND INTERFACING WITH ARDUINO UNO
01 Intro to the Arduino and it's basics.ppt
Arduino programming
Introduction To Arduino-converted for s.pptx
 
Arduino Foundations
introductiontoarduino-111120102058-phpapp02.pdf
Arduino and Circuits.docx
arduinocourse-180308074529 (1).pdf
Arduino cic3
Micro_Controllers_lab1_Intro_to_Arduino.pptx
 
13223971.ppt

More from LITS IT Ltd,LASRC.SPACE,SAWDAGOR BD,FREELANCE BD,iREV,BD LAW ACADEMY,SMART AVI,HEA,HFSAC LTD.

PDF
Programming Your Home Automate with Arduino, Android, and Your Computer.pdf
PDF
The Bangladesh Legal Practitioner_s and Bar Council Order, 1972.pdf
PDF
ভূমি সংশ্লিষ্ট অপরাধ প্রতিকার ও প্রতিরোধ ৩৬ নং আইন, ২০২৩,
PDF
লালমনিরহাট ৩ আসনের ওয়ার্ড সমূহ - LALMONIRHAT 3 WARD LIST ALL
DOCX
বিবিসি রুলেস ও অরডার, ১৯৭২ বেয়ার এক্ট -BBC BARE ACT.docx
DOCX
BANGLADESH INLAND WATER TRANSPORT DEVELOPMENT RESEARCH.docx
PDF
লালমনিরহাট ৩ আসনের ভোট কেন্দ্র সমুহ - LALMONIRHAT 3 SADAR VOTE CENTER ALL
Programming Your Home Automate with Arduino, Android, and Your Computer.pdf
The Bangladesh Legal Practitioner_s and Bar Council Order, 1972.pdf
ভূমি সংশ্লিষ্ট অপরাধ প্রতিকার ও প্রতিরোধ ৩৬ নং আইন, ২০২৩,
লালমনিরহাট ৩ আসনের ওয়ার্ড সমূহ - LALMONIRHAT 3 WARD LIST ALL
বিবিসি রুলেস ও অরডার, ১৯৭২ বেয়ার এক্ট -BBC BARE ACT.docx
BANGLADESH INLAND WATER TRANSPORT DEVELOPMENT RESEARCH.docx
লালমনিরহাট ৩ আসনের ভোট কেন্দ্র সমুহ - LALMONIRHAT 3 SADAR VOTE CENTER ALL

Recently uploaded

PPTX
Presentation on Purdue model for control hierarchy
PPTX
firewall Selection in production life pptx
PDF
Human computer Interface ppt aUNIT 3.pdf
PDF
Advanced Intrusion Detection and Classification using Transfer Learning with ...
PPTX
Introduction Blockchains and Smart Contracts
PPTX
Assessment 4 SRS Presentation - Final (2).pptx
PPTX
Power point presentation on introduction of software engineering
PPTX
Vertical turbine pump explains installed in power plants
PPTX
ISO 14224 Compliance & CMMS Software — A Comprehensive Guide for Reliable Mai...
PPTX
TPM Metrics & Measurement: Drive Performance Excellence with TPM | MaintWiz
PPTX
Shutdown Maintenance Explained — Full Plant Turnaround & Best Practices with ...
PPTX
The Importance of Maintenance Budgets — Maximize Reliability & Control Costs ...
PPTX
Takt Time vs Cycle Time vs Lead Time.pptx
PPTX
Preventive Maintenance Program for Compressors – Complete Guide
PPTX
MODULE 1-UNIT_1.pptx MODULE 1-UNIT_1.pptx MODULE 1-UNIT_1.pptx
PPTX
Data Science with R Final yrUnit II.pptx
PPTX
How to Implement Kaizen in Your Organization for Continuous Improvement Success
PDF
TechSprint: Innovate for Impact Hackathon
PPTX
علي نفط.pptx هندسة النفط هندسة النفط والغاز
PPTX
Role of In Vitro and In Vivo Testing biomedical engineering
Presentation on Purdue model for control hierarchy
firewall Selection in production life pptx
Human computer Interface ppt aUNIT 3.pdf
Advanced Intrusion Detection and Classification using Transfer Learning with ...
Introduction Blockchains and Smart Contracts
Assessment 4 SRS Presentation - Final (2).pptx
Power point presentation on introduction of software engineering
Vertical turbine pump explains installed in power plants
ISO 14224 Compliance & CMMS Software — A Comprehensive Guide for Reliable Mai...
TPM Metrics & Measurement: Drive Performance Excellence with TPM | MaintWiz
Shutdown Maintenance Explained — Full Plant Turnaround & Best Practices with ...
The Importance of Maintenance Budgets — Maximize Reliability & Control Costs ...
Takt Time vs Cycle Time vs Lead Time.pptx
Preventive Maintenance Program for Compressors – Complete Guide
MODULE 1-UNIT_1.pptx MODULE 1-UNIT_1.pptx MODULE 1-UNIT_1.pptx
Data Science with R Final yrUnit II.pptx
How to Implement Kaizen in Your Organization for Continuous Improvement Success
TechSprint: Innovate for Impact Hackathon
علي نفط.pptx هندسة النفط هندسة النفط والغاز
Role of In Vitro and In Vivo Testing biomedical engineering

Arduino Programming Basic

  • 1.
  • 2.
    Arduino Programming Basic❖Introduction❖ Programming Concept❖ Digital And Analog Input Receive❖ Use Of Condition❖ Use Of Loop❖ Use Of Array❖ LCD Display Simulation With Arduino❖ Servo Motor Simulation With Arduino❖ Extra Work❖ Conclusions
  • 3.
    IntroductionMicrocontrollerA microcontroller canbe considered a self-contained system with a processor, memoryand peripherals and can be used as an embedded system.The majority of microcontrollersin use today are embedded in other machinery, such as automobiles, telephones,appliances, and peripherals for computer systems.Microcontrollers are designed forembedded applications, in contrast to the microprocessors used in personal computers orother general purpose applications consisting of various discrete chips.Microcontroller Configuration of Arduino: ATmega328P (used on most recent boards)-Digital I/OPins 14 (of which 6 provide PWM output), Analog Input Pins 6 (DIP) or 8 (SMD), DC Current per I/O Pin40 mA, Flash Memory-32 KB, SRAM -2 KB, EEPROM-1KB
  • 4.
    A microcontroller isa single integrated circuit, commonly with the following features:❖ central processing unit – ranging from small and simple 4-bit processors to complex 32-bit or 64-bit processors❖ volatile memory (RAM) for data storage❖ ROM, EPROM, EEPROM or Flash memory for program and operating parameter storage❖ discrete input and output bits, allowing control or detection of the logic state of anindividual package pin❖ serial input/output such as serial ports (UARTs)❖ other serial communications interfaces like I²C, Serial Peripheral Interface and ControllerArea Network for system interconnect❖ peripherals such as timers, event counters, PWM generators, and watchdog❖ clock generator – often an oscillator for a quartz timing crystal, resonator or RC circuit❖ many include analog-to-digital converters, some include digital-to-analog converters❖ in-circuit programming and in-circuit debugging support
  • 5.
    MicroprocessorMicroprocessor has onlya CPU inside them in one or few Integrated Circuits. Likemicrocontrollers it does not have RAM, ROM and other peripherals. They are dependent onexternal circuits of peripherals to work. But microprocessors are not made for specific task but theyare required where tasks are complex and tricky like development of software’s, games and otherapplications that require high memory and where input and output are not defined. It may be calledheart of a computer system.Parts of CPU-❖ ALU❖ REGISTER❖ COUNTER❖ FLAG❖ BUS❖ PROGRAM COUNTER
  • 6.
    What is Arduino?Arduinorefers to an open-source electronics platform or board and the software used to program forembedded system. Arduino is designed to make electronics more accessible to artists, designers,hobbyists and anyone interested in creating interactive objects or environments.Component Of Arduino :❖ Microcontroller-ATmega328P❖ Power (USB / Barrel Jack)❖ Pins (5V, 3.3V, GND, Analog, Digital, PWM, AREF)❖ Reset Button.❖ Power LED Indicator.❖ TX RX LEDs.❖ Voltage Regulator.
  • 7.
    Different type ofArduino :❖ Arduino Uno❖ Arduino Due❖ Arduino Mega❖ Arduino Leonardo❖ LilyPad❖ Nano❖ Mini❖ Mini Pro❖ BTAdvantages & Disadvantages of Arduino :❖ Not much knowledge required to get started.❖ Fairly low cost, depending on shields you need.❖ Lots of sketches and shields available.❖ No external programmer or power supply needed.
  • 8.
  • 9.
    Description of ArduinoPORT or PINS :❖ Analog Reference pin (orange)❖ Digital Ground (light green)❖ Digital Pins 2-13 (green)❖ Digital Pins 0-1/Serial In/Out - TX/RX (dark green) - These pins cannot be used for digital i/o(digitalRead and digitalWrite) if you are also using serial communication (e.g. Serial.begin).❖ Reset Button - S1 (dark blue)❖ In-circuit Serial Programmer (blue-green)❖ Analog In Pins 0-5 (light blue)❖ Power and Ground Pins (power: orange, grounds: light orange)❖ External Power Supply In (9-12VDC) - X1 (pink)❖ Toggles External Power and USB Power (place jumper on two pins closest to desired supply) -SV1 (purple)❖ USB (used for uploading sketches to the board and for serial communication between the boardand the computer; can be used to power the board) (yellow)
  • 10.
    Basic Programming ConceptArduinouses its own programming language, which is similar to C++. However, it'spossible to use Arduino with Python or another high-level programming language like C,Java. In fact, platforms like Arduino work well with Python, especially for applicationsthat require integration with sensors and other physical devices
  • 11.
  • 12.
    Void setup() Function:Void setup is technically a function that you create at the top of each program. Inside the curly brackets is thecode that you want to run one time as soon as the program starts running. You set things like pinMode in thissection. The loop is another function that Arduino uses as a part of its structure.Declaration :Void setup() {//write code here}Void Loop() Function :This is where the bulk of your Arduino sketch is executed. The program starts directly after the opening curlybracket ( } ), runs until it sees the closing curly bracket ( } ), and jumps back up to the first line in loop() andstarts all over.Declaration :Void loop(){//write code here}
  • 13.
    pinMode() Function :ThepinMode() function is used to configure a specific pin to behave either as an input or an output. It ispossible to enable the internal pull-up resistors with the mode INPUT_PULLUP. Additionally, the INPUT modeexplicitly disables the internal pull-ups.Declarations :pinMode(pin-number, OUTPUT); // pin as outputpinMode(pin-number, INPUT); //pin as inputdigitalWrite() Function :Write a HIGH or a LOW value to a digital pin. If the pin has been configured as an OUTPUT with pinMode() ,its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH , 0V (ground) forLOW.Declaration :digitalWrite(pin number, HIGH); //set the pin as highdigitalWrite(pin number, LOW); //set the pin as low
  • 14.
    digitalRead () Function:This function use to read the value from a specified digital pin, either HIGH or LOW. Syntax: digitalRead(pin)Where, pin: the number of the digital pin you want to read (int).Declaration :digitalRead (pin-number) ; //pin value should be HIGH/LOW as outputanalogWrite () Function :The analogWrite Arduino command is used to update the status of analog pins and also used to address thePWM pins on the board. The PWM pins are 8-bit pins, terming that you can set the duty cycle somewherebetween 0 -255.Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varyingbrightnesses or drive a motor at various speeds.Declaration :analogWrite(pin number, 0); // set low analog valueanalogWrite(pin number, 255); //set high analog value
  • 15.
    analogRead() Function :Readsthe value from the specified analog pin. The Arduino board contains a 6 channel (8 channels on theMini and Nano, 16 on the Mega), 10-bit analog to digital converter. This means that it will map input voltagesbetween 0 and 5 volts into integer values between 0 and 1023.Declaration :analogRead(pin Number); //it returns high or lowdelay() Function :The way the delay() function works is pretty simple. It accepts a single integer (or number) argument. Thisnumber represents the time (measured in milliseconds). The program should wait until moving on to the nextline of code when it encounters this function.Declaration :delay(1000); //delay for 1000ms
  • 16.
    Tools & Installations:To write code we will use arduino development tools by installing it ;-https://www.arduino.cc/en/main/softwareWe can also use Tinkarcad.com online autodesk software to code & simulations for arduino both.-https://www.tinkercad.com/dashboard?type=circuits&collection=designs
  • 17.
    LED blink ProgramWith Arduino :
  • 18.
    LED blinks WithContrast :
  • 19.
  • 20.
    Digital And AnalogInput ReceiveDigital Input Receive :
  • 21.
  • 22.
  • 23.
    Use Of Conditioncondition: each time through the loop, condition is tested; if it's true , the statement block,and the increment is executed, then the condition is tested again. When the conditionbecomes false , the loop ends. increment : executed each time through the loop whencondition is true .If ...else condition, boolean condition etc
  • 24.
    LED Blink UsingCondition :
  • 25.
  • 26.
    Multiple LED BlinkWithout Loop :
  • 27.
    Use Of LoopMultipleLED Blink Using For Loop :
  • 28.
    Multiple LED BlinkUsing For Loop :
  • 29.
    Use Of ArrayArray:An array is a consecutive group of memory locations that are of the same type. To refer toa particular location or element in the array, we specify the name of the array and theposition number of the particular element in the array.All of the methods below are valid ways to create (declare) an array. int myInts[6]; intmyPins[] = {2, 4, 8, 3, 6}; int mySensVals[6] = {2, 4, -8, 3, 2}; char message[6] = "hello";You can declare an array without initializing it as in myInts. In myPins we declare an arraywithout explicitly choosing a size.
  • 30.
  • 31.
  • 32.
  • 33.
    Servo Motor SimulationWith ArduinoA servomotor is a rotary actuator or linear actuator that allows for precise control ofangular or linear position, velocity and acceleration. It consists of a suitable motor coupledto a sensor for position feedback.
  • 34.
    Servo Motor 90Degree Rotation :
  • 35.
    Servo Motor 180Rotation :
  • 36.
    Extra Work :LED Blink Using Push Button
  • 37.
    Conclusions :As abeginner with arduino i am pleased to learn using Tinkarcad.com.Wishing that ,thefeedback by practice i’ll be able to be an expert with that embedded system design.Next, Ishall go for expert and advanced level using arduino.
  • 38.

[8]ページ先頭

©2009-2025 Movatter.jp