You are on page 1of 49

June 23,

Anonimouse
2018
Introduction to Basic Electronics
Basic Ohms Law
Voltage = Current * Resistance
Power Source
Resistors
Breadboard
Used for easy prototyping,
easy plug in and plug out of
connecting wires
Jumper Wires
Serves as the connecting
device/tool for devices
LEDs
Used for prototyping could be a
representation of something like
relay/motors/etc.
Series and Parallel Circuits
Activity 1: Using breadboard, Circuit and Parallel
Time: 3 mins
Introduction to Basic Programming
Data types
String = group of characters to form text or words Ex. “Hello World”
char = group of characters to form text or words Ex. ‘a’ , ‘b’
int = 16 bit number Ex. (range : −32,767, +32,767)
long = 32 bit number Ex. (range : −2,147,483,647, +2,147,483,647)
bool = can be true or false; 1 or 0
Data types
String = group of characters to form text or words Ex. “Hello World”
char = group of characters to form text or words Ex. ‘a’ , ‘b’
int = 16 bit number Ex. (range : −32,767, +32,767)
long = 32 bit number Ex. (range : −2,147,483,647, +2,147,483,647)
bool = can be true or false; 1 or 0
Introduction to Arduino
What is Arduino?
Is it the board? Is it a programming language?
What is Arduino?

Arduino is an open-source electronics platform based on easy-to-use


hardware and software. Arduino boards are able to read inputs - light
on a sensor, a finger on a button, or a Twitter message - and turn it into
an output - activating a motor, turning on an LED, publishing
something online. You can tell your board what to do by sending a set
of instructions to the microcontroller on the board. To do so you use
the Arduino programming language (based on Wiring), and the
Arduino Software (IDE), based on Processing.
Basic Parts of Arduino UNO
ARDUINO IDE PARTS
Mini Activity : Familiarize / running first
sketch ledbuiltin blink

setup and loop


Digital Pins
Can be pull down to GND or pull up to Vcc (Supply Voltage)
GND -> 0 or False
VCC -> 1 or True
Digital Pin as Output
Digital Pin as Input

Digital Pin as Input


PWM and Analog IN
Analog Write (Use same setup for digital Write change pin to
any pwm pin)
Analog read
Combining Analog Read and Write
Use same setup for
Read and write
Swap the photoresitor
And 10k ohms resistor
To potentiometer
Control Structures
IF
If (condition) {
Execute code here
}
else
{
Execute
}
Example
If (SensorValue < 400) {
DigitalWrite(LEDStreetLight, HIGH);
}
else
{
DigitalWrite(LEDStreetLight, LOW);
}

&& means AND ; || means OR


Example
If (AnalogInput < 400 || ManualButton == HIGH) {
DigitalWrite(LEDStreetLight, HIGH);
}
else
{
DigitalWrite(LEDStreetLight, LOW);
}

&& means AND ; || means or


FOR

For (initialization; condition ; command) {


Execute code until condition has met
}
FOR

For (value=0; value != 20 ; value++) {


MoveMotor();
}
WHILE

While(condition){
//do something till condition is satisfied
}
WHILE

While(PIRSensor has value){


Open lights; // ex. Starbucks CR
}
Switch
switch (RemoteHexValue) {
case 10EFBZ:
//do something when var equals 10EFBZ
break;
case BB3CE:
//do something when var equals BB3CE
break;
default:
// if nothing else matches, do the default
// default is optional
break;
}
Library Referencing
Water Break 15 mins
Communication Protocols
Serial
Serial Peripheral Interface
Inter-Intergrated Circuit
Activity using LCD Screen
Download Library
Use i2c Scanner
getAddress
Display something

You might also like