SlideShare a Scribd company logo
1 of 32
Download to read offline
Workshops Elisava 2011
Introduction to programming and
electronics (Scratch & Arduino)
What is programming?
Make an algorithm to do something in a specific language
programming.
● Algorithm: a procedure or formula for solving a problem.
● Programming language: artificial language designed to
communicate instructions to a machine.
It also involves the process of designing, writing, testing,
debugging, and maintaining the source code of a computer
program.
What is Arduino? (I)
It's an open source electronics prototyping platform:
● Open source: resources that can be used, redistributed or
rewritten free of charge, often software or hardware.
● Electronics: technology which makes use of the controlled motion
of electrons through different media.
● Prototyping: an original form that can serve as a basis or
standard for other things.
● Platform: hardware architecture with software framework on which
other software can run.
What is Arduino? (II)
The Arduino board is like a small computer that can be
programmed as many times as needed.
As a computer, it provides I/O interaction, through digital (input
and output) and analog input pins.
● Digital: discrete and finit, described in two states: 1/0, ON/OFF.
● Analog: continuous, can have infinite number of values.
The sketch made with the Arduino IDE is loaded to the board
and stored in the microcontroller.
More info at: http://arduino.cc/
Parts of Arduino board
What is Scratch?
It's an open source and educational software focused mainly for
children, designed by the Lifelong Kindergarten group at MIT,
and implemented in Smalltalk (Squeak).
The programming instructions are pieces that have to be stick
each other in an order to form blocks and make a coherent
program, just like a puzzle.
More info and downloads at: http://scratch.mit.edu/
What is S4A?
Scratch for Arduino (S4A) is a modified version of Scratch
ready for communication with Arduino boards.
An Arduino sketch (S4AFirmware) has to be loaded to the
board to work properly with S4A.
Both the installer and firmware can be downloaded from our
website: http://seaside.citilab.eu
Pin mapping in S4A:
● Digital read: digital pins 2 and 3.
● Digital write: digital pins 10, 11 and 13.
● Analog read: analog pins 0-5.
● Analog write: digital pins 5, 6 and 9.
● Servo control:
○ digital pins 4, 7 (continuous rotation).
○ 8 and 12 (standard).
Basic electronics: Ohm's Law
Electricity if the flow of energy (electrons) through a conductive
material.
● Voltage (V): is the measure of electrical potential, measured in
Volts (V).
● Current (I): is the amount of flow through a conductive material,
measured in Amperes or Amps (A).
● Resistance (R): is the material's opposition to the flow of electric
current, measured in Ohms (Ω).
Sample program: Blink
Comparison of a simple program that blinks a LED connected
to pin 13 on Arduino and in S4A. We can appreciate the
differences between the form and syntax of programming
languages ​​in both cases:
Arduino S4A
Uploading a sketch (I)
● Download the Arduino IDE at: http://arduino.
cc/en/Main/Software and extract it.
● Open an example: File > Examples > Basics > Blink.
● Select the board version at: Tools > Board and serial port
where the board is connected on: Tools > Serial port.
● Click on upload button.
● Done!
Uploading a sketch (II)
Ex. 1: Button + LED
In this exercise we will mount a LED controlled by a button. The
objective is turn on the LED on whenever the button is pressed,
and turn it off when not pressed.
What we need:
1 x Arduino
1 x Protoboard
1 x Button
1 x LED
1 x 10 kΩ resistor
Ex. 1: Circuit scheme
Ex. 1: Why do we need a resistor?
A pull-down resistor is needed because, without it, we can
induce a dead short when the button is pushed down.
Ex. 2: LDR + LED
Now we will replace the button by a LDR (Light Dependent
Resistor). The objective is turn on the LED when the LDR is
covered.
What we need:
1 x Arduino
1 x Protoboard
1 x LDR
1 x LED
1 x 10 kΩ resistor
Ex. 2: Circuit scheme
Ex. 3: Potentiometer + LED
Now we're going to use a potentiometer instead of fotoresistor,
with which we'll control the light of the LED gradually. This
means that we need to use a PWM pin (for example 5) instead
of the pin 13:
What we need:
1 x Arduino
1 x Protoboard
1 x Potentiometer
1 x LED
1 x 220 Ω resistor
Ex. 3: What's a potentiometer?
A potentiometer is a variable impedance device that provides
an analog value. In our case, using an Arduino board, the range
will be between 0 and 1023.
Its resistance is controlled by turning its axis, as shown in the
picture:
NOTE: The value of the resistance rise or drop in one direction or the
other depending on how you connect the power pins.
Ex. 3: What does PWM mean?
The pulse width
modulation (PWM) is a
technique used to simulate
an analog output with a
digital one, creating a
square wave that
constantly switches
between on and off. The
time when the wave is 5V
(ON) is called pulse width,
which is modified to
change the analogue
value.
Ex. 3: Circuit scheme
Ex. 4: Semaphore
In this exercise we'll try to simulate the operation of a traffic
light, those which have a button to facilitate the passage of
pedestrians. The goal is to simulate the behavior of these lights
with a simple program.
What we need:
1 x Arduino
1 x Protoboard
1 x Switch
2 x LEDs (red and green)
1 x LED RGB
4 x 220 Ω resistors
1 x 10k Ω resistor
Ex. 4: RGB LED
The RGB LEDs provide a full spectrum of color (in contrast to
normal ones, which give only one color), resulting in a light
composed of three primary colors. Depending on the intensity
of each color, we can get a lot of different shades. It is very
important to know wich color controls each LED leg:
Remember that we must use PWM outputs (5, 6 and 9) instead
of digital (as in the previous exercise).
Ex. 4: Circuit scheme
Ex. 4: Video demonstration
Here we can see a video demonstration of this
exercise:
Ex. 5: RGB LED + Infrared sensor
The goal of this exercise will be the interaction between
objects, using messages or variable changes. We'll also
see and use the lists for the first time, and the
elements in programming as flags.
To do so entertaining we will create a "virtual musical
instrument."
This will be the first time we program more than one
object. The goal is to split the program into different
objects and that each has a different function.
Ex. 5: Circuit scheme
Ex. 6: Pong with sensors
Now we'll try to remake one of the first video game in history,
the PONG:
The goal is to use two sensors on the same board, and assign
one to each player. In addition, we can incorporate a button to
start the game, LEDs that light every time the players score a
point, and so on...
Ex. 6: Circuit scheme
Ex. 7: Robot with CR servos
In this session we'll use servos for the first time. The first part of
the exercise is to create a robot controlled by the computer
keyboard (with the direction arrows, for example). The second
is to make this robot autonomous, and capable to go alone and
avoid objects with the help of sensors.
What we need:
1 x Arduino
1 x Protoboard
2 x CR Servomotors (Futaba)
2 x Infrared sensors
1 x Chassis, wheels and ball
1 x LED (optional)
Ex. 7: Circuit scheme 1
As shown in the diagram, each servo
has 3 wires: one red (5V), one black
(GND) and one yellow, which will be
connected to the pin we want to use
to send the order to the servomotor.
For this we have pins 4 and 7. As
you can see the assembly is quite
simple, just need a common point on
the board to connect the power of
each servo (red and black wires).
The diagram in next page includes a
pair of infrared sensors and an LED
to make it autonomous.
Ex. 7: Circuit scheme 2

