0% found this document useful (0 votes)
17 views3 pages

Reviewer

Uploaded by

ricpangilinan764
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views3 pages

Reviewer

Uploaded by

ricpangilinan764
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Digital Functions analogWrite() - will allow us to access the pulse

pinMode() - to set up which pin we are width modulation hardware on the Arduino
going to use and how we intend to use it. microcontroller.

Syntax - pinMode(pin,state) Syntax - analogWrite(pin, duty cycle)

digitalWrite() - it is then possible to turn that pin on or analogReference() - the Arduino assumes a
off using the voltage range of between 0v and +5v.
digitalWrite() function.
Syntax - analogReference(type)
Syntax - digitalWrite(pin, state)

HIGH is basically turning the circuit on, while setting


the pin LOW turns it off.

digitalRead() - we can read the state of that pin using


the digitalRead() Serial is used by two digital devices to talk to each other
function. and is loosely related to a collection of communication
protocols that includes USB.
State Changes
What we are doing is called edge Serial.begin(9600);
detection because really all we are looking for is that Our communication speed has been set to 9600 bits
specific moment or edge when the state changes per second (bps or baud), a fairly common
from one condition to another. communication speed for these purposes.

Mapping Values
map() - An alternative method would be to use the
map() function, which appropriately enough, is one
of the more useful functions for mapping sensor
values.

Syntax - map(value, fromLow, fromHigh, toLow,


toHigh)

constrain() - If, though, we


wanted to force the values to a very specific, limited
range instead, we could use the constrain() function.

Syntax - constrain(value, min, max)

Arrays are an essential part of the Arduino


Modality programmer’s toolbox.
The process of modality is where a device, receiving
information from a user through sensors and inputs, is Arrays can turn a single variable into a list of
expected to perform multiple actions based on that multiple variables.
input.
Arduino compiler counting the values assigned to
the array
Analog Functions
analogRead() - The counterpart to the digitalRead() Arduino C has no way to cross-check our array
function, analogRead() is equally as simple at first. declarations and would allow us to exceed the
boundaries of our arrays.
Syntax - analogRead(pin)
Arduino C allows for arrays with any number of volatile - any data in RAM will be lost when the
dimensions. power has been turned off.

sizeof() - this function will return the total number of RAM—technically this is static or SRAM but it
bytes used in an array doesn’t really matter—that is used for storing data
and various microcontroller instructions like keeping
sizeof(flicker)/2 = 8 track of function calls while the microcontroller is
running..
for loop - to place multiple values into an array
The final type of memory on the ATmega328
char helloWorld[] = "Hello, world!"; - this array is an microcontroller is the 1024 bytes of EEPROM -
example of C-style text strings of the char data type short for electronically erasable program read-only
memory. This memory is also non-volatile, keeping
The string of text is a collection of 14 elements its data even when power is not present,

Multidimensional arrays are declared -ATmega328 has 2048 bytes of RAM


by simply adding an additional index in square
brackets for each extra dimension, 3 Types:
1. The ATmega328 - has a total capacity of 32,768
arrayTwo - we have two arrays with two elements bytes - 500 bytes Arduino bootloader. (nv)
each for a total of four elements. 2. ATmega328 has 2048 bytes of RAM (v)
3. ATmega328 microcontroller is the 1024 bytes of
two-dimensional arrays are particularly useful on EEPROM (nv)
the Arduino for creating patterns or animations
using a row or grid of LEDs. EEPROM - has a limited life span where it
can only be reprogrammed up to about 100,000
three-dimensional arrays use to create a whole times before it becomes unusable.
set of animations for an 8 × 8 LED matrix or to store
the X, Y, and Z readings EEPROM - is a byte addressable memory, making it
from an accelerometer. a little trickier to put into use if we are not using a
byte data type for our data and it requires its own
There are three separate types of memory found library to be accessed in our code.
inside the Atmel ATmega328 microcontroller used
on the Arduino Uno interface board EEPROM stores data in 1-byte sections with the
Arduino Uno storing up to 1024
flash or program memory - largest chunk of bytes.
memory on the microcontroller
kicker - running out of RAM can happen at any time
The ATmega328 - has a total capacity of 32,768 with absolutely no warning.
bytes available to store program instructions,
compiled from our source Jean-Claude Wippler of JeeLabs - wrote a small
code, function, that we can drop into a sketch to find out
-with roughly 500 bytes taken up by the Arduino how much RAM is currently unused.
bootloader.
int freeRAM() {
bootloader - is a small program that makes extern int __heap_start, *__brkval;
programming the microcontroller through a serial int v;
port possible rather than requiring additional return (int) &v - (__brkval == 0 ? (int) &__heap_start
hardware. : (int) __brkval);
}
non-volatile memory - meaning that the program
stored in this memory is retained even when power -This function uses some of that ridiculous
is no longer present or the board has been reset. non-Arduino code that we really don’t need to
understand in depth.
use the pgmspace library that is a part of the LibraryName.h is the file name of the library that
standard avr-libc library to keep read-only data we want to use.
stored only in program memory.
#include <LiquidCrystal.h>
The easiest way to keep a string in program -to enable those functions that make it easier to use
memory and not in RAM is to use the PROGMEM an LCD
variable qualifier .

The strcpy_P() function will copy a target string a function called begin() that is a part of the
stored in program memory to a location in RAM LiquidCrystal library linked to the
memory. instance that we created called lcd.

buffer[] - dimension of 30 to temporarily store each servo motor is an easy motor to hook up and does
individual line of text in RAM. what it does with ease,

To read and write data to the EEPROM, we need to


use the EEPROM library. SD or Secure Digital flash
"#include <EEPROM.h>" memory cards - are the very same wafer-thin
memory cards used by cameras, mp3 players, and
EEPROM.write() function syntax: other
"EEPROM.write(address, value)" devices.

EEPROM.read() syntax: The SD library -is a relative newcomer to the


"EEPROM.read(address)" standard Arduino libraries and the list of functions
and associated libraries would make our
delay() - function to create a conversations of the LiquidCrystal library and the
short pause in the middle of a program. PROGMEM
Syntax : "delay(time)" functions
*(Time is specified in milliseconds, where a delay of
1000 milliseconds = 1 second)

delayMicroseconds()
- function to delay for a much shorter time.
syntax:
"delayMicroseconds(time)"
*(1000 microseconds = 1 millisecond or 0.001 of a
second)

The millis() function -used to count button presses.


(Millisecond) -50 days

random()
- function returns a semi-random number up to the
parameters specified

micros() - microsecond (70 mins)


-multiple of 4

randomSeed() - function a seed value, we can kick


off the random generation at a more
unexpected point somewhere in the depths of the
random sequence.
Syntax: "randomSeed(value)"

#include<LibraryName.h>

You might also like