Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
public:crocs:arduino [2014-10-26 13:58] – [Arduino] mukrop | public:crocs:arduino [2014-10-29 12:30] – lnemec | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Arduino ====== | + | ====== |
* Date: 31. 10. 2014 | * Date: 31. 10. 2014 | ||
Line 5: | Line 5: | ||
* Cake: we will see... | * Cake: we will see... | ||
* Cake by: Mirek Jaroš | * Cake by: Mirek Jaroš | ||
+ | * Discussion on A403 wallpainting | ||
+ | |||
+ | ===== What to expect ===== | ||
+ | |||
+ | Introduction to microcontroller programming, | ||
+ | |||
+ | As we learn enough of theoretic background, you will get your hands on Arduino boards and you will have chance to program your own blinking LED or something similar, depending on your time, skill and enthusiasm. | ||
- | [Lukas, please add short description of what you expect us to be doing. 1-2 sentences.] | ||
===== What to prepare ===== | ===== What to prepare ===== | ||
Line 94: | Line 100: | ||
<note important> | <note important> | ||
- | <note warning> | + | <note warning> |
{{ : | {{ : | ||
+ | |||
+ | === Sensors, Analog input and Serial monitor === | ||
+ | |||
+ | Next example will show, how to read values from sensors and how to obtain debugging information from Arduino board. | ||
+ | |||
+ | In order to receive value from sensor, we have to use analog input pins (Arduino UNO has range from A0 to A5) and read values with analogRead function. There are many posibilities what to use as a source of input, you can choose from whatever is avaiable, rotary potentiometer, | ||
+ | |||
+ | Every sensor (save he more complicated ones) has basically three connections, | ||
+ | |||
+ | Next is serial output, which can be used either for debugging or logging values. Output needs to be inicialized in setup phase with following '' | ||
+ | |||
+ | <code C> | ||
+ | int sensorPin = A0; // select the input pin for the potentiometer | ||
+ | int sensorValue = 0; // variable to store the value | ||
+ | |||
+ | void setup() { | ||
+ | // | ||
+ | pinMode(sensorPin, | ||
+ | Serial.begin(9600); | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | // read the value | ||
+ | sensorValue = analogRead(sensorPin); | ||
+ | //print value on serial | ||
+ | Serial.println(sensorValue); | ||
+ | //wait | ||
+ | delay(1000); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | <note important> | ||
+ | |||
+ | ===== How to continue ===== | ||