More Related Content

What's hot

Arduino slides
Arduino slidesArduino slides
Arduino slidessdcharle
 
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
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to ArduinoQtechknow
 
Arduino spooky projects_class3
Arduino spooky projects_class3Arduino spooky projects_class3
Arduino spooky projects_class3Anil Yadav
 
Arduino learning
Arduino   learningArduino   learning
Arduino learningAnil Yadav
 
Getting startedwitharduino ch04
Getting startedwitharduino ch04Getting startedwitharduino ch04
Getting startedwitharduino ch04Anil Yadav
 
Introduction to arduino!
Introduction to arduino!Introduction to arduino!
Introduction to arduino!Makers of India
 
Getting Started With Arduino How To Build A Twitter Monitoring Alertuino
Getting Started With Arduino   How To Build A Twitter Monitoring AlertuinoGetting Started With Arduino   How To Build A Twitter Monitoring Alertuino
Getting Started With Arduino How To Build A Twitter Monitoring AlertuinoAdrian McEwen
 
Arduino Intro Guide 2
Arduino Intro Guide 2Arduino Intro Guide 2
Arduino Intro Guide 2elketeaches
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينوsalih mahmod
 
Arduino spooky projects_class1
Arduino spooky projects_class1Arduino spooky projects_class1
Arduino spooky projects_class1Felipe Belarmino
 
ARDUINO AND ITS PIN CONFIGURATION
 ARDUINO AND ITS PIN  CONFIGURATION ARDUINO AND ITS PIN  CONFIGURATION
ARDUINO AND ITS PIN CONFIGURATIONsoma saikiran
 
Intro to Arduino Revision #2
Intro to Arduino Revision #2Intro to Arduino Revision #2
Intro to Arduino Revision #2Qtechknow
 
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
 
Getting Started With Arduino_Tutorial
Getting Started With Arduino_TutorialGetting Started With Arduino_Tutorial
Getting Started With Arduino_TutorialNYCCTfab
 

What's hot (20)

Arduino slides
Arduino slidesArduino slides
Arduino slides
 
IOTC08 The Arduino Platform
IOTC08 The Arduino PlatformIOTC08 The Arduino Platform
IOTC08 The Arduino Platform
 
Basic Sensors
Basic Sensors Basic Sensors
Basic Sensors
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
 
Lecture6
Lecture6Lecture6
Lecture6
 
Arduino spooky projects_class3
Arduino spooky projects_class3Arduino spooky projects_class3
Arduino spooky projects_class3
 
Arduino learning
Arduino   learningArduino   learning
Arduino learning
 
Getting startedwitharduino ch04
Getting startedwitharduino ch04Getting startedwitharduino ch04
Getting startedwitharduino ch04
 
Introduction to arduino!
Introduction to arduino!Introduction to arduino!
Introduction to arduino!
 
Getting Started With Arduino How To Build A Twitter Monitoring Alertuino
Getting Started With Arduino   How To Build A Twitter Monitoring AlertuinoGetting Started With Arduino   How To Build A Twitter Monitoring Alertuino
Getting Started With Arduino How To Build A Twitter Monitoring Alertuino
 
