SlideShare a Scribd company logo
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

Social Media Cyber Security Awareness Briefing
Social Media Cyber Security Awareness BriefingSocial Media Cyber Security Awareness Briefing
Social Media Cyber Security Awareness BriefingDepartment of Defense
 
TYPES OF HACKING
TYPES OF HACKINGTYPES OF HACKING
TYPES OF HACKING
SHERALI445
 
Ethical hacking a licence to hack
Ethical hacking a licence to hackEthical hacking a licence to hack
Ethical hacking a licence to hackDharmesh Makwana
 
Ethical hacking
Ethical hackingEthical hacking
Ethical hacking
Alapan Banerjee
 
[4YFN]Cyber Security Innovation, an urgent call to cyber heroes SM
[4YFN]Cyber Security Innovation, an urgent call to cyber heroes SM[4YFN]Cyber Security Innovation, an urgent call to cyber heroes SM
[4YFN]Cyber Security Innovation, an urgent call to cyber heroes SMCarlos Valderrama
 
A Career in Cybersecurity
A Career in CybersecurityA Career in Cybersecurity
A Career in Cybersecurity
lfh663
 
Cybersecurity
CybersecurityCybersecurity
Cybersecurity
Foram Gosai
 
Cyber security
Cyber securityCyber security
Cyber security
ChethanMp7
 
CCTV
CCTVCCTV
Threat landscape 4.0
Threat landscape 4.0Threat landscape 4.0
Threat landscape 4.0
Dr. C.V. Suresh Babu
 
Cybersecurity 1. intro to cybersecurity
Cybersecurity 1. intro to cybersecurityCybersecurity 1. intro to cybersecurity
Cybersecurity 1. intro to cybersecurity
sommerville-videos
 
Social engineering
Social engineeringSocial engineering
Social engineering
ankushmohanty
 
CompTIA Security+ SY0-601 Domain 1
CompTIA Security+ SY0-601 Domain 1CompTIA Security+ SY0-601 Domain 1
CompTIA Security+ SY0-601 Domain 1
ShivamSharma909
 
Cyber security by Anushka Jha
Cyber security by Anushka JhaCyber security by Anushka Jha
Cyber security by Anushka Jha
Anushka Jha
 
Cyber Security PPT.pptx
Cyber Security PPT.pptxCyber Security PPT.pptx
Cyber Security PPT.pptx
AbhishekDas794104
 
cyber security
cyber securitycyber security
cyber security
abithajayavel
 
Introduction to ethical hacking
Introduction to ethical hackingIntroduction to ethical hacking
Introduction to ethical hacking
Vikram Khanna
 
Cyber security presentation
Cyber security presentation Cyber security presentation
Cyber security presentation
sweetpeace1
 
Ethical hacking
Ethical hackingEthical hacking
Ethical hacking
Monika Deswal
 
Awareness Security Session 2023 v1.0.pptx.pdf
Awareness Security Session 2023 v1.0.pptx.pdfAwareness Security Session 2023 v1.0.pptx.pdf
Awareness Security Session 2023 v1.0.pptx.pdf
AbdullahKanash
 

What's hot (20)

Social Media Cyber Security Awareness Briefing
Social Media Cyber Security Awareness BriefingSocial Media Cyber Security Awareness Briefing
Social Media Cyber Security Awareness Briefing
 
TYPES OF HACKING
TYPES OF HACKINGTYPES OF HACKING
TYPES OF HACKING
 
Ethical hacking a licence to hack
Ethical hacking a licence to hackEthical hacking a licence to hack
Ethical hacking a licence to hack
 
Ethical hacking
Ethical hackingEthical hacking
Ethical hacking
 
[4YFN]Cyber Security Innovation, an urgent call to cyber heroes SM
[4YFN]Cyber Security Innovation, an urgent call to cyber heroes SM[4YFN]Cyber Security Innovation, an urgent call to cyber heroes SM
[4YFN]Cyber Security Innovation, an urgent call to cyber heroes SM
 
A Career in Cybersecurity
A Career in CybersecurityA Career in Cybersecurity
A Career in Cybersecurity
 
