UNO board IO pin introduction

UNO board IO pin introduction

UNO Technical spacs:

Input and Output
Each of the 14 digital pins on the Uno can be used as an input or output to exert pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or receive 20 mA as recommended operating condition and has an internal pull-up resistor (disconnected by default) of 20-50k ohm. A maximum of 40mA is the value that shouldn’t  be exceeded on any I/O pin to avoid permanent damage to the microcontroller.
In addition, some pins have specialized functions:
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.
External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.
PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using the SPI library.
LED: 13. There is a built-in LED driven by digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it’s off.
TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the Wire library.
The Uno has 6 analog inputs, labeled as A0 to A5, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, however it is possible to change the upper end of their range using the AREF pin and the analogReference() function.
There are a couple of other pins on the board:
AREF. Reference voltage for the analog inputs. Used with analogReference().
Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which block the one on the board.

Digital I/O
Configures the specified pin to use either as an input or an output. See the description of digital pins for details on the functionality of the pins.
As of Arduino 1.0.1, it is possible to enable the internal pullup resistors with the mode INPUT_PULLUP. Additionally, the INPUT mode explicitly disables the internal pullups.
pinMode(pin, mode)
pin: the number of the pin whose mode you wish to set

Write a HIGH or a LOW value to a digital pin.
If the pin has been configured as an OUTPUT with pinMode(), its voltage should be set to the corresponding value: 5V for HIGH, 0V (ground) for LOW.
If the pin is configured as an INPUT, digitalWrite() will enable (HIGH) or disable (LOW) the internal pullup on the input pin. It is recommended to set the pinMode() to INPUT_PULLUP to enable the internal pull-up resistor.
NOTE: If you don’t set the pinMode() to OUTPUT, and connect an LED to a pin, when calling digitalWrite(HIGH), the LED may appear dim. Without explicitly setting pinMode(), digitalWrite() will enable the internal pull-up resistor which acts like a large current-limiting one.
digitalWrite(pin, value)
pin: the pin number
value: HIGH or LOW

Reads the value from a specified digital pin, either HIGH or LOW.
pin: the number of the digital pin you want to read (int)

Sets pin 13 to the same value as pin 7, declared as an input.

int ledPin = 13; // LED connected to digital pin 13
int inPin = 7;   // pushbutton connected to digital pin 7
int val = 0;     // variable to store the read value

void setup()
pinMode(ledPin, OUTPUT);      // sets the digital pin 13 as output
pinMode(inPin, INPUT);        // sets the digital pin 7 as input

void loop()
val = digitalRead(inPin);     // read the input pin
digitalWrite(ledPin, val);    // sets the LED to the button’s value

Analog I/O
Reads the value from the specified 1analog pin. The Arduino board contains a 6-channel, 10-bit analog  digital converter, which will map input voltages between 0 and 5 volts into integer values between 0 and 1023. This yields a resolution between readings of: 5 volts / 1024 units or, .0049 volts (4.9 mV) per unit.

It takes about 100 microseconds (0.0001 s) to read an analog input, so the maximum reading rate is about 10,000 times a second.

pin: the number of the analog input pin read from 0 to 5
int (0 to 1023)

If the 1analog input pin is not connected to anything, the value returned by 1analogRead() will fluctuate based on a number of factors (e.g. the values of the other 1analog inputs, how close your hand is to the board, etc.).

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
Serial.println(val);             // debug value


Writing an 1analog value (PWM wave) to a pin can light the LED at varying brightnesses or drive a motor at various speeds. After a call to analogWrite(), the pin will generate a steady square wave of the specified duty cycle until the next call to analogWrite() (or a call to digitalRead() or digitalWrite() on the same pin). this function works on pins 3, 5, 6, 9, 10, and 11.

You don’t need to call pinMode() to set the pin as an output before calling analogWrite().
The analogWrite function has no linkage to the analog pins or the analogRead function.
analogWrite(pin, value)
pin: the pin to write to.
value: the duty cycle: between 0 (always off) and 255 (always on).
Notes and Known Issues
The PWM outputs generated on pins 5 and 6 will have higher-than-expected duty cycles. This is because of interactions with the millis() and delay() functions, which share the same internal timer used to generate those PWM outputs. This will be noticed mostly on low duty-cycle settings (e.g 0 – 10) and may result in a value of 0, not fully turning off the output on pins 5 and 6.

Sets the output to the LED proportional to the value read from the potentiometer.
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(1analogPin);   // read the input pin
analogWrite(ledPin, val / 4);  // analogRead values go from 0 to 1023, analogWrite values from 0 to 255