Arduino Intro Guide 2
Arduino Intro Guide 2Arduino Intro Guide 2
Arduino Intro Guide 2
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
 
Arduino spooky projects_class1
Arduino spooky projects_class1Arduino spooky projects_class1
Arduino spooky projects_class1
 
Arduino programming
Arduino programmingArduino programming
Arduino programming
 
ARDUINO AND ITS PIN CONFIGURATION
 ARDUINO AND ITS PIN  CONFIGURATION ARDUINO AND ITS PIN  CONFIGURATION
ARDUINO AND ITS PIN CONFIGURATION
 
Intro to Arduino Revision #2
Intro to Arduino Revision #2Intro to Arduino Revision #2
Intro to Arduino Revision #2
 
Lecture1
Lecture1Lecture1
Lecture1
 
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
 
Getting Started With Arduino_Tutorial
Getting Started With Arduino_TutorialGetting Started With Arduino_Tutorial
Getting Started With Arduino_Tutorial
 

Similar to Introduction to Programming and Electronics

Arduino comic v0004
Arduino comic v0004Arduino comic v0004
Arduino comic v0004DO!MAKERS
 
Arduino - Learning.pdf
Arduino - Learning.pdfArduino - Learning.pdf
Arduino - Learning.pdfKhalilSedki1
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduinoavikdhupar
 
Introduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and ProgrammingIntroduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and ProgrammingEmmanuel Obot
 
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.
 
Build cool stuff with arduino for sci camp 16 dec13
Build cool stuff with arduino for sci camp 16 dec13Build cool stuff with arduino for sci camp 16 dec13
Build cool stuff with arduino for sci camp 16 dec13Singapore Makers Association
 
Robotics Session day 1
Robotics Session day 1Robotics Session day 1
Robotics Session day 1Afzal Ahmad
 
Arduino Workshop Slides
Arduino Workshop SlidesArduino Workshop Slides
Arduino Workshop Slidesmkarlin14
 
Smart Safety Door based on Arduino Uno R3
Smart Safety Door based on Arduino Uno R3Smart Safety Door based on Arduino Uno R3
Smart Safety Door based on Arduino Uno R3Ziddan Kundrat
 
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors B...
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors  B...Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors  B...
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors B...Faqih Fadhila Ardiansyah
 
Project 1 Tutorial 1a rev 2.pptx
Project 1 Tutorial 1a rev 2.pptxProject 1 Tutorial 1a rev 2.pptx
Project 1 Tutorial 1a rev 2.pptxazarulfahminabhamid
 

Similar to Introduction to Programming and Electronics (20)

Arduino Comic-Jody Culkin-2011
Arduino Comic-Jody Culkin-2011Arduino Comic-Jody Culkin-2011
Arduino Comic-Jody Culkin-2011
 
Arduino comic v0004
Arduino comic v0004Arduino comic v0004
Arduino comic v0004
 
Fun with arduino
Fun with arduinoFun with arduino
Fun with arduino
 
Arduino - Learning.pdf
Arduino - Learning.pdfArduino - Learning.pdf
Arduino - Learning.pdf
 
Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
 
Intro_to_Arduino_-_v30.pptx
Intro_to_Arduino_-_v30.pptxIntro_to_Arduino_-_v30.pptx
Intro_to_Arduino_-_v30.pptx
 
Neno Project.docx
Neno Project.docxNeno Project.docx
Neno Project.docx
 
Introduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and ProgrammingIntroduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and Programming
 
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
 
Build cool stuff with arduino for sci camp 16 dec13
Build cool stuff with arduino for sci camp 16 dec13Build cool stuff with arduino for sci camp 16 dec13
Build cool stuff with arduino for sci camp 16 dec13
 
Robotics Session day 1
Robotics Session day 1Robotics Session day 1
Robotics Session day 1
 
Arduino Workshop Slides
Arduino Workshop SlidesArduino Workshop Slides
Arduino Workshop Slides
 
Smart Safety Door based on Arduino Uno R3
Smart Safety Door based on Arduino Uno R3Smart Safety Door based on Arduino Uno R3
Smart Safety Door based on Arduino Uno R3
 
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors B...
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors  B...Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors  B...
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors B...
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
 
What is arduino
What is arduinoWhat is arduino
What is arduino
 
Project 1 Tutorial 1a rev 2.pptx
Project 1 Tutorial 1a rev 2.pptxProject 1 Tutorial 1a rev 2.pptx
Project 1 Tutorial 1a rev 2.pptx
 
Arduino
ArduinoArduino
Arduino
 

More from Edson Silva

0d6b874a f491-11e8-9be7-6cae8b4eb554.data
0d6b874a f491-11e8-9be7-6cae8b4eb554.data0d6b874a f491-11e8-9be7-6cae8b4eb554.data
0d6b874a f491-11e8-9be7-6cae8b4eb554.dataEdson Silva
 
0cbc4834 8e89-4034-902d-8b430f6761ef.data
0cbc4834 8e89-4034-902d-8b430f6761ef.data0cbc4834 8e89-4034-902d-8b430f6761ef.data
0cbc4834 8e89-4034-902d-8b430f6761ef.dataEdson Silva
 
