3. Muuttujat, tietotyypit
- http://playground.arduino.cc/Code/DatatypePractices
- http://www.ohjelmointiputka.net/oppaat/opas.php?tunnus=cohj_2
- https://www.arduino.cc/en/Reference/Scope
- https://www.arduino.cc/en/Reference/Array
Tehtävät
- Mitä arvoja seuraavat muuttujat voivat saada?
- int a;
- boolean b;
- char c;
- byte d;
- long e;
- float f;
- unsigned int g;
- Mitä tarkoittaa const (esim. const int avain;)? Milloin ja miksi sitä kannattaa käyttää?
- Mitä tarkoitetaan globaalilla ja lokaalilla muuttujalla?
- Selitä mitä seuraavat määrittelyt tarkoittavat (siis kerro selkokielellä mitä kullakin rivillä tarkoitetaan).
- int sensorPin = A0; // select the input pin for the potentiometer
- int ledPin = 13; // select the pin for the LED
- int sensorValue = 0;
- const int sensorMin = 0; // sensor minimum, discovered through experiment
- const int sensorMax = 600; // sensor maximum, discovered through experiment
- String firstName = "Benjamin";
- Määritä muuttuja (muuttujan nimi ja tyyppi) seuraaville:
- henkilön pituus
- henkilön paino
- tunnussana
- pii (3.14159)
- auton matkamittari
- digitaalipinnin numero