209 Replies to “UNO board IO pin introduction”

  1. Pingback: cost of viagra
  2. Pingback: sildenafil citrate
  3. Pingback: buying viagra
  4. Pingback: viagra cialis
  5. Pingback: doctor x viagra
  6. Pingback: visual viagra
  7. Pingback: herbal viagra
  8. Pingback: viagra generic
  9. Pingback:
  10. Pingback: viagra vs cialis
  11. Pingback: viagra for sale
  12. Pingback: sildenafil 20mg
  13. Pingback: online ed meds
  14. Pingback: buy cialis japan
  15. Pingback: generic for cialis
  16. Pingback: buy viagra no rx
  17. Pingback: viagra otc us
  18. Pingback: viagra price
  19. Pingback: buy cialis online
  20. Pingback: online viagra
  21. Pingback: get coupon
  22. Pingback: cheap viagra 25mg
  23. Pingback: viagra sale
  24. Pingback: cialis discount
  25. Pingback: viagra prices
  26. Pingback: 1
  27. Pingback: cymbalta euphoria
  28. Pingback: sildenafil generic
  29. Pingback: viagra
  30. Pingback: viagra buy uk
  31. Pingback: Duna 2021
  32. Pingback: buy cialis cheap
  33. Pingback: lexapro and ativan
  34. Pingback: natural viagra
  35. Pingback: lipitor and ed
  36. Pingback: sildenafil
  37. Pingback: zoloft sertraline
  38. Pingback: prozac suicide
  39. Pingback: blue chew viagra
  40. Pingback: cialis meme
  41. Pingback: psiholog
  42. Pingback: Suicide Squad 2
  43. Pingback:
  44. Pingback:
  45. Pingback:
  46. Pingback:
  47. Pingback: KremlinTeam
  48. Pingback: link
  49. Pingback: A3ixW7AS
  50. Here at Leslie’s Pugsland Breeder, Our beautiful fawn pug has given birth to 4 healthy Pug puppies.
    She is our beloved family dog and this is her 1st litter.
    Both mum and dad are AKC registered with 5 gen pedigree certificate. Both from Top Champion bloodlines.Mum and Dad can be seen. Puppies have been wormed weeks 2,4,6,8 and will have had a flea preventative treatment before leaving us.
    They will have their vet check, 1st vaccinations and microchip.
    To view all available puppies and recent pictures, Search us in google as LESLIE’S PUGSLAND BREEDER or click on our website link bellow :

    Pug Puppies for sale | pug for sale near me | pug puppy for sale | pug puppy | pug for sale | pug puppies for sale in va | black pug puppies for sale

  51. Pingback: ukraine
  52. Pingback: vechernyy urgant
  53. Pingback: Porno
  54. Pingback: 66181
  55. Pingback: chernaya vodova
  56. Pingback: blogery_i_dorogi
  57. Pingback: bender na4alo 2021
  58. Pingback:
  59. Pingback: chelovek-iz-90-h
  60. Pingback: is cialis safe
  61. Pingback: rx pharmacy viagra
  62. Pingback: top
  63. Pingback: cialis 20mg usa
  64. Pingback: site
  65. Pingback: Ukrainskie-serialy
  66. Pingback: video
  67. Pingback: topvideos
  68. Pingback:
  69. Pingback: projectio-freid
  70. Pingback: psy2022
  71. Pingback: psy
  72. Pingback: news news news
  73. Pingback: 4569987
  74. Pingback: Zakhar Berkut hd
  75. Pingback: buy cheap cialis
  76. Pingback: viagra
  77. Pingback: Trecator SC
  78. Pingback: viagra substitute
  79. Pingback: cialis and alcohol
  80. Pingback: tadalafil online
  81. Pingback: online cialis
  82. Pingback: help with an essay
  83. Pingback: Glock 19 Gen 5
  84. Pingback: GLOCK 48
  85. Pingback: boyaqq
  86. Pingback: sahabatpoker
  87. Pingback: click this link
  88. Pingback: bai chan online
  89. Pingback: fresh dump
  90. Pingback: Bukit Timah Condo
  91. Pingback: sex toys
  92. Pingback: game pc
  93. Pingback: CBD Spray
  94. Pingback: webbforsenate
  95. Pingback: pptp vpn
  96. Pingback: uniccshop.bazar
  97. Pingback: How to lose weight
  98. Pingback: سایت پوکر
  99. Pingback: weight loss
  100. Pingback: look here
  101. Pingback: cach choi bau cua
  102. Pingback: w888 club
  103. Pingback: W88
  104. Pingback: Attitude Seeds
  105. Pingback: lire l'article
  106. Pingback: additional reading
  107. Pingback: 바카라
  108. Pingback: 먹튀검증
  109. Pingback: tutoring online
  110. Pingback: pr jobs
  111. Pingback: Muschi

Leave a Reply