0c439902 630e-11e7-b4fe-6cae8b4eb554.data
0c439902 630e-11e7-b4fe-6cae8b4eb554.data0c439902 630e-11e7-b4fe-6cae8b4eb554.data
0c439902 630e-11e7-b4fe-6cae8b4eb554.dataEdson Silva
 
0c13ca75 8cb1-11e7-973d-6cae8b4eb554.data
0c13ca75 8cb1-11e7-973d-6cae8b4eb554.data0c13ca75 8cb1-11e7-973d-6cae8b4eb554.data
0c13ca75 8cb1-11e7-973d-6cae8b4eb554.dataEdson Silva
 
0bc16564 4464-11e8-adfa-6cae8b4eb554.data
0bc16564 4464-11e8-adfa-6cae8b4eb554.data0bc16564 4464-11e8-adfa-6cae8b4eb554.data
0bc16564 4464-11e8-adfa-6cae8b4eb554.dataEdson Silva
 
0b35553a f441-11e6-87bc-6cae8b4eb554.data
0b35553a f441-11e6-87bc-6cae8b4eb554.data0b35553a f441-11e6-87bc-6cae8b4eb554.data
0b35553a f441-11e6-87bc-6cae8b4eb554.dataEdson Silva
 
0b3b7b0c 483c-11e6-9f89-6cae8b4eb554.data
0b3b7b0c 483c-11e6-9f89-6cae8b4eb554.data0b3b7b0c 483c-11e6-9f89-6cae8b4eb554.data
0b3b7b0c 483c-11e6-9f89-6cae8b4eb554.dataEdson Silva
 
0a356668 92cb-11e5-8eb4-6cae8b4eb554.data
0a356668 92cb-11e5-8eb4-6cae8b4eb554.data0a356668 92cb-11e5-8eb4-6cae8b4eb554.data
0a356668 92cb-11e5-8eb4-6cae8b4eb554.dataEdson Silva
 
0a906efb 706e-11e8-91a7-6cae8b4eb554.data
0a906efb 706e-11e8-91a7-6cae8b4eb554.data0a906efb 706e-11e8-91a7-6cae8b4eb554.data
0a906efb 706e-11e8-91a7-6cae8b4eb554.dataEdson Silva
 
0a9ae367 319f-11e8-adfa-6cae8b4eb554.data
0a9ae367 319f-11e8-adfa-6cae8b4eb554.data0a9ae367 319f-11e8-adfa-6cae8b4eb554.data
0a9ae367 319f-11e8-adfa-6cae8b4eb554.dataEdson Silva
 
0a009a5d f72d-11e5-ad59-6cae8b4eb554.data
0a009a5d f72d-11e5-ad59-6cae8b4eb554.data0a009a5d f72d-11e5-ad59-6cae8b4eb554.data
0a009a5d f72d-11e5-ad59-6cae8b4eb554.dataEdson Silva
 
0a6dca9a 59df-11e8-91a7-6cae8b4eb554.data
0a6dca9a 59df-11e8-91a7-6cae8b4eb554.data0a6dca9a 59df-11e8-91a7-6cae8b4eb554.data
0a6dca9a 59df-11e8-91a7-6cae8b4eb554.dataEdson Silva
 
0a5ad0ee c2e3-11e7-9dec-6cae8b4eb554.data
0a5ad0ee c2e3-11e7-9dec-6cae8b4eb554.data0a5ad0ee c2e3-11e7-9dec-6cae8b4eb554.data
0a5ad0ee c2e3-11e7-9dec-6cae8b4eb554.dataEdson Silva
 
0a5a3124 4703-11e8-adfa-6cae8b4eb554.data
0a5a3124 4703-11e8-adfa-6cae8b4eb554.data0a5a3124 4703-11e8-adfa-6cae8b4eb554.data
0a5a3124 4703-11e8-adfa-6cae8b4eb554.dataEdson Silva
 
0a3d108a f490-11e8-9be7-6cae8b4eb554.data
0a3d108a f490-11e8-9be7-6cae8b4eb554.data0a3d108a f490-11e8-9be7-6cae8b4eb554.data
0a3d108a f490-11e8-9be7-6cae8b4eb554.dataEdson Silva
 
00fba0c9 1870-11e8-a72c-6cae8b4eb554.data
00fba0c9 1870-11e8-a72c-6cae8b4eb554.data00fba0c9 1870-11e8-a72c-6cae8b4eb554.data
00fba0c9 1870-11e8-a72c-6cae8b4eb554.dataEdson Silva
 
00f3eb1d 5795-11e8-91a7-6cae8b4eb554.data
00f3eb1d 5795-11e8-91a7-6cae8b4eb554.data00f3eb1d 5795-11e8-91a7-6cae8b4eb554.data
00f3eb1d 5795-11e8-91a7-6cae8b4eb554.dataEdson Silva
 
00e2570d 9642-11e8-91a7-6cae8b4eb554.data
00e2570d 9642-11e8-91a7-6cae8b4eb554.data00e2570d 9642-11e8-91a7-6cae8b4eb554.data
00e2570d 9642-11e8-91a7-6cae8b4eb554.dataEdson Silva
 
