- 1 Microcontrollers
- 1.1 Arduino
- 1.2 Adafruit Flora
Computer and processor are generic terms for anything that can run a program, basically.
A controller or microcontroller usually refers to a simple processor that does only one task, like listening to sensors.
In explaining microcontrollers, we’ll distinguish them from computers, which contain more powerful processors that can run an operating system.
what is an Arduino?
Arduino is an open source physical computing platform based on a simple input/output (I/O) board and a development environment that implements the Processing language. Arduino can be used to develop standalone interactive objects
or can be connected to software on your computer.
Arduino is composed of two major parts: the Arduino board, which is the piece of hardware you work on when you build your objects;
and the Arduino IDE, the piece of software you run on your computer. You use the IDE to createa sketch (a little computer program)
that you upload to the Arduino board. The sketch tells the board what to do.
In the meantime, HERE you can find ANYTHING about Arduino, including download the software
find a detailed introduction here []
The pins on your Arduino are the places where you connect wires to construct a circuit (probably in conjunction with a breadboard and some wire. They usually have black plastic ‘headers’ that allow you to just plug a wire right into the board. The Arduino has several different kinds of pins, each of which is labeled on the board and used for different functions.
we start by figuring put if our Arduino is all good or it is somehow damaged ...it is a basic test to check and run a simple script at the same time.
so we have something like this
GOOOD! lets dissect this
- commenting / one line and multiple lines
Lets compile this
Lets upload this
And we should have a Blinking aka Flashing on board LED
How's that different?
The Flora, produced by adafruit, is a microcontroller, just like the Arduino Uno, but designed for wearable projects. Thus, is a little different from the normal boards from the hardware side, since the pins go out to those big wide sewable pads, instead of normal pin headers (like on the Uno)
Before we start we all have to do this click click
Exercise: Wiring Additional LEDs
if you change the Arduino code above from pin D7 to pin D9. you can bink an external LED.
Now, try to write an Arduino code to program additional LEDs with different blinking intervals.
Get some data
now let's read some data from sensors and Flora
We will wire things up like that:
Work with the data
Our motor will like values from 0 to 180 But we receive other values, so how about using the Map function
Still, not happy enough. We want to make sure that before we add our motor, the values do not exceed og go below the range 0-180 So let's Constrain
And finally, lets add the motor
1. Read the analog value of the Photoresistor:
you can reference on Arduino Built-In Examples: [|AnalogReadSerial]
note: don't forget to change the input pin number.
2. use the stretch sensor value to turn on the vibration motor.
Look Arduino Built-In Examples: [|Analog In, Out Serial]
or use the if statement: [|check here]
for example: if the sensor value is bigger then a certain value, the motor will start to vibrate.
3.use a stretch sensor to generate tones and pitch.
Look Arduino Built-In Examples: [|tonePitchFollower]
4.vibrate on heartbeats
and open example GettingStartedProject
int PulseSensorPurplePin = 0;
int PulseSensorPurplePin = A7;
int LED13 = 13;
int LED13 = 10;
and wire the sensor and motor according to the diagram below.
upload your code and it will work!