Cybersecurity
CybersecurityCybersecurity
Cybersecurity
 
Cyber security
Cyber securityCyber security
Cyber security
 
CCTV
CCTVCCTV
CCTV
 
Threat landscape 4.0
Threat landscape 4.0Threat landscape 4.0
Threat landscape 4.0
 
Cybersecurity 1. intro to cybersecurity
Cybersecurity 1. intro to cybersecurityCybersecurity 1. intro to cybersecurity
Cybersecurity 1. intro to cybersecurity
 
Social engineering
Social engineeringSocial engineering
Social engineering
 
CompTIA Security+ SY0-601 Domain 1
CompTIA Security+ SY0-601 Domain 1CompTIA Security+ SY0-601 Domain 1
CompTIA Security+ SY0-601 Domain 1
 
Cyber security by Anushka Jha
Cyber security by Anushka JhaCyber security by Anushka Jha
Cyber security by Anushka Jha
 
Cyber Security PPT.pptx
Cyber Security PPT.pptxCyber Security PPT.pptx
Cyber Security PPT.pptx
 
cyber security
cyber securitycyber security
cyber security
 
Introduction to ethical hacking
Introduction to ethical hackingIntroduction to ethical hacking
Introduction to ethical hacking
 
Cyber security presentation
Cyber security presentation Cyber security presentation
Cyber security presentation
 
Ethical hacking
Ethical hackingEthical hacking
Ethical hacking
 
Awareness Security Session 2023 v1.0.pptx.pdf
Awareness Security Session 2023 v1.0.pptx.pdfAwareness Security Session 2023 v1.0.pptx.pdf
Awareness Security Session 2023 v1.0.pptx.pdf
 

Similar to Presentation S4A

Arduino
Arduino Arduino
Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixels
sdcharle
 
Arduino comic v0004
Arduino comic v0004Arduino comic v0004
Arduino comic v0004
DO!MAKERS
 
Arduino Comic-Jody Culkin-2011
Arduino Comic-Jody Culkin-2011Arduino Comic-Jody Culkin-2011
Arduino Comic-Jody Culkin-2011
ΚΔΑΠ Δήμου Θέρμης
 
Fun with arduino
Fun with arduinoFun with arduino
Fun with arduino
Ravikumar Tiwari
 
Arduino - Learning.pdf
Arduino - Learning.pdfArduino - Learning.pdf
Arduino - Learning.pdf
KhalilSedki1
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
salih mahmod
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
avikdhupar
 
Intro_to_Arduino_-_v30.pptx
Intro_to_Arduino_-_v30.pptxIntro_to_Arduino_-_v30.pptx
Intro_to_Arduino_-_v30.pptx
CephasMpandikaKalemb
 
Neno Project.docx
Neno Project.docxNeno Project.docx
Neno Project.docx
AditiBhushan3
 
Introduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and ProgrammingIntroduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and Programming
Emmanuel Obot
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
Tony Olsson.
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
Tony 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 dec13
Singapore Makers Association
 
Robotics Session day 1
Robotics Session day 1Robotics Session day 1
Robotics Session day 1Afzal Ahmad
 
Arduino slides
Arduino slidesArduino slides
Arduino slides
sdcharle
 
Arduino Workshop Slides
Arduino Workshop SlidesArduino Workshop Slides
Arduino Workshop Slides
mkarlin14
 
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
Ziddan Kundrat
 

Similar to Presentation S4A (20)

Arduino
Arduino Arduino
Arduino
 
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
 
Arduino comic v0004
Arduino comic v0004Arduino comic v0004
Arduino comic v0004
 
Arduino Comic-Jody Culkin-2011
Arduino Comic-Jody Culkin-2011Arduino Comic-Jody Culkin-2011
Arduino Comic-Jody Culkin-2011
 
Fun with arduino
Fun with arduinoFun with arduino
Fun with arduino
 
Arduino - Learning.pdf
Arduino - Learning.pdfArduino - Learning.pdf
Arduino - Learning.pdf
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
 
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 slides
Arduino slidesArduino slides
Arduino slides
 
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
 

Recently uploaded

Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 

Recently uploaded (20)

Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 

Presentation S4A

  • 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