00e6cf47 d8f1-11e8-a5a4-6cae8b4eb554.data
00e6cf47 d8f1-11e8-a5a4-6cae8b4eb554.data00e6cf47 d8f1-11e8-a5a4-6cae8b4eb554.data
00e6cf47 d8f1-11e8-a5a4-6cae8b4eb554.dataEdson Silva
 
00c94250 000a-11e6-ad59-6cae8b4eb554.data
00c94250 000a-11e6-ad59-6cae8b4eb554.data00c94250 000a-11e6-ad59-6cae8b4eb554.data
00c94250 000a-11e6-ad59-6cae8b4eb554.dataEdson Silva
 

More from Edson Silva (20)

0d6b874a f491-11e8-9be7-6cae8b4eb554.data
0d6b874a f491-11e8-9be7-6cae8b4eb554.data0d6b874a f491-11e8-9be7-6cae8b4eb554.data
0d6b874a f491-11e8-9be7-6cae8b4eb554.data
 
0cbc4834 8e89-4034-902d-8b430f6761ef.data
0cbc4834 8e89-4034-902d-8b430f6761ef.data0cbc4834 8e89-4034-902d-8b430f6761ef.data
0cbc4834 8e89-4034-902d-8b430f6761ef.data
 
0c439902 630e-11e7-b4fe-6cae8b4eb554.data
0c439902 630e-11e7-b4fe-6cae8b4eb554.data0c439902 630e-11e7-b4fe-6cae8b4eb554.data
0c439902 630e-11e7-b4fe-6cae8b4eb554.data
 
0c13ca75 8cb1-11e7-973d-6cae8b4eb554.data
0c13ca75 8cb1-11e7-973d-6cae8b4eb554.data0c13ca75 8cb1-11e7-973d-6cae8b4eb554.data
0c13ca75 8cb1-11e7-973d-6cae8b4eb554.data
 
0bc16564 4464-11e8-adfa-6cae8b4eb554.data
0bc16564 4464-11e8-adfa-6cae8b4eb554.data0bc16564 4464-11e8-adfa-6cae8b4eb554.data
0bc16564 4464-11e8-adfa-6cae8b4eb554.data
 
0b35553a f441-11e6-87bc-6cae8b4eb554.data
0b35553a f441-11e6-87bc-6cae8b4eb554.data0b35553a f441-11e6-87bc-6cae8b4eb554.data
0b35553a f441-11e6-87bc-6cae8b4eb554.data
 
0b3b7b0c 483c-11e6-9f89-6cae8b4eb554.data
0b3b7b0c 483c-11e6-9f89-6cae8b4eb554.data0b3b7b0c 483c-11e6-9f89-6cae8b4eb554.data
0b3b7b0c 483c-11e6-9f89-6cae8b4eb554.data
 
0a356668 92cb-11e5-8eb4-6cae8b4eb554.data
0a356668 92cb-11e5-8eb4-6cae8b4eb554.data0a356668 92cb-11e5-8eb4-6cae8b4eb554.data
0a356668 92cb-11e5-8eb4-6cae8b4eb554.data
 
0a906efb 706e-11e8-91a7-6cae8b4eb554.data
0a906efb 706e-11e8-91a7-6cae8b4eb554.data0a906efb 706e-11e8-91a7-6cae8b4eb554.data
0a906efb 706e-11e8-91a7-6cae8b4eb554.data
 
0a9ae367 319f-11e8-adfa-6cae8b4eb554.data
0a9ae367 319f-11e8-adfa-6cae8b4eb554.data0a9ae367 319f-11e8-adfa-6cae8b4eb554.data
0a9ae367 319f-11e8-adfa-6cae8b4eb554.data
 
0a009a5d f72d-11e5-ad59-6cae8b4eb554.data
0a009a5d f72d-11e5-ad59-6cae8b4eb554.data0a009a5d f72d-11e5-ad59-6cae8b4eb554.data
0a009a5d f72d-11e5-ad59-6cae8b4eb554.data
 
0a6dca9a 59df-11e8-91a7-6cae8b4eb554.data
0a6dca9a 59df-11e8-91a7-6cae8b4eb554.data0a6dca9a 59df-11e8-91a7-6cae8b4eb554.data
0a6dca9a 59df-11e8-91a7-6cae8b4eb554.data
 
0a5ad0ee c2e3-11e7-9dec-6cae8b4eb554.data
0a5ad0ee c2e3-11e7-9dec-6cae8b4eb554.data0a5ad0ee c2e3-11e7-9dec-6cae8b4eb554.data
0a5ad0ee c2e3-11e7-9dec-6cae8b4eb554.data
 
0a5a3124 4703-11e8-adfa-6cae8b4eb554.data
0a5a3124 4703-11e8-adfa-6cae8b4eb554.data0a5a3124 4703-11e8-adfa-6cae8b4eb554.data
0a5a3124 4703-11e8-adfa-6cae8b4eb554.data
 
0a3d108a f490-11e8-9be7-6cae8b4eb554.data
0a3d108a f490-11e8-9be7-6cae8b4eb554.data0a3d108a f490-11e8-9be7-6cae8b4eb554.data
0a3d108a f490-11e8-9be7-6cae8b4eb554.data
 
