1/80
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Another name for a microcontroller
Small Computer System on Chip (SoC)
What makes up the Small Computer System on Chip (SoC)?
–a microcontroller, microprocessor or digital signal processor (DSP) core(s)
–memory blocks including a selection of ROM, RAM, EEPROM and flash memory
–timing devices: oscillators, phase-locked loops, counter-timers, real-time timers
–external interfaces: USB, Ethernet, USART, SPI, I2C communication
–Analog to Digital Converters (ADC) and Digital to Analog Converters (DAC)
–voltage regulators and power management circuits
Central Processing Unit (CPU)
The main component of a computer that performs calculations, executes instructions, and manages data flow within the system. It is often referred to as the brain of the computer.
Bootloader
A small program that initializes the hardware and loads the operating system or application into memory during the startup process.
What is the bootloader doing when it runs for a few seconds before startup?
–watches for IDE communication for downloading new code
–If no IDE present, the previous program will be executed
What is a alternative to using a bootloader
an in circuit programming pod, known as an ICSP (In-Circuit Serial Programmer)
GPIO Pin
General Purpose Input/Output Pin
General Purpose Input/Output Pins
- pins can be configured as inputs or outputs
■ This is typically declared in a startup procedure.
■ Input values are readable. This are typically digital or a Boolean where 1 is a logical high and 0 is a logical low.
■ Output values are writable and readable.
■ have 5 V tolerant inputs without damage even when the device operates off of 3.3 V. Make sure you know the voltage levels that your device can accept. Sometimes you need to employ a logic level shifter to protect you devices.
What Arduino pin controls the yellow onboard LED
13
What does PWM stand for?
Pulse Width Modulation
Boolean Variable
Holds 2 values, TRUE (1) or FALSE (0)
How much memory does a boolean take up?
1 byte (8 bits)
char Variable
Stores a character value
How much memory does the data type char take up?
1 byte (8 bits)
How much memory does int variable take up?
2 bytes (16 bits)
What range of values does the int variable hold?
-2^15 to (2^15)-1
How much memory does the unsigned int variable take up?
2 bytes (16 bits)
What range of values does the unsigned int variable hold?
0 to (2^16)-1
How much memory does the long variable take up
4 bytes (32 bits)
What range of values does the long variable hold?
-2,147,000,000 to 2,147,000,000
Unsigned int data type
Does not store any negative values
How much memory does unsigned long data type store
4 bytes (32 bits)
What range of values does the unsigned long datatype hold?
0 to (2^32-1)
Float data type
Decimal number values
How much memory does a float hold?
4 bytes (32 bits)
What range of values does the float data type hold?
-3.4×10^38 to 3.4×10^38
How much memory does a double take up?
4 bytes (32 bits)
TRUE or FALSE: float and doubles are the same thing
TRUE
Duty Cycle Formula
dc = (T high) / (Period) * 100%
Digital to Analog Converter (DAC)
Used to produce a accurate analog voltage between 0-5 V
What is used in lieu of a digital to analog converter?
PWM
What are examples of how PWM is used to vary voltage?
Vary LED brightness
Vary the speed of a DC motor
What frequency of PWM signals is produced?
490 Hz except for pins 5 and 6 which are 980 Hz
What are the PWM pins
3, 5, 6, 9, 10, and 11
Bitwise AND Operator
&
Bitwise OR Operator
|
Bitwise XOR Operator
^
Bitwise NOR Operator
~
Boolean AND Operator
&&
Boolean OR Operator
||
Boolean XOR Operator
!=
Boolean NOT Operator
!
What type of operators are used to manipulate bits?
Bitwise
What type of operators are used in conditional statements (if, while, for)
Boolean
Local Variable
Variable declared INSIDE a function or block
Global Variable
Declared OUTSIDE of all functions (usually at top of code)
Function Call Format
k = function(i,j);
while loop
Checks the condition BEFORE running the loop body. If the condition is false at the start, the body may not run at all.
do-while loop
Runs the loop body FIRST, then checks the condition. This means the body will ALWAYS RUN AT LEAST ONCE, even if the condition is false from the beginning

