Programming Basics (Inputs/Outputs)
Aim: In this lesson, students will learn the input and output modules of the Twin
Science Kit and use them to control output modules. They will discuss problems and
develop physical products to solve these problems.
LEARNING OUTCOMES:
• Decompose (break down) the steps needed to solve a problem into a precise
sequence of instructions.
• Develop a simple physical model to solve a given problem.
• Understand how physical changes represented as numerical values
• Understand how signals are received through electronic circuits
• Choose appropriate inputs and outputs based on the needs
• To learn the difference between transparent, opaque and translucent objects.
BACKGROUND
Twin kit has following input and output modules:
Input Modules:
• Button
• Dimmer
• Proximity Sensor
• Light Sensor
• Sound Trigger
• Motion Trigger
• Remote Control
• Ultrasonic Sensor (On programming board)
Output Modules:
• DC Motor
• Servo Motor
• LED
• Buzzer
• Counter
• Bargraph
• Fan
• RGB LEDs (On programming board)
Ask: What are inputs or outputs? Can you give examples from Twin modules?
Did you notice the color codes?
TUTORIAL 1: OUTPUTS
DO: Open the Twin app and go to Codıng -> New project to create a new project.
You can fınd the general explanation of the IDE below [ click on ! ].
DO : Connect DC motor module to d6, servo motor module to d9, and LED module to d10
as shown in scheme. Afer that write and upload the code below to the programming
module.
ANALYZE: This tutorial is aimed to teach using the output modules. Every code
must start with a Start Block. After the start block, there is a DC motor block.
You should observe that DC motor starts to turn after uploading the program. 2
seconds later servo motor starts to turn and after 2 more seconds, buzzer makes a
noise. A pause block is used between the output blocks in order to understand the
sequence. At the end of the sequence, all the outputs are turned off.
Play with the delay time value, speed value of DC Motor and angle of Servo Motor
and observe what changes.
TUTORIAL 2: INPUTS
DO: Connect a button to d4, a dimmer to d8 and a proximity sensor to d12 and
upload the code below to the programming module. Don’t forget to connect the
signal conductor module to input side of button, dimmer and proximity sensor.
Signal conductor is used to short circuit in order to let the experiment work.
Experiment by pressing the button, using the dimmer and putting your hand in
front of the proximity sensor.
ANALYZE: If module is used to connect the inputs to outputs in this example. 3 of
the sensors gives out different colours when they are triggered.
DID YOU KNOW?
An electric fish is any fish that can generate electric fields. A fish that can generate
electric fields is said to be electrogenic while a fish that has the ability to detect electric
fields is said to be electroreceptive. Most electrogenic fish are also electroreceptive.
Weakly electric fish generate a discharge that is typically less than one volt.
These are too weak to stun prey and instead are used for navigation, object detection
(electrolocation) and communication with other electric fish (electrocommunication).
The process is called as feature detection.
Feature detection is a process by which the nervous system sorts or filters complex
natural stimuli in order to extract behaviorally relevant cues that have a high probability
of being associated with important objects or organisms in their environment, as
opposed to irrelevant background or noise.
Feature detectors are individual neurons—or groups of neurons—in the brain which code
for perceptually significant stimuli. Early in the sensory pathway feature detectors tend
to have simple properties; later they become more and more complex as the features to
which they respond become more and more specific.
Source: Wikipedia (Electric Fish, Feature Detection)
1.Video: https://youtu.be/3LsBse8WKm4 (2:30) *
2.Ted-Ed Video: https://www.youtube.com/watch?v=z0M7_HPSi14 (5:14) *
REAL LIFE EXAMPLE
A signal is an electrical or electromagnetic current that is used for carrying data at
every time frame. It is like a flip-book. In a flipbook, you see a drawing in every time
frame. When you receive all the data packages (drawings) you understand the data and
understand the whole story.