00fba0c9 1870-11e8-a72c-6cae8b4eb554.data
00fba0c9 1870-11e8-a72c-6cae8b4eb554.data00fba0c9 1870-11e8-a72c-6cae8b4eb554.data
00fba0c9 1870-11e8-a72c-6cae8b4eb554.data
 
00f3eb1d 5795-11e8-91a7-6cae8b4eb554.data
00f3eb1d 5795-11e8-91a7-6cae8b4eb554.data00f3eb1d 5795-11e8-91a7-6cae8b4eb554.data
00f3eb1d 5795-11e8-91a7-6cae8b4eb554.data
 
00e2570d 9642-11e8-91a7-6cae8b4eb554.data
00e2570d 9642-11e8-91a7-6cae8b4eb554.data00e2570d 9642-11e8-91a7-6cae8b4eb554.data
00e2570d 9642-11e8-91a7-6cae8b4eb554.data
 
00e6cf47 d8f1-11e8-a5a4-6cae8b4eb554.data
00e6cf47 d8f1-11e8-a5a4-6cae8b4eb554.data00e6cf47 d8f1-11e8-a5a4-6cae8b4eb554.data
00e6cf47 d8f1-11e8-a5a4-6cae8b4eb554.data
 
00c94250 000a-11e6-ad59-6cae8b4eb554.data
00c94250 000a-11e6-ad59-6cae8b4eb554.data00c94250 000a-11e6-ad59-6cae8b4eb554.data
00c94250 000a-11e6-ad59-6cae8b4eb554.data
 

Recently uploaded

在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证nhjeo1gg
 
NATA 2024 SYLLABUS, full syllabus explained in detail
NATA 2024 SYLLABUS, full syllabus explained in detailNATA 2024 SYLLABUS, full syllabus explained in detail
NATA 2024 SYLLABUS, full syllabus explained in detailDesigntroIntroducing
 
How to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our SiteHow to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our Sitegalleryaagency
 
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130Suhani Kapoor
 
Call Girls Bapu Nagar 7397865700 Ridhima Hire Me Full Night
Call Girls Bapu Nagar 7397865700 Ridhima Hire Me Full NightCall Girls Bapu Nagar 7397865700 Ridhima Hire Me Full Night
Call Girls Bapu Nagar 7397865700 Ridhima Hire Me Full Nightssuser7cb4ff
 
Kindergarten Assessment Questions Via LessonUp
Kindergarten Assessment Questions Via LessonUpKindergarten Assessment Questions Via LessonUp
Kindergarten Assessment Questions Via LessonUpmainac1
 
办理学位证(NUS证书)新加坡国立大学毕业证成绩单原版一比一
办理学位证(NUS证书)新加坡国立大学毕业证成绩单原版一比一办理学位证(NUS证书)新加坡国立大学毕业证成绩单原版一比一
办理学位证(NUS证书)新加坡国立大学毕业证成绩单原版一比一Fi L
 
Call Girls Satellite 7397865700 Ridhima Hire Me Full Night
Call Girls Satellite 7397865700 Ridhima Hire Me Full NightCall Girls Satellite 7397865700 Ridhima Hire Me Full Night
Call Girls Satellite 7397865700 Ridhima Hire Me Full Nightssuser7cb4ff
 
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130  Available With RoomVIP Kolkata Call Girl Gariahat 👉 8250192130  Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Roomdivyansh0kumar0
 
Abu Dhabi Call Girls O58993O4O2 Call Girls in Abu Dhabi`
Abu Dhabi Call Girls O58993O4O2 Call Girls in Abu Dhabi`Abu Dhabi Call Girls O58993O4O2 Call Girls in Abu Dhabi`
Abu Dhabi Call Girls O58993O4O2 Call Girls in Abu Dhabi`dajasot375
 
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024CristobalHeraud
 
306MTAMount UCLA University Bachelor's Diploma in Social Media
306MTAMount UCLA University Bachelor's Diploma in Social Media306MTAMount UCLA University Bachelor's Diploma in Social Media
306MTAMount UCLA University Bachelor's Diploma in Social MediaD SSS
 
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一Fi sss
 
shot list for my tv series two steps back
shot list for my tv series two steps backshot list for my tv series two steps back
shot list for my tv series two steps back17lcow074
 
3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdfSwaraliBorhade
 
Bus tracking.pptx ,,,,,,,,,,,,,,,,,,,,,,,,,,
Bus tracking.pptx ,,,,,,,,,,,,,,,,,,,,,,,,,,Bus tracking.pptx ,,,,,,,,,,,,,,,,,,,,,,,,,,
Bus tracking.pptx ,,,,,,,,,,,,,,,,,,,,,,,,,,bhuyansuprit
 
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai DouxDubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Douxkojalkojal131
 
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一Fi L
 
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130Suhani Kapoor
 

Recently uploaded (20)

在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
在线办理ohio毕业证俄亥俄大学毕业证成绩单留信学历认证
 