Pulldown Resistor

Pullup Resistor
Pulldown Resistor
Resistor is directly connected to ground
Pullup Resistor
Resistor is directly connected to power
What are pullup and pulldown resistors used for?
Are needed to prevent the microcontroller unit input from floating
Give a example of a sensor that provides digital input
A button (ON = TRUE(1) and OFF=FALSE(0))
Give a example of a sensor that provides analog input
A thermistor/temp sensor which changes voltage based on a range of temperature values
What is a bootloader?
A small program stored in a microcontroller that starts a device and loads the main program when power turns on
What are two ways to power the arduino board?
USB Cord
Vin / 5V Arduino Pins
The GPIO pins on your board are configured as input by default. Why?
To prevent damage to the board when first powering on
Why would you want to debounce a button?
It allows you to avoid the button from looping multiple times on accident after the button is pressed due to electrical noise
What is a potentiometer?
A resistor that lets you change the resistance values by turning a knob which changes the output voltage

Suppose you have the following problematic circuit. What is the digital value of PIN 2 when the button is pressed?
The value is HIGH (1)

Suppose you have the following problematic circuit. What is the digital value of PIN 2 when the button is NOT pressed?
The value will either be HIGH or LOW since the pin is floating (its disconnected from 5V and also not connected to ground) and is unstable

Suppose you have the following problematic circuit. How would you fix the problematic circuit?
Need to add a pull-down resistor between PIN22 and GND
MEMS Capacitive Accelerometer
Detects movement and acceleration by measuring changes in capacitance
Gyroscope
Measures the angle of a piece of hardware
Thermistor
Detects changes in temperature and uses that to change the resistance values
Photoresistor
Detects changes in the amount of light and uses that to change the resistance values
Equation used to calculate how many values a ADC represents
# of Values = 2^(# of bits)
How many values can a 10 bit ADC represent?
Num of Values = 2 ^ (# of bits) = 2^10 = 1,024 Values
How many bits does a boolean variable take up in memory?
1 byte (8 bits)

Consider the code. Is the variable x on line 14 a local or global variable?
Global since its written as x*=k

Consider the code. Is the variable k on line 14 local or global?
Global

Consider the code. Is the variable k on line 9 local or global?
Local since its initialized as int k=2

What would be the output to the serial console of the entire program, after the loop runs exactly once?
2
4
3
4
8
3

Consider the following code snippet. What would be output to the screen?
0
-2

Consider the code snippet. What would be output to the screen?
-2
It would only finish the do-loop since the while loop wont run because count = -2 which is less than 0 so the while condition is false

Consider the code snippet. What would be the output to the screen if the sensorValue is 475? What would the LED do?
The output would be 23.3 and the LED would blink. The LED lights, waits 500 ms, then turns off, waits 500 ms, and repeats.

Consider the code snippet. What would be the output to the screen if the sensorValue is 614? What would the LED do?
The output would be 30.0 and the LED would turn on and stay lit

Consider the code.
Suppose you run the code above but are noticing that the debounce isnt very effective because it is too short. How would you change the code?
The debounce isnt as effective because it needs to be greater than 5 ms. To fix this, both lines 5 and 7 should be changed to say delay(100) . If its still too short, then both lines should be changed to delay(1000).
Write a code snippet (at most 5 lines that will):
1. Configure the PWM capable pin 11 as a output
Read a value from analog input A1
Linearly scale the pin A1 analog value to a value between 0-255 using the map() function
Write to pin 11 using analogWrite
NOTE: analogRead values are 0-1023 and analogWrite values are 0-255
pinMode(11, OUTPUT); //Set pin 11 as output
int sensorValue = analogRead(A1); //Read a Value from A1
int scaledValue = map(sensorValue, 0, 1023, 0, 255); // Scaling
analoWrite(11, scaledValue); //Write scaled result to pin 11