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

PPTX
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
PPTX
Lesson sample introduction to arduino
PPTX
Introduction to Arduino
PPTX
Introduction to Arduino Hardware and Programming
PPTX
Arduino Microcontroller
PPTX
Introduction to the Arduino
PDF
Arduino presentation
PPTX
Programming with arduino
PPTX
Basics of arduino uno
PPTX
Arduino Functions
PDF
Arduino Workshop Day 1 - Basic Arduino
 
PPTX
Introduction to Arduino
PPTX
Ardui no
PDF
Introduction to Arduino Programming
PPTX
Arduino and c programming
PDF
Arduino IDE
PPTX
Introduction to Arduino and Hands on to Iot
PPTX
PPT ON Arduino
PDF
Introduction of Arduino Uno
PPT
arduino
 
PPT
Arduino Platform with C programming.
PDF
Introduction to arduino
PDF
Introducing the Arduino
PPTX
Introduction to arduino
PPT
Arduino
PPT
Intro to Arduino
PPS
What is Arduino ?
PDF
Alfabeto di Arduino - lezione 2
PDF
introductiontoarduino-111120102058-phpapp02.pdf
PPTX
Arduino programming

More Related Content

PPTX
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
PPTX
Lesson sample introduction to arduino
PPTX
Introduction to Arduino
PPTX
Introduction to Arduino Hardware and Programming
PPTX
Arduino Microcontroller
PPTX
Introduction to the Arduino
PDF
Arduino presentation
PPTX
Programming with arduino
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
Lesson sample introduction to arduino
Introduction to Arduino
Introduction to Arduino Hardware and Programming
Arduino Microcontroller
Introduction to the Arduino
Arduino presentation
Programming with arduino

What's hot

PPTX
Basics of arduino uno
PPTX
Arduino Functions
PDF
Arduino Workshop Day 1 - Basic Arduino
 
PPTX
Introduction to Arduino
PPTX
Ardui no
PDF
Introduction to Arduino Programming
PPTX
Arduino and c programming
PDF
Arduino IDE
PPTX
Introduction to Arduino and Hands on to Iot
PPTX
PPT ON Arduino
PDF
Introduction of Arduino Uno
PPT
arduino
 
PPT
Arduino Platform with C programming.
PDF
Introduction to arduino
PDF
Introducing the Arduino
PPTX
Introduction to arduino
PPT
Arduino
PPT
Intro to Arduino
PPS
What is Arduino ?
PDF
Alfabeto di Arduino - lezione 2
Basics of arduino uno
Arduino Functions
Arduino Workshop Day 1 - Basic Arduino
 
Introduction to Arduino
Ardui no
Introduction to Arduino Programming
Arduino and c programming
Arduino IDE
Introduction to Arduino and Hands on to Iot
PPT ON Arduino
Introduction of Arduino Uno
arduino
 
Arduino Platform with C programming.
Introduction to arduino
Introducing the Arduino
Introduction to arduino
Arduino
Intro to Arduino
What is Arduino ?
Alfabeto di Arduino - lezione 2

Similar to Arduino Programming Basic

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

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

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

Recently uploaded

PDF
Albert Pintoy - Specializing In Low-Latency
PPTX
Emerging Trends and Research Frontiers in Chemical Engineering for Green and ...
PPTX
Track & Monitor Preventive Maintenance — Best Practices with MaintWiz CMMS
PDF
Surveillance_Partner_Product_Training_20240120_KSA.pdf
PDF
IPEC Presentation - Partial discharge Pro .pdf
PPTX
How to Create an Effective Monthly Maintenance Plan for Reliable Plant Operat...
PPTX
The Importance of Maintenance Budgets — Maximize Reliability & Control Costs ...
PPTX
Vertical turbine pump explains installed in power plants
PPTX
How to Use Mobile CMMS to Improve Maintenance Operations & Field Productivity
PDF
Structural Conservation Appraisal of Indian Monuments Preserving India’s Arch...
PPTX
Power point presentation on introduction of software engineering
PPTX
Role of In Vitro and In Vivo Testing biomedical engineering
PPTX
22304_BCO_CO3_LO4_PPT MSBTE Building construction.pptx
PPTX
Unit 1 Introduction to Information Technology in Business.pptx
PPTX
علي نفط.pptx هندسة النفط هندسة النفط والغاز
PPTX
MECCA Empire – Hotel Shuttle System for the 2026 FIFA World Cup
 
PPT
new Introduction to PACS.ppt Picture Archieving and communication and medicine
PPTX
Optimizing Operations: Key Elements of a Successful Plant Maintenance Plan — ...
PPTX
ISO 14224 Compliance & CMMS Software — A Comprehensive Guide for Reliable Mai...
PDF
Advanced Intrusion Detection and Classification using Transfer Learning with ...
Albert Pintoy - Specializing In Low-Latency
Emerging Trends and Research Frontiers in Chemical Engineering for Green and ...
Track & Monitor Preventive Maintenance — Best Practices with MaintWiz CMMS
Surveillance_Partner_Product_Training_20240120_KSA.pdf
IPEC Presentation - Partial discharge Pro .pdf
How to Create an Effective Monthly Maintenance Plan for Reliable Plant Operat...
The Importance of Maintenance Budgets — Maximize Reliability & Control Costs ...
Vertical turbine pump explains installed in power plants
How to Use Mobile CMMS to Improve Maintenance Operations & Field Productivity
Structural Conservation Appraisal of Indian Monuments Preserving India’s Arch...
Power point presentation on introduction of software engineering
Role of In Vitro and In Vivo Testing biomedical engineering
22304_BCO_CO3_LO4_PPT MSBTE Building construction.pptx
Unit 1 Introduction to Information Technology in Business.pptx
علي نفط.pptx هندسة النفط هندسة النفط والغاز
MECCA Empire – Hotel Shuttle System for the 2026 FIFA World Cup
 
new Introduction to PACS.ppt Picture Archieving and communication and medicine
Optimizing Operations: Key Elements of a Successful Plant Maintenance Plan — ...
ISO 14224 Compliance & CMMS Software — A Comprehensive Guide for Reliable Mai...
Advanced Intrusion Detection and Classification using Transfer Learning with ...

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