SlideShare a Scribd company logo
1 of 111
Download to read offline
Drawing is putting a line round an idea 
~Henri Matisse
Hacking is giving form to an idea
Hack to Learn
Hack to Communicate
Hack to Do
Hack to Do Think
How to Hack Electronics 
PLANNING-NESS 2014
Hi. I’m Robert Gallup
Agenda 
Mad Cap First Hacks 
Electricity + Electronics 
Hacking Switches + Knobs + Smart LEDs 
Project? 
Wrap Up
Feel Free to Wander
?
Your Hacker’s Kit E 
STEALTH CASE BREADBOARD RESISTOR LED 
SMART LED 
JUMPER WIRES BUTTON KNOB TRINKET
Microcontroller
Put the Trinket in the Breadboard >
Connect the Trinket to your Computer > 
Power Indicator Glowing at First
Download Software > 
http://www.robertgallup.com/download/planningness2014-mac.zip 
Unzip Arduino Software 
Note: There are also downloads for “-windows”, and “-linux”
Start Arduino
Mac OS X: Security Settings > 
1 2 3 4 
Open Preferences Unlock, and change 
“Allow apps …” to 
Anywhere 
Run IMPORTANT: Reset 
security settings
Configure the Software for Your Board >
Configure the Programmer >
Add the Planning-ness Examples > 
1 
2 Select planningness2014 in the Libraries folder 
from the class software download
If it works, … >
?
Load the LEDBlink Example >
The Sketch Window > 
Sketch (program)
Run the Sketch on your Trinket > 
1 2 
Press Reset 
Press the 
Run button 
LED glows
Wait. What?!
The “Blink” > 
Blinking
Sketch Structure (Recipe) E 
// 
S 
void 
setup() 
{ 
pinMode(1, 
OUTPUT); 
} 
! 
// 
Loop 
void 
loop() 
{ 
digitalWrite(1, 
HIGH); 
delay(500); 
digitalWrite(1, 
LOW); 
delay(500); 
} 
Comment 
Statements
Sketch Walkthrough (See the Comments) E 
// 
Setup 
runs 
once 
at 
the 
beginning 
void 
setup() 
{ 
pinMode(1, 
OUTPUT); 
// 
Pin 
#1 
is 
output 
} 
! 
// 
Loop 
runs 
over 
and 
over 
again 
forever 
void 
loop() 
{ 
digitalWrite(1, 
HIGH); 
// 
turn 
the 
LED 
on 
delay(1000); 
// 
wait 
for 
a 
second 
digitalWrite(1, 
LOW); 
// 
turn 
the 
LED 
off 
delay(1000); 
// 
wait 
for 
a 
second 
}
Hack 01: Change the Blinking Speed ( 
1. Change the blink speed 
Hint: edit the blink sketch to change the blink delay 
from 1 second to 1/4 second (note: 1 second = 
1000 milliseconds). Then run the sketch again. 
2. Stretch: Make a short on, longer off blink 
Hint: the delay times don’t have to be the same.
Your First Circuit E 
Jumper Wire 
LED 
Resistor
Wire Up an LED > 
USB 
#0 
#1 
#2 
5V 
BAT 
GND 
#4 
#3 
RST 
JUMPER WIRE
A Note about Breadboards E 
All of the contact points 
in the same row are 
connected 
The “rift” separates the two sides
Hack 02: An LED on Another Pin ( 
1. Rewire your hack to move the LED to Trinket pin #2. 
2. In the “blink” sketch, change the LED pin to match. 
Hint: You may have to change more than one line
Hack 02: A Solution ( 
// 
Setup 
runs 
once 
void 
setup() 
{ 
pinMode(2, 
OUTPUT); 
// 
Pin 
#2 
is 
output 
} 
! 
// 
Loop 
repeats 
forever 
void 
loop() 
{ 
digitalWrite(2, 
HIGH); 
// 
turn 
the 
LED 
on 
delay(1000); 
// 
wait 
for 
a 
second 
digitalWrite(2, 
LOW); 
// 
turn 
the 
LED 
off 
delay(1000); 
// 
wait 
for 
a 
second 
}
Hack 02: Another Way, “Variable” ( 
// 
Declarations 
int 
pinLED 
= 
2; 
! 
// 
Setup 
runs 
once 
at 
the 
beginning 
void 
setup() 
{ 
pinMode(pinLED, 
OUTPUT); 
// 
Pin 
is 
output 
} 
! 
// 
Loop 
runs 
over 
and 
over 
again 
forever 
void 
loop() 
{ 
digitalWrite(pinLED, 
HIGH); 
// 
turn 
the 
LED 
on 
delay(1000); 
// 
wait 
for 
a 
second 
digitalWrite(pinLED, 
LOW); 
// 
turn 
the 
LED 
off 
delay(1000); 
// 
wait 
for 
a 
second 
} 
Declare Variable 
pinLED = 2
Variable Declaration E 
int pinLED = 2; 
TYPE NAME VALUE
Libraries Make It Easier
Add the BobaBlox Library > 
1 
2 Select BobaBlox Folder from the class software download
Load and Run the LEDBlinkPinLibrary Example >
What’s Different About This Sketch? E 
// 
Include 
the 
library 
#include 
<BobaBlox.h> 
! 
// 
Declarations 
LED 
boardLED(1); 
// 
Declare 
an 
LED 
on 
pin 
#1 
! 
// 
Setup 
runs 
once 
at 
the 
beginning 
void 
setup() 
{ 
} 
! 
// 
Loop 
repeats 
forever. 
Use 
the 
“blink” 
method 
to 
blink 
boardLED 
void 
loop() 
{ 
boardLED.blink(); 
}
LED Variable Declaration E 
LED boardLED(1); 
TYPE NAME PIN
Using a Function (method) E 
boardLED.blink(); 
NAME METHOD NAME
Another Version of the Blink Method E 
boardLED.blink(1, 100); 
# TIMES 
DELAY
Hack 03: An LED on Another Pin ( 
1. Change the library Blink sketch to use an LED on pin #3 
Hint: You can add a 2nd LED, or move the LED you 
connected in the previous hack.
Hack 04: Fast Blink ( 
1. Change the library sketch to blink faster 
Hint: look at the example of the LED blink method that 
uses two parameters, times and delay.
Hack 05: Blink Morse Code ( 
1. Load and run the SOS sketch from planningness2014 
examples. 
Note: In Morse Code, “S” is dot-dot-dot, “O” is dash-dash- 
dash. 
2. Change the sketch so it blinks “CQ”. 
Hint: In Morse Code, “C” is dot-dash-dot-dash, “Q” is 
dash-dash-dot-dash. Note: “CQ” is a little like “YO” in 
the ham radio world.
For the Wanderer: Examples E
For the Wanderer: Reference E
?
Chips + Circuits
A Microcontroller E 
! 
! 
SENSORS 
microcontroller Input: temperature, motion, touch, … 
ACTUATORS 
Output: light, motor, sound, heat, … 
PROGRAM
E 
The Trinket Basic Connections (pinout) 
0 
1 
2 
+5V (Regulated) 
Digital I/O 
Ground 
4 
3 
LED (Pin 1) 
USB 
Reset Button 
ADAFRUIT Power LED 
TRINKET 
I/O Pins connect the 
microcontroller to 
power, sensors, and 
actuators.
Electronics
Electricity Starts with Electrons E 
Electrons are negative 
(but, nice) 
- 
-
Sometimes Electrons Mingle E 
In conductive 
materials, electrons are 
free to float 
- 
- 
- - 
- 
- 
- 
- -
Mix in Some Universal Forces E 
+ 
- 
Positive Negative 
Like Yin+Yang, 
or Good+Evil, 
one comes 
with the other
Electricity = Motivated Electrons E 
- 
- 
- 
- + - 
- - 
- - 
Electrons are attracted by a positive force
Voltage (volts) = How Motivated E 
- 
+ 
- 
- 
- 
-
Current (amps) = How Many E 
- 
- 
- 
- - 
- - 
- 
- + 
- - - 
- 
- 
- 
-
Volts Jolt! Current Kills!
Current flows positive to negative 
+ + 
+ 
+ 
+ 
+ - + 
+ 
+ 
+ 
+ 
+ + 
+ 
+ 
+ 
Actually, Current is a Little Twisted E
+ 
But, Not Without a Circuit
+ 
This is a Schematic, BTW
Circuits use Components
Component: Resistor E 
+ + 
+ 
+ ++ + + + + + 
HEAT 
VOLTAGE DROP
Component: LED (Light Emitting Diode) E 
CATHODE / - 
+ 
ANODE / + 
-
?
More Hacks
The Button (Digital Input) E
Component: Button (Switch) E 
CONNECTED 
1 
2 PIN GND 
PIN 
GND
Wiring Up a Single Button > 
USB 
#0 
#1 
#2 
5V 
BAT 
GND 
#4 
#3 
RST 
JUMPER WIRE 
JUMPER WIRE
Load / Run the ButtonLED Example E 
// 
Declarations 
LED 
boardLED(1); 
Button 
pushButton(2); 
int 
buttonState; 
! 
// 
Setup 
runs 
once 
at 
the 
beginning 
void 
setup() 
{ 
} 
! 
// 
Loop 
repeats 
forever 
void 
loop() 
{ 
// 
Read 
the 
switch. 
Set 
LED 
on/off 
according 
to 
button 
state 
buttonState 
= 
pushButton.isDown(); 
if 
(buttonState 
== 
1) 
{ 
boardLED.on(); 
} 
else 
{ 
boardLED.off(); 
} 
}
Pushbutton Variable Declaration E 
Button pushButton(1); 
TYPE NAME PIN
Pushbutton isDown Method E 
pushButton.isDown(); 
NAME METHOD NAME
Other Pushbutton Methods E 
pushButton.isDown(); 
pushButton.isUp(); 
pushButton.isPressed(); 
pushButton.isReleased();
Branching (One Thing or Another) E 
if 
(buttonState 
== 
1) 
{ 
boardLED.on(); 
} 
else 
{ 
boardLED.off(); 
}
The If statement (if/then/else) E 
if 
(condition) 
{ 
••• 
} 
else 
{ 
••• 
} 
if condition is true 
if condition is false 
conditions: 
(a == b) 
(a < b) 
(a > b) 
(a <= b) 
(a >= b) 
(a != b)
Hack 06: Reverse the Logic ( 
1. Reverse the logic in the buttonLED sketch. I.e. make 
the LED go OFF when the button is pressed. 
Hint: there are two ways to do this 
2. Stretch: make the LED blink when the button is 
pressed. 
Hint: what other LED functions do you have to work 
with?
The Knob (Analog Input) E
Component: Knob (Potentiometer) E 
+5V 
GND 
Analog Pin 
+5V GND 
Analog Pin
Analog to Digital Converter (ADC) E 
ADC 
0, 25, 100, 300, 100, 1023 
Voltage Values (0-1032)
E 
The Trinket: A More Complete Picture 
+5V (USB) 
0 
1 
2 
0 
1 
1 
Battery 
Ground 
4 
2 
3 3 
Digital I/O 
Analog Output 
Analog Input Reset 
+5V (Regulated) 
LED (Pin 1) 
USB 
Reset Button 
ADAFRUIT Power LED 
TRINKET
Wiring Up a Knob > 
USB 
#0 
#1 
#2 
5V 
BAT 
GND 
#4 
#3 
RST
Load / Run the knobDimLED Example E 
LED 
boardLED(1); 
Knob 
bluKnob(1); 
! 
int 
knobValue; 
int 
LEDBrightness; 
! 
void 
setup() 
{ 
} 
! 
void 
loop() 
{ 
// 
Check 
the 
knob 
value 
// 
Convert 
the 
knob 
value 
(0-­‐1023) 
to 
a 
brightness 
(0-­‐255). 
// 
Note: 
see 
the 
Map 
command 
in 
the 
reference 
knobValue 
= 
bluKnob.value(); 
LEDBrightness 
= 
map(knobValue, 
0, 
1023, 
0, 
255); 
boardLED.setBrightness(LEDBrightness); 
} 
.setBrightness() 
(see reference)
Knob Variable Declaration E 
Knob bluKnob(1); 
TYPE NAME PIN
Knob Value Method E 
bluKnob.value(); 
NAME METHOD NAME
Hack 07: Change Knob Direction ( 
1. Change the direction of the know. I.e. So the 
brightness goes down when the knob it turned up. 
2. Stretch: Change the blink speed with the knob 
position.
The Smart LED (Digital LED) E 
Unlike a standard LED, the Smart LED has a small processor inside that 
controls the light and communicates digitally with your microprocessor. They 
are also called NeoPixels. Generically, they are sometimes referred to by their 
“controller”, the WS2812 or WS2811.
Component: Smart LED (NeoPixel) E 
Digital In 
+5V 
GND 
Digital Out 
0 1 2 3 4 5 6 7 
Digital In 
Multiple of these LEDs can be “cascaded” from a 
singe pin on your micro process (but, you may 
need outside power).
Wiring Up a Smart LED (NeoPixel) > 
USB 
#0 
#1 
#2 
5V 
BAT 
GND 
#4 
#3 
RST
Hack 08: Hack the SmartPixel Example ( 
1. After wiring the SmartPixel up, load and run the 
SmartPixel sketch. 
2. Change the rate the colors change in the sketch 
3. The sketch currently uses red, green, and blue as it’s 
colors. Change to three different colors 
Hint: look at the comments to figure out the parameters 
for the setPixelColor() method.
Hack 09: Hack the SmartPixelRainbow Sketch ( 
1. Load and run the SmartPixelRainbow sketch. 
2. Change the rate the colors change in the sketch. 
Hint: You can guess what to do (perfectly respectable), or 
look at the complicated code in the NeoPixelFunctions tab 
for a clue.
Hack 10: More Smart LED Hacks ( 
1. BIG STRETCH: See if you can figure out how to control 
the rainbow color with a knob. 
Hint: look at the setPixelColor() and wheel() methods. 
2. GIANT STRETCH: See you can cooperate with some of 
your table-mates and connect several smart LEDs 
together. Hint: one of the parameters when you declare 
the LED variable, is the number of LEDs in the strip.
?
Wax On. Wax Off.
LEDs
Buttons
Knobs (potentiometers)
Smart LED
Team Project
Hack 99: Hack Digital Personality ( 
1. Team up and use everything you’ve learned to design a 
switch with a personality. Hint: use two LEDs and a switch. 
pressing the switch turns one of the LEDs on/off. The other 
LED flashes in some way with personality to indicate 
whether you’ve been successful. Note: could you use a knob 
as the switch? 
2. Do anything else you want to try as an individual. Or, as a 
team.
Wrap Up
Many Other Platforms E 
Arduino RPi BeagleBone 
spark.io 
pinocc.io 
teensy
Add-On Boards (Shields) E
Next Steps: Online Tutorials E 
http://arduino.cc/en/Tutorial 
http://playground.arduino.cc 
https://learn.sparkfun.com 
! 
http://learn.adafruit.com 
http://learn.adafruit.com/category/learn-arduino 
! 
! 
google “arduino tutorials”
Next Steps: Arduino Comic E 
http://www.jodyculkin.com/wp-content/uploads/2011/09/arduino-comic-latest3.pdf
Online Resources E 
ARDUINO: www.arduino.cc, reference, tutorials 
SPARKFUN: www.sparkfun.com, components, devices, tutorials 
ADAFRUIT: www.adafruit.com, components, devices, tutorials 
MAKE MAGAZINE: www.makezine.com, magazine, books, stuff 
MAKER SHED: www.makershed.com, components, kits, stuff 
INSTRUCTABLES: www.instructables.com, tutorials 
RADIO SHACK: www.radioshack.com, components, devices, tutorials 
AMAZON: www.amazon.com, books, components, devices, tutorials 
O’REILLY: www.oreilly.com, books, tutorials, etc. 
ELECTRONIC GOLDMINE: http://www.goldmine-elec-products.com, components 
JAMECO: www.jameco.com, components 
MOUSER: www.mouser.com, components 
DIGIKEY: www.digikey.com, components 
!
Thank You!
Robert Gallup bob@xobxob.com @robertgallup

More Related Content

What's hot

SDL2 Game Development VT Code Camp 2013
SDL2 Game Development VT Code Camp 2013SDL2 Game Development VT Code Camp 2013
SDL2 Game Development VT Code Camp 2013Eric Basile
 
Arduino slides
Arduino slidesArduino slides
Arduino slidessdcharle
 
Arduino Full Tutorial
Arduino Full TutorialArduino Full Tutorial
Arduino Full TutorialAkshay Sharma
 
Wii Nunchuk for Arduino
Wii Nunchuk for ArduinoWii Nunchuk for Arduino
Wii Nunchuk for Arduinohandson28
 
Mom presentation_monday_arduino in the physics lab
Mom presentation_monday_arduino in the physics labMom presentation_monday_arduino in the physics lab
Mom presentation_monday_arduino in the physics labAnnamaria Lisotti
 
Introduction to Arduino with ArduBlock & SparkFun LilyPad
Introduction to Arduino with ArduBlock & SparkFun LilyPadIntroduction to Arduino with ArduBlock & SparkFun LilyPad
Introduction to Arduino with ArduBlock & SparkFun LilyPadBrian Huang
 
How to Program SmartThings
How to Program SmartThingsHow to Program SmartThings
How to Program SmartThingsJanet Huang
 
IOTC08 The Arduino Platform
IOTC08 The Arduino PlatformIOTC08 The Arduino Platform
IOTC08 The Arduino PlatformEoin Brazil
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduinoAhmed Sakr
 
Arduino experimenters guide hq
Arduino experimenters guide hqArduino experimenters guide hq
Arduino experimenters guide hqAndreis Santos
 
Html5 game, websocket e arduino
Html5 game, websocket e arduinoHtml5 game, websocket e arduino
Html5 game, websocket e arduinomonksoftwareit
 
Getting Real With Connected Devices Presentation
Getting Real With Connected Devices PresentationGetting Real With Connected Devices Presentation
Getting Real With Connected Devices Presentationsebastienjouhans
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduinoyeokm1
 
Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixelssdcharle
 

What's hot (20)

SDL2 Game Development VT Code Camp 2013
SDL2 Game Development VT Code Camp 2013SDL2 Game Development VT Code Camp 2013
SDL2 Game Development VT Code Camp 2013
 
Arduino slides
Arduino slidesArduino slides
Arduino slides
 
Arduino Full Tutorial
Arduino Full TutorialArduino Full Tutorial
Arduino Full Tutorial
 
Wii Nunchuk for Arduino
Wii Nunchuk for ArduinoWii Nunchuk for Arduino
Wii Nunchuk for Arduino
 
Mom presentation_monday_arduino in the physics lab
Mom presentation_monday_arduino in the physics labMom presentation_monday_arduino in the physics lab
Mom presentation_monday_arduino in the physics lab
 
Introduction to Arduino with ArduBlock & SparkFun LilyPad
Introduction to Arduino with ArduBlock & SparkFun LilyPadIntroduction to Arduino with ArduBlock & SparkFun LilyPad
Introduction to Arduino with ArduBlock & SparkFun LilyPad
 
Arduino
ArduinoArduino
Arduino
 
Arduino programming
Arduino programmingArduino programming
Arduino programming
 
Practicas con arduino
Practicas con arduinoPracticas con arduino
Practicas con arduino
 
How to Program SmartThings
How to Program SmartThingsHow to Program SmartThings
How to Program SmartThings
 
IOTC08 The Arduino Platform
IOTC08 The Arduino PlatformIOTC08 The Arduino Platform
IOTC08 The Arduino Platform
 
Programming arduino makeymakey
Programming arduino makeymakeyProgramming arduino makeymakey
Programming arduino makeymakey
 
Arduino based applications part 2
Arduino based applications part 2Arduino based applications part 2
Arduino based applications part 2
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
 
Arduino experimenters guide hq
Arduino experimenters guide hqArduino experimenters guide hq
Arduino experimenters guide hq
 
Html5 game, websocket e arduino
Html5 game, websocket e arduinoHtml5 game, websocket e arduino
Html5 game, websocket e arduino
 
Getting Real With Connected Devices Presentation
Getting Real With Connected Devices PresentationGetting Real With Connected Devices Presentation
Getting Real With Connected Devices Presentation
 
Lab2ppt
Lab2pptLab2ppt
Lab2ppt
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixels
 

Similar to How to hack electronics

Electronz_Chapter_2.pptx
Electronz_Chapter_2.pptxElectronz_Chapter_2.pptx
Electronz_Chapter_2.pptxMokete5
 
Arduino - CH 1: The Trick Switch
Arduino - CH 1: The Trick SwitchArduino - CH 1: The Trick Switch
Arduino - CH 1: The Trick SwitchRatzman III
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshopJonah Marrs
 
LED Cube Presentation Slides
LED Cube Presentation Slides LED Cube Presentation Slides
LED Cube Presentation Slides Projects EC
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptxHebaEng
 
Arduino: Arduino para dummies 2 edición por Wiley Brand parte 2
Arduino: Arduino para dummies 2 edición por Wiley Brand parte 2Arduino: Arduino para dummies 2 edición por Wiley Brand parte 2
Arduino: Arduino para dummies 2 edición por Wiley Brand parte 2SANTIAGO PABLO ALBERTO
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshopatuline
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.pptZainIslam20
 
Arduino - Ch 2: Sunrise-Sunset Light Switch
Arduino - Ch 2: Sunrise-Sunset Light SwitchArduino - Ch 2: Sunrise-Sunset Light Switch
Arduino - Ch 2: Sunrise-Sunset Light SwitchRatzman III
 
Arduino Boot Camp Pitch Slides
Arduino Boot Camp Pitch SlidesArduino Boot Camp Pitch Slides
Arduino Boot Camp Pitch SlidesMithi Sevilla
 
LEDs and DIPs Switches
LEDs and DIPs SwitchesLEDs and DIPs Switches
LEDs and DIPs SwitchesBach Nguyen
 
Arduino electronics cookbook
Arduino electronics cookbookArduino electronics cookbook
Arduino electronics cookbookFelipe Belarmino
 
Arduino_UNO _tutorial_For_Beginners.pptx
Arduino_UNO _tutorial_For_Beginners.pptxArduino_UNO _tutorial_For_Beginners.pptx
Arduino_UNO _tutorial_For_Beginners.pptxANIKDUTTA25
 
Hello Arduino.
Hello Arduino.Hello Arduino.
Hello Arduino.mkontopo
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalTony Olsson.
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalTony Olsson.
 

Similar to How to hack electronics (20)

Electronz_Chapter_2.pptx
Electronz_Chapter_2.pptxElectronz_Chapter_2.pptx
Electronz_Chapter_2.pptx
 
Arduino - CH 1: The Trick Switch
Arduino - CH 1: The Trick SwitchArduino - CH 1: The Trick Switch
Arduino - CH 1: The Trick Switch
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshop
 
publish manual
publish manualpublish manual
publish manual
 
LED Cube Presentation Slides
LED Cube Presentation Slides LED Cube Presentation Slides
LED Cube Presentation Slides
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
 
Arduino: Arduino para dummies 2 edición por Wiley Brand parte 2
Arduino: Arduino para dummies 2 edición por Wiley Brand parte 2Arduino: Arduino para dummies 2 edición por Wiley Brand parte 2
Arduino: Arduino para dummies 2 edición por Wiley Brand parte 2
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshop
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 
Arduino - Ch 2: Sunrise-Sunset Light Switch
Arduino - Ch 2: Sunrise-Sunset Light SwitchArduino - Ch 2: Sunrise-Sunset Light Switch
Arduino - Ch 2: Sunrise-Sunset Light Switch
 
Bidirect visitor counter
Bidirect visitor counterBidirect visitor counter
Bidirect visitor counter
 
Arduino Boot Camp Pitch Slides
Arduino Boot Camp Pitch SlidesArduino Boot Camp Pitch Slides
Arduino Boot Camp Pitch Slides
 
LEDs and DIPs Switches
LEDs and DIPs SwitchesLEDs and DIPs Switches
LEDs and DIPs Switches
 
Arduino electronics cookbook
Arduino electronics cookbookArduino electronics cookbook
Arduino electronics cookbook
 
Arduino_UNO _tutorial_For_Beginners.pptx
Arduino_UNO _tutorial_For_Beginners.pptxArduino_UNO _tutorial_For_Beginners.pptx
Arduino_UNO _tutorial_For_Beginners.pptx
 
Hello Arduino.
Hello Arduino.Hello Arduino.
Hello Arduino.
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
 

More from Planning-ness

How to transform limitations into advantages
How to transform limitations into advantages How to transform limitations into advantages
How to transform limitations into advantages Planning-ness
 
How to build relevant brand experiences in this digital era
How to build relevant brand experiences in this digital eraHow to build relevant brand experiences in this digital era
How to build relevant brand experiences in this digital eraPlanning-ness
 
How to get the most out of mobile marketing technology
How to get the most out of mobile marketing technologyHow to get the most out of mobile marketing technology
How to get the most out of mobile marketing technologyPlanning-ness
 
The Neural Basis for Creativity
The Neural Basis for CreativityThe Neural Basis for Creativity
The Neural Basis for CreativityPlanning-ness
 
The Cultural Muscle Index
The Cultural Muscle Index The Cultural Muscle Index
The Cultural Muscle Index Planning-ness
 
How to be courageous
How to be courageousHow to be courageous
How to be courageousPlanning-ness
 
How to grow your startup
How to grow your startupHow to grow your startup
How to grow your startupPlanning-ness
 
How to raise venture capital
How to raise venture capitalHow to raise venture capital
How to raise venture capitalPlanning-ness
 
How to make the ordinary extraordinary
How to make the ordinary extraordinary How to make the ordinary extraordinary
How to make the ordinary extraordinary Planning-ness
 
How to maximize flow (and be happier, more creative, and have way less brain ...
How to maximize flow (and be happier, more creative, and have way less brain ...How to maximize flow (and be happier, more creative, and have way less brain ...
How to maximize flow (and be happier, more creative, and have way less brain ...Planning-ness
 
Social TV: How to create connected media experiences
Social TV: How to create connected media experiencesSocial TV: How to create connected media experiences
Social TV: How to create connected media experiencesPlanning-ness
 
How to make better decisions
How to make better decisionsHow to make better decisions
How to make better decisionsPlanning-ness
 
How does content really spread?
How does content really spread? How does content really spread?
How does content really spread? Planning-ness
 
How to create better connections by understanding the brain
How to create better connections by understanding the brainHow to create better connections by understanding the brain
How to create better connections by understanding the brainPlanning-ness
 
The Future of Advertising: Death of Advertising
The Future of Advertising: Death of Advertising The Future of Advertising: Death of Advertising
The Future of Advertising: Death of Advertising Planning-ness
 
How to research (curiously) v2
How to research (curiously) v2How to research (curiously) v2
How to research (curiously) v2Planning-ness
 
Amanda Parkes - Planning-ness 2012
Amanda Parkes  - Planning-ness 2012Amanda Parkes  - Planning-ness 2012
Amanda Parkes - Planning-ness 2012Planning-ness
 
How to measure influence in social networks
How to measure influence in social networksHow to measure influence in social networks
How to measure influence in social networksPlanning-ness
 

More from Planning-ness (20)

How to transform limitations into advantages
How to transform limitations into advantages How to transform limitations into advantages
How to transform limitations into advantages
 
How to build relevant brand experiences in this digital era
How to build relevant brand experiences in this digital eraHow to build relevant brand experiences in this digital era
How to build relevant brand experiences in this digital era
 
How to negotiate
How to negotiateHow to negotiate
How to negotiate
 
How to get the most out of mobile marketing technology
How to get the most out of mobile marketing technologyHow to get the most out of mobile marketing technology
How to get the most out of mobile marketing technology
 
The Neural Basis for Creativity
The Neural Basis for CreativityThe Neural Basis for Creativity
The Neural Basis for Creativity
 
The Cultural Muscle Index
The Cultural Muscle Index The Cultural Muscle Index
The Cultural Muscle Index
 
How to be courageous
How to be courageousHow to be courageous
How to be courageous
 
How not to see
How not to seeHow not to see
How not to see
 
How to grow your startup
How to grow your startupHow to grow your startup
How to grow your startup
 
How to raise venture capital
How to raise venture capitalHow to raise venture capital
How to raise venture capital
 
How to make the ordinary extraordinary
How to make the ordinary extraordinary How to make the ordinary extraordinary
How to make the ordinary extraordinary
 
How to maximize flow (and be happier, more creative, and have way less brain ...
How to maximize flow (and be happier, more creative, and have way less brain ...How to maximize flow (and be happier, more creative, and have way less brain ...
How to maximize flow (and be happier, more creative, and have way less brain ...
 
Social TV: How to create connected media experiences
Social TV: How to create connected media experiencesSocial TV: How to create connected media experiences
Social TV: How to create connected media experiences
 
How to make better decisions
How to make better decisionsHow to make better decisions
How to make better decisions
 
How does content really spread?
How does content really spread? How does content really spread?
How does content really spread?
 
How to create better connections by understanding the brain
How to create better connections by understanding the brainHow to create better connections by understanding the brain
How to create better connections by understanding the brain
 
The Future of Advertising: Death of Advertising
The Future of Advertising: Death of Advertising The Future of Advertising: Death of Advertising
The Future of Advertising: Death of Advertising
 
How to research (curiously) v2
How to research (curiously) v2How to research (curiously) v2
How to research (curiously) v2
 
Amanda Parkes - Planning-ness 2012
Amanda Parkes  - Planning-ness 2012Amanda Parkes  - Planning-ness 2012
Amanda Parkes - Planning-ness 2012
 
How to measure influence in social networks
How to measure influence in social networksHow to measure influence in social networks
How to measure influence in social networks
 

Recently uploaded

Point of Care Testing in clinical laboratory
Point of Care Testing in clinical laboratoryPoint of Care Testing in clinical laboratory
Point of Care Testing in clinical laboratoryoyebolasonuga14
 
一比一定(购)国立南方理工学院毕业证(Southern毕业证)成绩单学位证
一比一定(购)国立南方理工学院毕业证(Southern毕业证)成绩单学位证一比一定(购)国立南方理工学院毕业证(Southern毕业证)成绩单学位证
一比一定(购)国立南方理工学院毕业证(Southern毕业证)成绩单学位证wpkuukw
 
在线制作(ANU毕业证书)澳大利亚国立大学毕业证成绩单原版一比一
在线制作(ANU毕业证书)澳大利亚国立大学毕业证成绩单原版一比一在线制作(ANU毕业证书)澳大利亚国立大学毕业证成绩单原版一比一
在线制作(ANU毕业证书)澳大利亚国立大学毕业证成绩单原版一比一ougvy
 
Low Cost Patna Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Gi...
Low Cost Patna Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Gi...Low Cost Patna Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Gi...
Low Cost Patna Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Gi...vershagrag
 
一比一定(购)坎特伯雷大学毕业证(UC毕业证)成绩单学位证
一比一定(购)坎特伯雷大学毕业证(UC毕业证)成绩单学位证一比一定(购)坎特伯雷大学毕业证(UC毕业证)成绩单学位证
一比一定(购)坎特伯雷大学毕业证(UC毕业证)成绩单学位证wpkuukw
 
Vashi Affordable Call Girls ,07506202331,Vasai Virar Charming Call Girl
Vashi Affordable Call Girls ,07506202331,Vasai Virar Charming Call GirlVashi Affordable Call Girls ,07506202331,Vasai Virar Charming Call Girl
Vashi Affordable Call Girls ,07506202331,Vasai Virar Charming Call GirlPriya Reddy
 
Top profile Call Girls In Ratlam [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Ratlam [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Ratlam [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Ratlam [ 7014168258 ] Call Me For Genuine Models We...nirzagarg
 
怎样办理阿德莱德大学毕业证(Adelaide毕业证书)成绩单留信认证
怎样办理阿德莱德大学毕业证(Adelaide毕业证书)成绩单留信认证怎样办理阿德莱德大学毕业证(Adelaide毕业证书)成绩单留信认证
怎样办理阿德莱德大学毕业证(Adelaide毕业证书)成绩单留信认证ehyxf
 
一比一原版(CSUEB毕业证书)东湾分校毕业证原件一模一样
一比一原版(CSUEB毕业证书)东湾分校毕业证原件一模一样一比一原版(CSUEB毕业证书)东湾分校毕业证原件一模一样
一比一原版(CSUEB毕业证书)东湾分校毕业证原件一模一样ayoqf
 
在线办理(scu毕业证)南十字星大学毕业证电子版学位证书注册证明信
在线办理(scu毕业证)南十字星大学毕业证电子版学位证书注册证明信在线办理(scu毕业证)南十字星大学毕业证电子版学位证书注册证明信
在线办理(scu毕业证)南十字星大学毕业证电子版学位证书注册证明信oopacde
 
Call Girls Amethi 9332606886 HOT & SEXY Models beautiful and charming call g...
Call Girls Amethi  9332606886 HOT & SEXY Models beautiful and charming call g...Call Girls Amethi  9332606886 HOT & SEXY Models beautiful and charming call g...
Call Girls Amethi 9332606886 HOT & SEXY Models beautiful and charming call g...Sareena Khatun
 
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...drmarathore
 
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证ehyxf
 
Top profile Call Girls In Udgir [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Udgir [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Udgir [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Udgir [ 7014168258 ] Call Me For Genuine Models We ...gajnagarg
 
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...gajnagarg
 
怎样办理伍伦贡大学毕业证(UOW毕业证书)成绩单留信认证
怎样办理伍伦贡大学毕业证(UOW毕业证书)成绩单留信认证怎样办理伍伦贡大学毕业证(UOW毕业证书)成绩单留信认证
怎样办理伍伦贡大学毕业证(UOW毕业证书)成绩单留信认证ehyxf
 
在线制作(UQ毕业证书)昆士兰大学毕业证成绩单原版一比一
在线制作(UQ毕业证书)昆士兰大学毕业证成绩单原版一比一在线制作(UQ毕业证书)昆士兰大学毕业证成绩单原版一比一
在线制作(UQ毕业证书)昆士兰大学毕业证成绩单原版一比一uodye
 

Recently uploaded (20)

Point of Care Testing in clinical laboratory
Point of Care Testing in clinical laboratoryPoint of Care Testing in clinical laboratory
Point of Care Testing in clinical laboratory
 
一比一定(购)国立南方理工学院毕业证(Southern毕业证)成绩单学位证
一比一定(购)国立南方理工学院毕业证(Southern毕业证)成绩单学位证一比一定(购)国立南方理工学院毕业证(Southern毕业证)成绩单学位证
一比一定(购)国立南方理工学院毕业证(Southern毕业证)成绩单学位证
 
在线制作(ANU毕业证书)澳大利亚国立大学毕业证成绩单原版一比一
在线制作(ANU毕业证书)澳大利亚国立大学毕业证成绩单原版一比一在线制作(ANU毕业证书)澳大利亚国立大学毕业证成绩单原版一比一
在线制作(ANU毕业证书)澳大利亚国立大学毕业证成绩单原版一比一
 
In Riyadh Saudi Arabia |+966572737505 | Buy Cytotec| Get Abortion pills
In Riyadh Saudi Arabia |+966572737505 | Buy Cytotec| Get Abortion pillsIn Riyadh Saudi Arabia |+966572737505 | Buy Cytotec| Get Abortion pills
In Riyadh Saudi Arabia |+966572737505 | Buy Cytotec| Get Abortion pills
 
Low Cost Patna Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Gi...
Low Cost Patna Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Gi...Low Cost Patna Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Gi...
Low Cost Patna Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Gi...
 
一比一定(购)坎特伯雷大学毕业证(UC毕业证)成绩单学位证
一比一定(购)坎特伯雷大学毕业证(UC毕业证)成绩单学位证一比一定(购)坎特伯雷大学毕业证(UC毕业证)成绩单学位证
一比一定(购)坎特伯雷大学毕业证(UC毕业证)成绩单学位证
 
Vashi Affordable Call Girls ,07506202331,Vasai Virar Charming Call Girl
Vashi Affordable Call Girls ,07506202331,Vasai Virar Charming Call GirlVashi Affordable Call Girls ,07506202331,Vasai Virar Charming Call Girl
Vashi Affordable Call Girls ,07506202331,Vasai Virar Charming Call Girl
 
Top profile Call Girls In Ratlam [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Ratlam [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Ratlam [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Ratlam [ 7014168258 ] Call Me For Genuine Models We...
 
怎样办理阿德莱德大学毕业证(Adelaide毕业证书)成绩单留信认证
怎样办理阿德莱德大学毕业证(Adelaide毕业证书)成绩单留信认证怎样办理阿德莱德大学毕业证(Adelaide毕业证书)成绩单留信认证
怎样办理阿德莱德大学毕业证(Adelaide毕业证书)成绩单留信认证
 
一比一原版(CSUEB毕业证书)东湾分校毕业证原件一模一样
一比一原版(CSUEB毕业证书)东湾分校毕业证原件一模一样一比一原版(CSUEB毕业证书)东湾分校毕业证原件一模一样
一比一原版(CSUEB毕业证书)东湾分校毕业证原件一模一样
 
在线办理(scu毕业证)南十字星大学毕业证电子版学位证书注册证明信
在线办理(scu毕业证)南十字星大学毕业证电子版学位证书注册证明信在线办理(scu毕业证)南十字星大学毕业证电子版学位证书注册证明信
在线办理(scu毕业证)南十字星大学毕业证电子版学位证书注册证明信
 
Critical Commentary Social Work Ethics.pptx
Critical Commentary Social Work Ethics.pptxCritical Commentary Social Work Ethics.pptx
Critical Commentary Social Work Ethics.pptx
 
Call Girls Amethi 9332606886 HOT & SEXY Models beautiful and charming call g...
Call Girls Amethi  9332606886 HOT & SEXY Models beautiful and charming call g...Call Girls Amethi  9332606886 HOT & SEXY Models beautiful and charming call g...
Call Girls Amethi 9332606886 HOT & SEXY Models beautiful and charming call g...
 
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
Abort pregnancy in research centre+966_505195917 abortion pills in Kuwait cyt...
 
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
怎样办理圣芭芭拉分校毕业证(UCSB毕业证书)成绩单留信认证
 
Top profile Call Girls In Udgir [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Udgir [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Udgir [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Udgir [ 7014168258 ] Call Me For Genuine Models We ...
 
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Palghar [ 7014168258 ] Call Me For Genuine Models W...
 
怎样办理伍伦贡大学毕业证(UOW毕业证书)成绩单留信认证
怎样办理伍伦贡大学毕业证(UOW毕业证书)成绩单留信认证怎样办理伍伦贡大学毕业证(UOW毕业证书)成绩单留信认证
怎样办理伍伦贡大学毕业证(UOW毕业证书)成绩单留信认证
 
Abortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Jeddah |+966572737505 | Get CytotecAbortion pills in Jeddah |+966572737505 | Get Cytotec
Abortion pills in Jeddah |+966572737505 | Get Cytotec
 
在线制作(UQ毕业证书)昆士兰大学毕业证成绩单原版一比一
在线制作(UQ毕业证书)昆士兰大学毕业证成绩单原版一比一在线制作(UQ毕业证书)昆士兰大学毕业证成绩单原版一比一
在线制作(UQ毕业证书)昆士兰大学毕业证成绩单原版一比一
 

How to hack electronics

  • 1. Drawing is putting a line round an idea ~Henri Matisse
  • 2. Hacking is giving form to an idea
  • 6. Hack to Do Think
  • 7. How to Hack Electronics PLANNING-NESS 2014
  • 9. Agenda Mad Cap First Hacks Electricity + Electronics Hacking Switches + Knobs + Smart LEDs Project? Wrap Up
  • 10. Feel Free to Wander
  • 11. ?
  • 12. Your Hacker’s Kit E STEALTH CASE BREADBOARD RESISTOR LED SMART LED JUMPER WIRES BUTTON KNOB TRINKET
  • 14. Put the Trinket in the Breadboard >
  • 15. Connect the Trinket to your Computer > Power Indicator Glowing at First
  • 16. Download Software > http://www.robertgallup.com/download/planningness2014-mac.zip Unzip Arduino Software Note: There are also downloads for “-windows”, and “-linux”
  • 18. Mac OS X: Security Settings > 1 2 3 4 Open Preferences Unlock, and change “Allow apps …” to Anywhere Run IMPORTANT: Reset security settings
  • 19. Configure the Software for Your Board >
  • 21. Add the Planning-ness Examples > 1 2 Select planningness2014 in the Libraries folder from the class software download
  • 22. If it works, … >
  • 23. ?
  • 24. Load the LEDBlink Example >
  • 25. The Sketch Window > Sketch (program)
  • 26. Run the Sketch on your Trinket > 1 2 Press Reset Press the Run button LED glows
  • 28. The “Blink” > Blinking
  • 29. Sketch Structure (Recipe) E // S void setup() { pinMode(1, OUTPUT); } ! // Loop void loop() { digitalWrite(1, HIGH); delay(500); digitalWrite(1, LOW); delay(500); } Comment Statements
  • 30. Sketch Walkthrough (See the Comments) E // Setup runs once at the beginning void setup() { pinMode(1, OUTPUT); // Pin #1 is output } ! // Loop runs over and over again forever void loop() { digitalWrite(1, HIGH); // turn the LED on delay(1000); // wait for a second digitalWrite(1, LOW); // turn the LED off delay(1000); // wait for a second }
  • 31. Hack 01: Change the Blinking Speed ( 1. Change the blink speed Hint: edit the blink sketch to change the blink delay from 1 second to 1/4 second (note: 1 second = 1000 milliseconds). Then run the sketch again. 2. Stretch: Make a short on, longer off blink Hint: the delay times don’t have to be the same.
  • 32. Your First Circuit E Jumper Wire LED Resistor
  • 33. Wire Up an LED > USB #0 #1 #2 5V BAT GND #4 #3 RST JUMPER WIRE
  • 34. A Note about Breadboards E All of the contact points in the same row are connected The “rift” separates the two sides
  • 35. Hack 02: An LED on Another Pin ( 1. Rewire your hack to move the LED to Trinket pin #2. 2. In the “blink” sketch, change the LED pin to match. Hint: You may have to change more than one line
  • 36. Hack 02: A Solution ( // Setup runs once void setup() { pinMode(2, OUTPUT); // Pin #2 is output } ! // Loop repeats forever void loop() { digitalWrite(2, HIGH); // turn the LED on delay(1000); // wait for a second digitalWrite(2, LOW); // turn the LED off delay(1000); // wait for a second }
  • 37. Hack 02: Another Way, “Variable” ( // Declarations int pinLED = 2; ! // Setup runs once at the beginning void setup() { pinMode(pinLED, OUTPUT); // Pin is output } ! // Loop runs over and over again forever void loop() { digitalWrite(pinLED, HIGH); // turn the LED on delay(1000); // wait for a second digitalWrite(pinLED, LOW); // turn the LED off delay(1000); // wait for a second } Declare Variable pinLED = 2
  • 38. Variable Declaration E int pinLED = 2; TYPE NAME VALUE
  • 40. Add the BobaBlox Library > 1 2 Select BobaBlox Folder from the class software download
  • 41. Load and Run the LEDBlinkPinLibrary Example >
  • 42. What’s Different About This Sketch? E // Include the library #include <BobaBlox.h> ! // Declarations LED boardLED(1); // Declare an LED on pin #1 ! // Setup runs once at the beginning void setup() { } ! // Loop repeats forever. Use the “blink” method to blink boardLED void loop() { boardLED.blink(); }
  • 43. LED Variable Declaration E LED boardLED(1); TYPE NAME PIN
  • 44. Using a Function (method) E boardLED.blink(); NAME METHOD NAME
  • 45. Another Version of the Blink Method E boardLED.blink(1, 100); # TIMES DELAY
  • 46. Hack 03: An LED on Another Pin ( 1. Change the library Blink sketch to use an LED on pin #3 Hint: You can add a 2nd LED, or move the LED you connected in the previous hack.
  • 47. Hack 04: Fast Blink ( 1. Change the library sketch to blink faster Hint: look at the example of the LED blink method that uses two parameters, times and delay.
  • 48. Hack 05: Blink Morse Code ( 1. Load and run the SOS sketch from planningness2014 examples. Note: In Morse Code, “S” is dot-dot-dot, “O” is dash-dash- dash. 2. Change the sketch so it blinks “CQ”. Hint: In Morse Code, “C” is dot-dash-dot-dash, “Q” is dash-dash-dot-dash. Note: “CQ” is a little like “YO” in the ham radio world.
  • 49. For the Wanderer: Examples E
  • 50. For the Wanderer: Reference E
  • 51. ?
  • 53. A Microcontroller E ! ! SENSORS microcontroller Input: temperature, motion, touch, … ACTUATORS Output: light, motor, sound, heat, … PROGRAM
  • 54. E The Trinket Basic Connections (pinout) 0 1 2 +5V (Regulated) Digital I/O Ground 4 3 LED (Pin 1) USB Reset Button ADAFRUIT Power LED TRINKET I/O Pins connect the microcontroller to power, sensors, and actuators.
  • 56. Electricity Starts with Electrons E Electrons are negative (but, nice) - -
  • 57. Sometimes Electrons Mingle E In conductive materials, electrons are free to float - - - - - - - - -
  • 58. Mix in Some Universal Forces E + - Positive Negative Like Yin+Yang, or Good+Evil, one comes with the other
  • 59. Electricity = Motivated Electrons E - - - - + - - - - - Electrons are attracted by a positive force
  • 60. Voltage (volts) = How Motivated E - + - - - -
  • 61. Current (amps) = How Many E - - - - - - - - - + - - - - - - -
  • 63. Current flows positive to negative + + + + + + - + + + + + + + + + + Actually, Current is a Little Twisted E
  • 64. + But, Not Without a Circuit
  • 65. + This is a Schematic, BTW
  • 67. Component: Resistor E + + + + ++ + + + + + HEAT VOLTAGE DROP
  • 68. Component: LED (Light Emitting Diode) E CATHODE / - + ANODE / + -
  • 69. ?
  • 72. Component: Button (Switch) E CONNECTED 1 2 PIN GND PIN GND
  • 73. Wiring Up a Single Button > USB #0 #1 #2 5V BAT GND #4 #3 RST JUMPER WIRE JUMPER WIRE
  • 74. Load / Run the ButtonLED Example E // Declarations LED boardLED(1); Button pushButton(2); int buttonState; ! // Setup runs once at the beginning void setup() { } ! // Loop repeats forever void loop() { // Read the switch. Set LED on/off according to button state buttonState = pushButton.isDown(); if (buttonState == 1) { boardLED.on(); } else { boardLED.off(); } }
  • 75. Pushbutton Variable Declaration E Button pushButton(1); TYPE NAME PIN
  • 76. Pushbutton isDown Method E pushButton.isDown(); NAME METHOD NAME
  • 77. Other Pushbutton Methods E pushButton.isDown(); pushButton.isUp(); pushButton.isPressed(); pushButton.isReleased();
  • 78. Branching (One Thing or Another) E if (buttonState == 1) { boardLED.on(); } else { boardLED.off(); }
  • 79. The If statement (if/then/else) E if (condition) { ••• } else { ••• } if condition is true if condition is false conditions: (a == b) (a < b) (a > b) (a <= b) (a >= b) (a != b)
  • 80. Hack 06: Reverse the Logic ( 1. Reverse the logic in the buttonLED sketch. I.e. make the LED go OFF when the button is pressed. Hint: there are two ways to do this 2. Stretch: make the LED blink when the button is pressed. Hint: what other LED functions do you have to work with?
  • 81. The Knob (Analog Input) E
  • 82. Component: Knob (Potentiometer) E +5V GND Analog Pin +5V GND Analog Pin
  • 83. Analog to Digital Converter (ADC) E ADC 0, 25, 100, 300, 100, 1023 Voltage Values (0-1032)
  • 84. E The Trinket: A More Complete Picture +5V (USB) 0 1 2 0 1 1 Battery Ground 4 2 3 3 Digital I/O Analog Output Analog Input Reset +5V (Regulated) LED (Pin 1) USB Reset Button ADAFRUIT Power LED TRINKET
  • 85. Wiring Up a Knob > USB #0 #1 #2 5V BAT GND #4 #3 RST
  • 86. Load / Run the knobDimLED Example E LED boardLED(1); Knob bluKnob(1); ! int knobValue; int LEDBrightness; ! void setup() { } ! void loop() { // Check the knob value // Convert the knob value (0-­‐1023) to a brightness (0-­‐255). // Note: see the Map command in the reference knobValue = bluKnob.value(); LEDBrightness = map(knobValue, 0, 1023, 0, 255); boardLED.setBrightness(LEDBrightness); } .setBrightness() (see reference)
  • 87. Knob Variable Declaration E Knob bluKnob(1); TYPE NAME PIN
  • 88. Knob Value Method E bluKnob.value(); NAME METHOD NAME
  • 89. Hack 07: Change Knob Direction ( 1. Change the direction of the know. I.e. So the brightness goes down when the knob it turned up. 2. Stretch: Change the blink speed with the knob position.
  • 90. The Smart LED (Digital LED) E Unlike a standard LED, the Smart LED has a small processor inside that controls the light and communicates digitally with your microprocessor. They are also called NeoPixels. Generically, they are sometimes referred to by their “controller”, the WS2812 or WS2811.
  • 91. Component: Smart LED (NeoPixel) E Digital In +5V GND Digital Out 0 1 2 3 4 5 6 7 Digital In Multiple of these LEDs can be “cascaded” from a singe pin on your micro process (but, you may need outside power).
  • 92. Wiring Up a Smart LED (NeoPixel) > USB #0 #1 #2 5V BAT GND #4 #3 RST
  • 93. Hack 08: Hack the SmartPixel Example ( 1. After wiring the SmartPixel up, load and run the SmartPixel sketch. 2. Change the rate the colors change in the sketch 3. The sketch currently uses red, green, and blue as it’s colors. Change to three different colors Hint: look at the comments to figure out the parameters for the setPixelColor() method.
  • 94. Hack 09: Hack the SmartPixelRainbow Sketch ( 1. Load and run the SmartPixelRainbow sketch. 2. Change the rate the colors change in the sketch. Hint: You can guess what to do (perfectly respectable), or look at the complicated code in the NeoPixelFunctions tab for a clue.
  • 95. Hack 10: More Smart LED Hacks ( 1. BIG STRETCH: See if you can figure out how to control the rainbow color with a knob. Hint: look at the setPixelColor() and wheel() methods. 2. GIANT STRETCH: See you can cooperate with some of your table-mates and connect several smart LEDs together. Hint: one of the parameters when you declare the LED variable, is the number of LEDs in the strip.
  • 96. ?
  • 97. Wax On. Wax Off.
  • 98. LEDs
  • 103. Hack 99: Hack Digital Personality ( 1. Team up and use everything you’ve learned to design a switch with a personality. Hint: use two LEDs and a switch. pressing the switch turns one of the LEDs on/off. The other LED flashes in some way with personality to indicate whether you’ve been successful. Note: could you use a knob as the switch? 2. Do anything else you want to try as an individual. Or, as a team.
  • 105. Many Other Platforms E Arduino RPi BeagleBone spark.io pinocc.io teensy
  • 107. Next Steps: Online Tutorials E http://arduino.cc/en/Tutorial http://playground.arduino.cc https://learn.sparkfun.com ! http://learn.adafruit.com http://learn.adafruit.com/category/learn-arduino ! ! google “arduino tutorials”
  • 108. Next Steps: Arduino Comic E http://www.jodyculkin.com/wp-content/uploads/2011/09/arduino-comic-latest3.pdf
  • 109. Online Resources E ARDUINO: www.arduino.cc, reference, tutorials SPARKFUN: www.sparkfun.com, components, devices, tutorials ADAFRUIT: www.adafruit.com, components, devices, tutorials MAKE MAGAZINE: www.makezine.com, magazine, books, stuff MAKER SHED: www.makershed.com, components, kits, stuff INSTRUCTABLES: www.instructables.com, tutorials RADIO SHACK: www.radioshack.com, components, devices, tutorials AMAZON: www.amazon.com, books, components, devices, tutorials O’REILLY: www.oreilly.com, books, tutorials, etc. ELECTRONIC GOLDMINE: http://www.goldmine-elec-products.com, components JAMECO: www.jameco.com, components MOUSER: www.mouser.com, components DIGIKEY: www.digikey.com, components !