Difference between revisions of "Arduino"

From Colettapedia
Jump to navigation Jump to search
Tags: Mobile edit Mobile web edit
 
Line 1: Line 1:
 
== Arduino Language ==
 
== Arduino Language ==
 +
 
* [https://www.arduino.cc/reference/en/ Arduino language reference]
 
* [https://www.arduino.cc/reference/en/ Arduino language reference]
 
* <code>analogRead()</code> - [https://www.arduino.cc/reference/en/language/functions/analog-io/analogread/ analogRead docs]
 
* <code>analogRead()</code> - [https://www.arduino.cc/reference/en/language/functions/analog-io/analogread/ analogRead docs]
Line 6: Line 7:
 
* <code>analogWrite()</code> - [https://www.arduino.cc/reference/en/language/functions/analog-io/analogwrite/ AnalogWrite docs]
 
* <code>analogWrite()</code> - [https://www.arduino.cc/reference/en/language/functions/analog-io/analogwrite/ AnalogWrite docs]
 
* <code>analogWriteResolution()</code> - [https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogwriteresolution/ analogWriteResolution docs]
 
* <code>analogWriteResolution()</code> - [https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogwriteresolution/ analogWriteResolution docs]
 +
 +
=== Port Registers ===
 +
* [https://www.arduino.cc/en/Reference/PortManipulation Port Manipulation]
 +
* Use only if:
 +
** You need to turn pins on and off very quickly, meaning within fractions of a microsecond
 +
** You need to set multiple output pins at the same time
 +
** You're running low on program memory
 +
** Otherwise use <code>digitalRead()</code> and <code>digitalWrite()</code> for more readable, portable code.
 +
* DDRx - data direction register (r/w)
 +
** You will only see 5 volts on these pins however if the pins have been set as outputs using the DDRx register or with <code>pinMode()</code>.
 +
* PORTx - data register (r/w)
 +
* PINx - Read all of the digital input pins at the same time - read only
 +
 +
 +
=== Timer Interrupts ===
 +
* [https://www.instructables.com/Arduino-Timer-Interrupts/ Arduino Timer Interrupts]
  
 
== Microcontroller concepts ==
 
== Microcontroller concepts ==

Latest revision as of 04:29, 24 February 2021

Arduino Language

Port Registers

  • Port Manipulation
  • Use only if:
    • You need to turn pins on and off very quickly, meaning within fractions of a microsecond
    • You need to set multiple output pins at the same time
    • You're running low on program memory
    • Otherwise use digitalRead() and digitalWrite() for more readable, portable code.
  • DDRx - data direction register (r/w)
    • You will only see 5 volts on these pins however if the pins have been set as outputs using the DDRx register or with pinMode().
  • PORTx - data register (r/w)
  • PINx - Read all of the digital input pins at the same time - read only


Timer Interrupts

Microcontroller concepts

Libraries

Arduino Mega 2560