NATA 2024 SYLLABUS, full syllabus explained in detail
NATA 2024 SYLLABUS, full syllabus explained in detailNATA 2024 SYLLABUS, full syllabus explained in detail
NATA 2024 SYLLABUS, full syllabus explained in detail
 
How to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our SiteHow to Be Famous in your Field just visit our Site
How to Be Famous in your Field just visit our Site
 
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
 
Call Girls Bapu Nagar 7397865700 Ridhima Hire Me Full Night
Call Girls Bapu Nagar 7397865700 Ridhima Hire Me Full NightCall Girls Bapu Nagar 7397865700 Ridhima Hire Me Full Night
Call Girls Bapu Nagar 7397865700 Ridhima Hire Me Full Night
 
Kindergarten Assessment Questions Via LessonUp
Kindergarten Assessment Questions Via LessonUpKindergarten Assessment Questions Via LessonUp
Kindergarten Assessment Questions Via LessonUp
 
办理学位证(NUS证书)新加坡国立大学毕业证成绩单原版一比一
办理学位证(NUS证书)新加坡国立大学毕业证成绩单原版一比一办理学位证(NUS证书)新加坡国立大学毕业证成绩单原版一比一
办理学位证(NUS证书)新加坡国立大学毕业证成绩单原版一比一
 
Call Girls Satellite 7397865700 Ridhima Hire Me Full Night
Call Girls Satellite 7397865700 Ridhima Hire Me Full NightCall Girls Satellite 7397865700 Ridhima Hire Me Full Night
Call Girls Satellite 7397865700 Ridhima Hire Me Full Night
 
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130  Available With RoomVIP Kolkata Call Girl Gariahat 👉 8250192130  Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Room
 
Abu Dhabi Call Girls O58993O4O2 Call Girls in Abu Dhabi`
Abu Dhabi Call Girls O58993O4O2 Call Girls in Abu Dhabi`Abu Dhabi Call Girls O58993O4O2 Call Girls in Abu Dhabi`
Abu Dhabi Call Girls O58993O4O2 Call Girls in Abu Dhabi`
 
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
 
306MTAMount UCLA University Bachelor's Diploma in Social Media
306MTAMount UCLA University Bachelor's Diploma in Social Media306MTAMount UCLA University Bachelor's Diploma in Social Media
306MTAMount UCLA University Bachelor's Diploma in Social Media
 
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk GurgaonCheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
 
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
 
shot list for my tv series two steps back
shot list for my tv series two steps backshot list for my tv series two steps back
shot list for my tv series two steps back
 
3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf3D Printing And Designing Final Report.pdf
3D Printing And Designing Final Report.pdf
 
Bus tracking.pptx ,,,,,,,,,,,,,,,,,,,,,,,,,,
Bus tracking.pptx ,,,,,,,,,,,,,,,,,,,,,,,,,,Bus tracking.pptx ,,,,,,,,,,,,,,,,,,,,,,,,,,
Bus tracking.pptx ,,,,,,,,,,,,,,,,,,,,,,,,,,
 
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai DouxDubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
 
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
 
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
VIP Call Girls Service Bhagyanagar Hyderabad Call +91-8250192130
 

