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
Introduction to the Arduino
PPTX
Introduction to Arduino
PPTX
Introduction to Arduino Hardware and Programming
PPTX
Lesson sample introduction to arduino
PPTX
Arduino Microcontroller
PPTX
Programming with arduino
PDF
Arduino presentation
PPTX
Basics of arduino uno
PPTX
PPT ON Arduino
PDF
Introduction to arduino
PDF
Introduction of Arduino Uno
PDF
Arduino IDE
PDF
Arduino Workshop Day 1 - Basic Arduino
 
PPTX
Ardui no
PPTX
Introduction to arduino
PPT
Intro to Arduino
PPS
What is Arduino ?
PPTX
Arduino Functions
PPTX
Arduino and c programming
PDF
Introduction to Arduino Programming
PPT
Arduino Platform with C programming.
PPTX
Introduction to Arduino and Hands on to Iot
PDF
Introducing the Arduino
PDF
Alfabeto di Arduino - lezione 2
PPT
arduino
 
PPTX
Introduction to Arduino
PPT
Arduino
PPTX
Arduino course
PDF
Syed IoT - module 5

More Related Content

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

What's hot

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

Similar to Arduino Programming Basic

PPTX
Arduino course
PDF
Syed IoT - module 5
PDF
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
PDF
Arduino-workshop.computer engineering.pdf
PPTX
INTODUCTION OF IOT AND INTERFACING WITH ARDUINO UNO
PPTX
PPTX
IOT-UNIT 3.pptxaaaasasasasasasaasasasasas
PPT
01 Intro to the Arduino and it's basics.ppt
PPTX
Arduino Foundations
PPTX
Arduino programming
PDF
introductiontoarduino-111120102058-phpapp02.pdf
DOCX
Arduino and Circuits.docx
PPT
Arduino_CSE ece ppt for working and principal of arduino.ppt
PPTX
Introduction To Arduino-converted for s.pptx
 
PDF
Arduino microcontroller ins and outs with pin diagram
PDF
arduinoworkshop-160204051621.pdf
PDF
arduinocourse-180308074529 (1).pdf
PPTX
Arduino cic3
PPTX
Micro_Controllers_lab1_Intro_to_Arduino.pptx
 
PPT
13223971.ppt
Arduino course
Syed IoT - module 5
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
Arduino-workshop.computer engineering.pdf
INTODUCTION OF IOT AND INTERFACING WITH ARDUINO UNO
IOT-UNIT 3.pptxaaaasasasasasasaasasasasas
01 Intro to the Arduino and it's basics.ppt
Arduino Foundations
Arduino programming
introductiontoarduino-111120102058-phpapp02.pdf
Arduino and Circuits.docx
Arduino_CSE ece ppt for working and principal of arduino.ppt
Introduction To Arduino-converted for s.pptx
 
Arduino microcontroller ins and outs with pin diagram
arduinoworkshop-160204051621.pdf
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
ভূমি সংশ্লিষ্ট অপরাধ প্রতিকার ও প্রতিরোধ ৩৬ নং আইন, ২০২৩,
PDF
The Bangladesh Legal Practitioner_s and Bar Council Order, 1972.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

PDF
ACI 318-2205_American Concrete Institute.pdf
PDF
Albert Pintoy - Specializing In Low-Latency
PDF
Presentation-on-Energy-Transition-in-Bangladesh-Employment-and-Skills.pdf
PPTX
UnrealGameplayAbilitySystemPresentation.pptx
PPTX
MECCA Empire – Hotel Shuttle System for the 2026 FIFA World Cup
 
PPTX
How to Use Mobile CMMS to Improve Maintenance Operations & Field Productivity
PPTX
Assessment 4 SRS Presentation - Final (2).pptx
PPTX
Emerging Trends and Research Frontiers in Chemical Engineering for Green and ...
PPTX
Salesforce Bulk Connector V1 and V2 Deep Dive!
PPT
63490613-Boiler-Tube-Leakage-analysis-symptoms-causes.ppt
PDF
Human computer Interface ppt aUNIT 3.pdf
PPTX
How to Select the Right CMMS Software for Your Organization — A Complete Buye...
PPTX
Power point presentation on introduction of software engineering
PPTX
Natural Gas fundamentals and GRU for associated gas trap.pptx
PPTX
TPM Metrics & Measurement: Drive Performance Excellence with TPM | MaintWiz
PPTX
The Importance of Maintenance Budgets — Maximize Reliability & Control Costs ...
PPTX
Plant Performance Strategies: Enhanced Reliability & Operational Efficiency w...
PPTX
How to Implement Kaizen in Your Organization for Continuous Improvement Success
PDF
Narrows Planning Collective Transportation Capstone.pdf
 
PDF
Lecture -06-Hybrid Policies - Chapter 7- Weeks 6-7.pdf
ACI 318-2205_American Concrete Institute.pdf
Albert Pintoy - Specializing In Low-Latency
Presentation-on-Energy-Transition-in-Bangladesh-Employment-and-Skills.pdf
UnrealGameplayAbilitySystemPresentation.pptx
MECCA Empire – Hotel Shuttle System for the 2026 FIFA World Cup
 
How to Use Mobile CMMS to Improve Maintenance Operations & Field Productivity
Assessment 4 SRS Presentation - Final (2).pptx
Emerging Trends and Research Frontiers in Chemical Engineering for Green and ...
Salesforce Bulk Connector V1 and V2 Deep Dive!
63490613-Boiler-Tube-Leakage-analysis-symptoms-causes.ppt
Human computer Interface ppt aUNIT 3.pdf
How to Select the Right CMMS Software for Your Organization — A Complete Buye...
Power point presentation on introduction of software engineering
Natural Gas fundamentals and GRU for associated gas trap.pptx
TPM Metrics & Measurement: Drive Performance Excellence with TPM | MaintWiz
The Importance of Maintenance Budgets — Maximize Reliability & Control Costs ...
Plant Performance Strategies: Enhanced Reliability & Operational Efficiency w...
How to Implement Kaizen in Your Organization for Continuous Improvement Success
Narrows Planning Collective Transportation Capstone.pdf
 
Lecture -06-Hybrid Policies - Chapter 7- Weeks 6-7.pdf

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