Introduction To Arduino Programming - City University Of .

Transcription

Introduction to Arduino ProgrammingArduino is an open-source electronics platformbased on easy-to-use hardware and software.It's intended for anyone making interactiveprojects.

Arduino ProjectsHere you can find some of interesting Arduino rojects/

The Arduino UNO board layout

What is a Microcontroller?A microcontroller is a very small computer that hasdigital electronic devices (peripherals) built into itthat helps it control things.These peripherals allow it to sense the worldaround it and drive the actions of external devices.Example of a use: sense a temperature anddepending on the value sensed it could either turnon a fan if things were too warm or turn on a heaterif things were too uino-101/chapter-1

Digital Output : LEDLEDs (Light Emitting Diodes)have been used as indicatorlights for decades in things likealarm clocks and entertainmentsystems, but recently they havestarted taking over manygeneral lighting tasks since theyare durable and very energyefficient.LED converts electrical energyinto light energy.They are polarized (electricityflows in one direction). Thelonger leg is anode, connects tothe power. The shorter iscathode, connects to theground.

LEDs on Arduino UNO boardThe Power LED indicates that the board has power.The TX and RX LEDs indicate serial communications traffic. TX is blinkingwhen transmitting, and RX is blinking when receiving.The Pin 13 LED is connected to the Arduino Digital I/O pin 13 and can be usedfor a variety of software tests without having to add any external hardware tosee the software in action.

BreadboardBreadboard is the primary place we will be buildingcircuits. We have the solderless one.

Breadboard

How an Arduino Program WorksThe Arduino community calls a program a sketch.It has two main functions: setup and loop.void setup(){}void loop(){}runs once, when theArduino is powered on.runs continuously afterthe setup() hascompleted.- here we check forvoltage level on the inputs,and turn on/off theoutputs.

LEDs on Arduino UNO board The Power LED indicates that the board has power. The TX and RX LEDs indicate serial communications traffic. TX is blinking when transmitting, and RX is blinking when receiving. The Pin 13 LED is connected to the Arduino Digital I/O pin 13 and can be used for a variety of soft