Introduction to Programming and Electronics

  • 1. Workshops Elisava 2011 Introduction to programming and electronics (Scratch & Arduino)
  • 2. What is programming? Make an algorithm to do something in a specific language programming. ● Algorithm: a procedure or formula for solving a problem. ● Programming language: artificial language designed to communicate instructions to a machine. It also involves the process of designing, writing, testing, debugging, and maintaining the source code of a computer program.
  • 3. What is Arduino? (I) It's an open source electronics prototyping platform: ● Open source: resources that can be used, redistributed or rewritten free of charge, often software or hardware. ● Electronics: technology which makes use of the controlled motion of electrons through different media. ● Prototyping: an original form that can serve as a basis or standard for other things. ● Platform: hardware architecture with software framework on which other software can run.
  • 4. What is Arduino? (II) The Arduino board is like a small computer that can be programmed as many times as needed. As a computer, it provides I/O interaction, through digital (input and output) and analog input pins. ● Digital: discrete and finit, described in two states: 1/0, ON/OFF. ● Analog: continuous, can have infinite number of values. The sketch made with the Arduino IDE is loaded to the board and stored in the microcontroller. More info at: http://arduino.cc/
  • 6. What is Scratch? It's an open source and educational software focused mainly for children, designed by the Lifelong Kindergarten group at MIT, and implemented in Smalltalk (Squeak). The programming instructions are pieces that have to be stick each other in an order to form blocks and make a coherent program, just like a puzzle. More info and downloads at: http://scratch.mit.edu/
  • 7. What is S4A? Scratch for Arduino (S4A) is a modified version of Scratch ready for communication with Arduino boards. An Arduino sketch (S4AFirmware) has to be loaded to the board to work properly with S4A. Both the installer and firmware can be downloaded from our website: http://seaside.citilab.eu
  • 8. Pin mapping in S4A: ● Digital read: digital pins 2 and 3. ● Digital write: digital pins 10, 11 and 13. ● Analog read: analog pins 0-5. ● Analog write: digital pins 5, 6 and 9. ● Servo control: ○ digital pins 4, 7 (continuous rotation). ○ 8 and 12 (standard).
  • 9. Basic electronics: Ohm's Law Electricity if the flow of energy (electrons) through a conductive material. ● Voltage (V): is the measure of electrical potential, measured in Volts (V). ● Current (I): is the amount of flow through a conductive material, measured in Amperes or Amps (A). ● Resistance (R): is the material's opposition to the flow of electric current, measured in Ohms (Ω).
  • 10. Sample program: Blink Comparison of a simple program that blinks a LED connected to pin 13 on Arduino and in S4A. We can appreciate the differences between the form and syntax of programming languages ​​in both cases: Arduino S4A
  • 11. Uploading a sketch (I) ● Download the Arduino IDE at: http://arduino. cc/en/Main/Software and extract it. ● Open an example: File > Examples > Basics > Blink. ● Select the board version at: Tools > Board and serial port where the board is connected on: Tools > Serial port. ● Click on upload button. ● Done!
  • 13. Ex. 1: Button + LED In this exercise we will mount a LED controlled by a button. The objective is turn on the LED on whenever the button is pressed, and turn it off when not pressed. What we need: 1 x Arduino 1 x Protoboard 1 x Button 1 x LED 1 x 10 kΩ resistor
  • 14. Ex. 1: Circuit scheme
  • 15. Ex. 1: Why do we need a resistor? A pull-down resistor is needed because, without it, we can induce a dead short when the button is pushed down.
  • 16. Ex. 2: LDR + LED Now we will replace the button by a LDR (Light Dependent Resistor). The objective is turn on the LED when the LDR is covered. What we need: 1 x Arduino 1 x Protoboard 1 x LDR 1 x LED 1 x 10 kΩ resistor
  • 17. Ex. 2: Circuit scheme
  • 18. Ex. 3: Potentiometer + LED Now we're going to use a potentiometer instead of fotoresistor, with which we'll control the light of the LED gradually. This means that we need to use a PWM pin (for example 5) instead of the pin 13: What we need: 1 x Arduino 1 x Protoboard 1 x Potentiometer 1 x LED 1 x 220 Ω resistor
  • 19. Ex. 3: What's a potentiometer? A potentiometer is a variable impedance device that provides an analog value. In our case, using an Arduino board, the range will be between 0 and 1023. Its resistance is controlled by turning its axis, as shown in the picture: NOTE: The value of the resistance rise or drop in one direction or the other depending on how you connect the power pins.
  • 20. Ex. 3: What does PWM mean? The pulse width modulation (PWM) is a technique used to simulate an analog output with a digital one, creating a square wave that constantly switches between on and off. The time when the wave is 5V (ON) is called pulse width, which is modified to change the analogue value.
  • 21. Ex. 3: Circuit scheme
  • 22. Ex. 4: Semaphore In this exercise we'll try to simulate the operation of a traffic light, those which have a button to facilitate the passage of pedestrians. The goal is to simulate the behavior of these lights with a simple program. What we need: 1 x Arduino 1 x Protoboard 1 x Switch 2 x LEDs (red and green) 1 x LED RGB 4 x 220 Ω resistors 1 x 10k Ω resistor
  • 23. Ex. 4: RGB LED The RGB LEDs provide a full spectrum of color (in contrast to normal ones, which give only one color), resulting in a light composed of three primary colors. Depending on the intensity of each color, we can get a lot of different shades. It is very important to know wich color controls each LED leg: Remember that we must use PWM outputs (5, 6 and 9) instead of digital (as in the previous exercise).
  • 24. Ex. 4: Circuit scheme
  • 25. Ex. 4: Video demonstration Here we can see a video demonstration of this exercise:
  • 26. Ex. 5: RGB LED + Infrared sensor The goal of this exercise will be the interaction between objects, using messages or variable changes. We'll also see and use the lists for the first time, and the elements in programming as flags. To do so entertaining we will create a "virtual musical instrument." This will be the first time we program more than one object. The goal is to split the program into different objects and that each has a different function.
  • 27. Ex. 5: Circuit scheme
  • 28. Ex. 6: Pong with sensors Now we'll try to remake one of the first video game in history, the PONG: The goal is to use two sensors on the same board, and assign one to each player. In addition, we can incorporate a button to start the game, LEDs that light every time the players score a point, and so on...
  • 29. Ex. 6: Circuit scheme
  • 30. Ex. 7: Robot with CR servos In this session we'll use servos for the first time. The first part of the exercise is to create a robot controlled by the computer keyboard (with the direction arrows, for example). The second is to make this robot autonomous, and capable to go alone and avoid objects with the help of sensors. What we need: 1 x Arduino 1 x Protoboard 2 x CR Servomotors (Futaba) 2 x Infrared sensors 1 x Chassis, wheels and ball 1 x LED (optional)
  • 31. Ex. 7: Circuit scheme 1 As shown in the diagram, each servo has 3 wires: one red (5V), one black (GND) and one yellow, which will be connected to the pin we want to use to send the order to the servomotor. For this we have pins 4 and 7. As you can see the assembly is quite simple, just need a common point on the board to connect the power of each servo (red and black wires). The diagram in next page includes a pair of infrared sensors and an LED to make it autonomous.
  • 32. Ex. 7: Circuit scheme 2