1/6
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No study sessions yet.
Hardcoding
When the code explicitly gives directions instead of using a sensor or logic
Programming Concepts: Variable Types:
8 bits
8 bits = 1 Byte
Char - character
16 bits
int - integer
unsigned int
32 bits
long
unsigned long
float - floating decimal place
Binary - two-based system
Fading in and Fading Out (Analog or Digital?)
A few pins on the Arduino allow for us to modify the output to mimic an analog signal.
This is done by a technique called Pulse Width Modulation (PWM) - a method to stimulate/imitate an analog signal by turning a digital pin ON and OFF at strategic intervals
Analog v. Digital
To create an analog signal, the microcontroller uses a technique called PWM. By varying the duty cycle, we can mimic an “average” analog voltage.
50% duty cycle- turning on half time
10% duty cycle - turning on 10% of time
PWM
Medium voltage pwm signal, low voltage, high voltage
0 - 255
0V - 5V
fading lights
Project - Fading Lights
analogWrite (pin, val);
Pin - refers to the OUT pin (limited to pins 3, 5, 6, 9, 10, 11.) - denoted by a ~ symbol
Val - 8 bit value (0-255)
0=> 0V | 255 => 5V
Move one of your LED pins over to 9
PWM O/P Signal
Digital Sensor (I/P_
Ohms - Pull Digital Signal - pull down resistor connects to this write and button , allows these two halves to connect
fading lgihts 2.0
Pin mode to establish pin modes activaitng
Brightness = brightness + fadeAmount,
“New brightness is the current brightness plus the fade amount.”
New brightness = old brightness + 5
What is binary?
Coding language of 1s and 0s. Two states (on/off).
How is binary useful?
Direct communication with computers. Simple way to store data.
How is it similar to the decimal number system?
Both rely on numerical positioning
A computing device uses binary to communicate with its individual parts, other devices, and its user.
The number values represent different pieces of information (data) which is translated / interpreted by devices or users.
Bit - a single digit. Basic unit of storage.
Byte - 8 binary bits.
decimal - base 10 number system
Hexadecimal - base 16 number system
binary - base 2 number system
Each hex digit is the equivalent of ½ of a binary byte AKA 1 hex bit = 4 binary bits.
What is binary?
Binary is a base-2 number system using only 0s and 1s. They represent the “on” and “offs” of electrical circuits.
How is binary useful?
Binary allows for the efficient storage and processing of data. It also provides a universal language for communication between computers and other digital devices, allowing them to interact with one another.
How is it similar to the decimal number system?
Both binary and decimal systems are positional numeral systems that use place value, where a digit's significance depends on its position. The decimal number system uses base-10 (0-9) while binary uses base-2 (0, 1). Both follow the same pattern of carrying over when a digit reaches its maximum value.
..