<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://elvis.hcw.ac.at/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=CCinay</id>
	<title>Elvis Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://elvis.hcw.ac.at/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=CCinay"/>
	<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php/Special:Contributions/CCinay"/>
	<updated>2026-09-10T13:03:57Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.5</generator>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_First_Steps&amp;diff=4555</id>
		<title>Arduino Board Uno Rev3-Atmega 328: First Steps</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_First_Steps&amp;diff=4555"/>
		<updated>2020-08-27T23:40:18Z</updated>

		<summary type="html">&lt;p&gt;CCinay: /* Arduino UNO Überblick */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The Arduino UNO R3 is the current version of the Arduino UNO. This is the standard Arduino. It is completely sufficient for most projects and is very affordable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_oard_Uno_Rev3-Atmega_328.jpg|thumb|none|350px|Arduino_oard_Uno_Rev3-Atmega_328]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arduino UNO Overview ==&lt;br /&gt;
Main component is a microcontroller from ATMEL, the ATMEGA 328P. It contains the Arduino bootloader software. It allows to execute Arduino programs. The Arduino UNO has 14 digital I/O pins, six of which can be used as PWM channels (allow e.g. dimming of LEDs). Six analog input pins are also available. The board handles communication via UART, SPI and I2C (TWI).&lt;br /&gt;
&lt;br /&gt;
For data exchange and programming it is connected to the computer via USB. Since the microcontroller cannot communicate directly via USB, there is a second microcontroller (ATmega8U2) on the Arduino UNO which does the &amp;quot;translation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Structure of an Arduino UNO ==&lt;br /&gt;
In the following figure the most important components of an Arduino UNO are listed with short descriptions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_oard_Uno_Rev3-Atmega_328-Overview.JPG|thumb|none|750px|Arduino_oard_Uno_Rev3-Atmega_328-Overview]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pin strips on both sides of the Arduino can be used to connect the Arduino to external electronic components or a circuit board using jumper cables:&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;The analog pins A0 to A5&amp;lt;/b&amp;gt; are suitable as &amp;lt;b&amp;gt;sensor inputs for measuring voltage values between 0V and 5V;&amp;lt;/b&amp;gt; a built-in analog-to-digital converter&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; maps the measured voltage values to a numerical range from &amp;lt;b&amp;gt;0 (no voltage) to 1023 (maximum voltage, i.e. 5V)&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;The digital pins 0 to 13&amp;lt;/b&amp;gt; can also be defined as sensor inputs: An applied voltage of &amp;gt;2.5V is interpreted as &amp;lt;b&amp;gt;HIGH (numerical value 1)&amp;lt;/b&amp;gt;, &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; a lower voltage as &amp;lt;b&amp;gt;LOW (numerical value 0)&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;The digital pins 0 to 13&amp;lt;/b&amp;gt; can also be &amp;lt;b&amp;gt;defined as digital voltage outputs&amp;lt;/b&amp;gt;: They output a voltage of about &amp;lt;b&amp;gt;5V in HIGH&amp;lt;/b&amp;gt; mode and &amp;lt;b&amp;gt;0V in LOW mode&amp;lt;/b&amp;gt;. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; However, the &amp;lt;b&amp;gt;current is limited to 40mA&amp;lt;/b&amp;gt;; if necessary, the voltage of the pins is automatically reduced to reach this limit.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; A &amp;lt;b&amp;gt;special feature is the digital pin 13&amp;lt;/b&amp;gt;: There the &amp;lt;b&amp;gt;output current is limited to only 20mA&amp;lt;/b&amp;gt;, so that an &amp;lt;b&amp;gt;LED can be connected there directly&amp;lt;/b&amp;gt; &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; (without series resistor) (directly &amp;lt;b&amp;gt;next to pin 13 is a GND pin&amp;lt;/b&amp;gt;, so that not even a plug-in board is necessary for this). &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; Newer versions of the Arduino UNO even have an SMD LED permanently installed between pin 13 and GND.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;The pins (3, 5, 6, 9, 10, 11)&amp;lt;/b&amp;gt; marked with the tilde &amp;lt;b&amp;gt;character ~ &amp;lt;/b&amp;gt; can, when set as output pins, also switch back and forth &amp;lt;b&amp;gt;between 0V and 5V&amp;lt;/b&amp;gt; very&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; quickly by means of a so-called &amp;lt;b&amp;gt;pulse width modulation (PWM)&amp;lt;/b&amp;gt;.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; You can specify values between &amp;lt;b&amp;gt;0 and 255&amp;lt;/b&amp;gt;, where &amp;lt;b&amp;gt;0 stands for &amp;quot;always off&amp;quot;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;255 for &amp;quot;always on&amp;quot;&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The other connectors on the board (AREF and ICSP headers) are not important for normal use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Notes&amp;lt;/b&amp;gt;: For example, &amp;lt;b&amp;gt;PWM can be used&amp;lt;/b&amp;gt; to drive a motor or a light bulb at a value of 128 with only &amp;lt;b&amp;gt;&amp;quot;half power&amp;quot;&amp;lt;/b&amp;gt;, because it is only supplied with voltage for half of the time and the other half of the time is idle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;An LED can also be &amp;quot;dimmed&amp;quot;&amp;lt;/b&amp;gt; in this way: The LED is fast enough to blink at the same frequency, but our eye is not. As we can only perceive 25 frames per second, an LED that is only on half of the time appears darker to us than a permanently bright LED. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Typical Arduino applications ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Electronics&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Robotics&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Controls&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Sensor data acquisition&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Programming close to the hardware&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR WAN 1300 LoRa]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR LoRa Gateway Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://store.arduino.cc/arduino-uno-rev3&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/arduino-uno/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://en.wikipedia.org/wiki/Arduino_Uno&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=STM32_LoRa_Discovery_Kit:_First_Steps&amp;diff=4554</id>
		<title>STM32 LoRa Discovery Kit: First Steps</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=STM32_LoRa_Discovery_Kit:_First_Steps&amp;diff=4554"/>
		<updated>2020-08-11T22:15:01Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
STMicroelectronics B-L072Z-LRWAN1 STM32 LoRa Discovery Board is a development tool to learn and develop solutions based on LoRa and/or FSK/OOK technologies. This tool features an all-in-one open module solution (by Murata), which is the smallest and cheapest on the market, to address wide area network (LPWAN) wireless modules that support the LoRaWAN long range wireless protocol.&lt;br /&gt;
The Discovery board comes with the certified embedded software (I-CUBE-LRWAN) to provide the means to set up a complete LoRaWAN node. The I-CUBE-LRWAN is LoRaWAN class A certified and sustains the Class C.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Disco-Overview.jpg|thumb|none|400px|STM32-LoRa-Disco-Overview]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Embedded ultra low power STM32L072CZ series MCUs based on ARM Cortex -M0+ core&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; 192 Kbytes of flash memory, 20 Kbytes of RAM, 20 Kbytes of EEPROM&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; 4-channel, 12bit ADC, 2 x DAC, USB 2.0 FS &amp;amp; 157dB maximum link budget&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Low RX current of 10mA, 200nA register retention &amp;amp; preamble detection&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; System requirements are Windows OS (XP, 7, 8, 10), Linux or macOS and USB type-A to Micro-B cable&lt;br /&gt;
&lt;br /&gt;
=== Hardware block diagramm ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Hardware-block-Diagramm.JPG|thumb|none|400px|STM32-LoRa-Hardware-block-Diagramm]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuring STM32 LoRa Discovery Kit ==&lt;br /&gt;
Now, we will programm the STM32 LoRa Discovery Kit B-L072Z-LRWAN1 and the Nucleo Expansion (X-NUCLEO-IKS01A1) as the Node device. &lt;br /&gt;
[https://www.st.com/content/st_com/en/products/embedded-software/mcu-mpu-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/i-cube-lrwan.html &amp;lt;br&amp;gt;Unzip I-CUBE-LRWAN] and start [http://www2.keil.com/stmicroelectronics-stm32/mdk Keil uVision].&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; On Keil, click Project &amp;gt; Open &amp;gt; Open Project..., select the project inside the unzipped I-CUBE-LRWAN&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; STM32CubeExpansion_LRWAN_V1.3.1\Projects\B-L072Z-LRWAN1\Applications\LoRa\End_Node\MDK-ARM&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The original demo was originally set to the european frequency 868MHz so we&#039;ll need to modify it to work on the 915MHz frequency.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; Right-click on the project and select &amp;quot;Options for Target &#039;mlm32l07x01&#039; ...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32CubeExpansion_LRWAN_V1.3.1_Projects.jpg|thumb|none|400px|STM32CubeExpansion_LRWAN_V1.3.1_Projects]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Select the &amp;quot;C / C ++&amp;quot; tab, change &amp;quot;REGION_EU868&amp;quot; to &amp;quot;REGION_US915&amp;quot; and add the define &amp;quot;X_NUCLEO_IKS01A1&amp;quot;. Click OK to proceed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Step2.JPG|thumb|none|400px|STM32-LoRa-Step2]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Right-click on &amp;quot;Drivers/BSP/X_NUCLEO_IKS01A2&amp;quot; &amp;gt; Options for Group...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Step3.JPG|thumb|none|400px|STM32-LoRa-Step3]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Uncheck &amp;quot;Include in Target Build&amp;quot;. Click Ok.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Step4.JPG|thumb|none|400px|STM32-LoRa-Step4]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Then right-click on &amp;quot;Drivers/BSP/X_NUCLEO_IKS01A1&amp;quot; &amp;gt; Options for Group...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Step5.JPG|thumb|none|400px|STM32-LoRa-Step5]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check &amp;quot;Include in Target Build&amp;quot;. Click Ok.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Step6.JPG|thumb|none|400px|STM32-LoRa-Step6]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Open the file &amp;quot;Commissioning.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Step7.JPG|thumb|none|400px|STM32-LoRa-Step7]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Make the following code changes on line 77:&lt;br /&gt;
&amp;lt;pre&amp;gt;#define OVER_THE_AIR_ACTIVATION  0 &amp;lt;/pre&amp;gt;&lt;br /&gt;
line 89:&lt;br /&gt;
&amp;lt;pre&amp;gt;#define STATIC_DEVICE_EUI 1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Step8.JPG|thumb|none|400px|STM32-LoRa-Step8]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and line 122:&lt;br /&gt;
&amp;lt;pre&amp;gt;#define STATIC_DEVICE_ADDRESS 1 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Step9.JPG|thumb|none|400px|STM32-LoRa-Step9]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[STM32 LoRa and Sigfox Discovery kit]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[X-NUCLEO-IKS01A2 nucleo expansion board]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.hackster.io/victorffs/environmental-sensing-using-lora-and-stm32-c0136e&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.st.com/content/st_com/en/search.html#q=lrwan-t=tools-page=1&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.electronicdesign.com/technologies/embedded-revolution/article/21806418/a-handson-look-at-the-stm32-kit-for-longrange-wireless&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.hackster.io/victorffs/environmental-sensing-using-lora-and-stm32-c0136e&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Disco-Overview.jpg&amp;diff=4553</id>
		<title>File:STM32-LoRa-Disco-Overview.jpg</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Disco-Overview.jpg&amp;diff=4553"/>
		<updated>2020-08-11T22:14:15Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=STM32_LoRa_Discovery_Kit:_First_Steps&amp;diff=4552</id>
		<title>STM32 LoRa Discovery Kit: First Steps</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=STM32_LoRa_Discovery_Kit:_First_Steps&amp;diff=4552"/>
		<updated>2020-08-11T22:12:51Z</updated>

		<summary type="html">&lt;p&gt;CCinay: Created page with &amp;quot;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;  == Summary == STMicroelectronics B-L072Z-LRWAN1 STM32 LoRa Discovery Board is a development tool to learn and develop solutions based on LoRa a...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
STMicroelectronics B-L072Z-LRWAN1 STM32 LoRa Discovery Board is a development tool to learn and develop solutions based on LoRa and/or FSK/OOK technologies. This tool features an all-in-one open module solution (by Murata), which is the smallest and cheapest on the market, to address wide area network (LPWAN) wireless modules that support the LoRaWAN long range wireless protocol.&lt;br /&gt;
The Discovery board comes with the certified embedded software (I-CUBE-LRWAN) to provide the means to set up a complete LoRaWAN node. The I-CUBE-LRWAN is LoRaWAN class A certified and sustains the Class C.&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Embedded ultra low power STM32L072CZ series MCUs based on ARM Cortex -M0+ core&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; 192 Kbytes of flash memory, 20 Kbytes of RAM, 20 Kbytes of EEPROM&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; 4-channel, 12bit ADC, 2 x DAC, USB 2.0 FS &amp;amp; 157dB maximum link budget&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Low RX current of 10mA, 200nA register retention &amp;amp; preamble detection&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; System requirements are Windows OS (XP, 7, 8, 10), Linux or macOS and USB type-A to Micro-B cable&lt;br /&gt;
&lt;br /&gt;
=== Hardware block diagramm ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Hardware-block-Diagramm.JPG|thumb|none|400px|STM32-LoRa-Hardware-block-Diagramm]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuring STM32 LoRa Discovery Kit ==&lt;br /&gt;
Now, we will programm the STM32 LoRa Discovery Kit B-L072Z-LRWAN1 and the Nucleo Expansion (X-NUCLEO-IKS01A1) as the Node device. &lt;br /&gt;
[https://www.st.com/content/st_com/en/products/embedded-software/mcu-mpu-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/i-cube-lrwan.html &amp;lt;br&amp;gt;Unzip I-CUBE-LRWAN] and start [http://www2.keil.com/stmicroelectronics-stm32/mdk Keil uVision].&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; On Keil, click Project &amp;gt; Open &amp;gt; Open Project..., select the project inside the unzipped I-CUBE-LRWAN&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; STM32CubeExpansion_LRWAN_V1.3.1\Projects\B-L072Z-LRWAN1\Applications\LoRa\End_Node\MDK-ARM&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The original demo was originally set to the european frequency 868MHz so we&#039;ll need to modify it to work on the 915MHz frequency.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; Right-click on the project and select &amp;quot;Options for Target &#039;mlm32l07x01&#039; ...&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32CubeExpansion_LRWAN_V1.3.1_Projects.jpg|thumb|none|400px|STM32CubeExpansion_LRWAN_V1.3.1_Projects]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Select the &amp;quot;C / C ++&amp;quot; tab, change &amp;quot;REGION_EU868&amp;quot; to &amp;quot;REGION_US915&amp;quot; and add the define &amp;quot;X_NUCLEO_IKS01A1&amp;quot;. Click OK to proceed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Step2.JPG|thumb|none|400px|STM32-LoRa-Step2]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Right-click on &amp;quot;Drivers/BSP/X_NUCLEO_IKS01A2&amp;quot; &amp;gt; Options for Group...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Step3.JPG|thumb|none|400px|STM32-LoRa-Step3]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Uncheck &amp;quot;Include in Target Build&amp;quot;. Click Ok.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Step4.JPG|thumb|none|400px|STM32-LoRa-Step4]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Then right-click on &amp;quot;Drivers/BSP/X_NUCLEO_IKS01A1&amp;quot; &amp;gt; Options for Group...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Step5.JPG|thumb|none|400px|STM32-LoRa-Step5]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check &amp;quot;Include in Target Build&amp;quot;. Click Ok.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Step6.JPG|thumb|none|400px|STM32-LoRa-Step6]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Open the file &amp;quot;Commissioning.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Step7.JPG|thumb|none|400px|STM32-LoRa-Step7]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Make the following code changes on line 77:&lt;br /&gt;
&amp;lt;pre&amp;gt;#define OVER_THE_AIR_ACTIVATION  0 &amp;lt;/pre&amp;gt;&lt;br /&gt;
line 89:&lt;br /&gt;
&amp;lt;pre&amp;gt;#define STATIC_DEVICE_EUI 1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Step8.JPG|thumb|none|400px|STM32-LoRa-Step8]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and line 122:&lt;br /&gt;
&amp;lt;pre&amp;gt;#define STATIC_DEVICE_ADDRESS 1 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:STM32-LoRa-Step9.JPG|thumb|none|400px|STM32-LoRa-Step9]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[STM32 LoRa and Sigfox Discovery kit]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[X-NUCLEO-IKS01A2 nucleo expansion board]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.hackster.io/victorffs/environmental-sensing-using-lora-and-stm32-c0136e&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.st.com/content/st_com/en/search.html#q=lrwan-t=tools-page=1&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.electronicdesign.com/technologies/embedded-revolution/article/21806418/a-handson-look-at-the-stm32-kit-for-longrange-wireless&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.hackster.io/victorffs/environmental-sensing-using-lora-and-stm32-c0136e&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Hardware-block-Diagramm.JPG&amp;diff=4551</id>
		<title>File:STM32-LoRa-Hardware-block-Diagramm.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Hardware-block-Diagramm.JPG&amp;diff=4551"/>
		<updated>2020-08-11T22:08:27Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Step9.JPG&amp;diff=4550</id>
		<title>File:STM32-LoRa-Step9.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Step9.JPG&amp;diff=4550"/>
		<updated>2020-08-11T21:55:30Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Step8.JPG&amp;diff=4549</id>
		<title>File:STM32-LoRa-Step8.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Step8.JPG&amp;diff=4549"/>
		<updated>2020-08-11T21:53:20Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Step7.JPG&amp;diff=4548</id>
		<title>File:STM32-LoRa-Step7.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Step7.JPG&amp;diff=4548"/>
		<updated>2020-08-11T21:44:16Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Step6.JPG&amp;diff=4547</id>
		<title>File:STM32-LoRa-Step6.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Step6.JPG&amp;diff=4547"/>
		<updated>2020-08-11T21:42:16Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Step5.JPG&amp;diff=4546</id>
		<title>File:STM32-LoRa-Step5.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Step5.JPG&amp;diff=4546"/>
		<updated>2020-08-11T21:35:31Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Step4.JPG&amp;diff=4545</id>
		<title>File:STM32-LoRa-Step4.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Step4.JPG&amp;diff=4545"/>
		<updated>2020-08-11T20:13:31Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Step3.JPG&amp;diff=4544</id>
		<title>File:STM32-LoRa-Step3.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Step3.JPG&amp;diff=4544"/>
		<updated>2020-08-11T19:51:36Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Step2.JPG&amp;diff=4543</id>
		<title>File:STM32-LoRa-Step2.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32-LoRa-Step2.JPG&amp;diff=4543"/>
		<updated>2020-08-11T19:25:41Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32CubeExpansion_LRWAN_V1.3.1_Projects.jpg&amp;diff=4542</id>
		<title>File:STM32CubeExpansion LRWAN V1.3.1 Projects.jpg</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:STM32CubeExpansion_LRWAN_V1.3.1_Projects.jpg&amp;diff=4542"/>
		<updated>2020-08-11T19:08:33Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4541</id>
		<title>Arduino Board Uno Rev3-Atmega 328: Programming Guide</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4541"/>
		<updated>2020-08-10T20:57:30Z</updated>

		<summary type="html">&lt;p&gt;CCinay: /* Serial.println(data) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The &amp;lt;b&amp;gt;Arduino IDE&amp;lt;/b&amp;gt; is a cross-platform Java application that acts as a program code editor and compiler and is also able to send firmware serially to the board. The development environment is based on Processing, an IDE designed to program artists, who normally do not have much contact with the art world programming environments. The programming language is based on Wiring, a C similar language which has a similar scope for a more restricted board design, whose IDE is also based on processing. Make sure you have an updated version of &amp;lt;b&amp;gt;[https://www.arduino.cc/en/Main/Software Arduino IDE]&amp;lt;/b&amp;gt; installed.&lt;br /&gt;
&lt;br /&gt;
== Struktur ==&lt;br /&gt;
The basic structure of the Arduino programming language is relatively simple and is divided into at least two parts. These two required parts or functions enclose blocks of statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup() {     // put your setup code here, to run once:&lt;br /&gt;
}&lt;br /&gt;
void loop() {      // put your main code here, to run repeatedly:&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Here &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; is the preparation and &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; is the execution. Both functions are necessary to execute the program. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup function should follow the variable definition, which must be listed before. Setup must be run through as the first function in a program. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; It is executed only once and is used to set &amp;lt;b&amp;gt;PinMode&amp;lt;/b&amp;gt; or to initiate serial communication. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set PinModes or start serial communication. The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; appear in every program, even if it does not contain any instructions.  &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; After the &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function follows the &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; function. It contains program code that is executed continuously in an infinite loop - read inputs, trigger &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; outputs, etc. This function is the core of all Arduino programs and does the main work. &lt;br /&gt;
&lt;br /&gt;
=== setup() ===&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set &amp;lt;b&amp;gt;PinModes&amp;lt;/b&amp;gt; or start serial communication.&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must appear in every program, even if it does not contain any instructions. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(pin, OUTPUT);     // &#039;pin&#039; define as output&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== loop() ===&lt;br /&gt;
After running through the &amp;lt;b&amp;gt;setup() function&amp;lt;/b&amp;gt;, the &amp;lt;b&amp;gt;loop() function&amp;lt;/b&amp;gt; does exactly what its name suggests and runs in an endless loop. This allows the program to interact with the Arduino board via changes, reactions and controls. &lt;br /&gt;
&amp;lt;pre&amp;gt;void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(pin, HIGH);    // switches &#039;pin&#039; on&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
 digitalWrite(pin, LOW);     // switches &#039;pin&#039; off&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
A function is a block of program code that has a name and a set of instructions that are executed when the function is called. The functions &amp;lt;b&amp;gt;void setup()&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;void loop()&amp;lt;/b&amp;gt; have already been explained. There are more built-in functions that will be discussed later. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Type FunctionName(parameter)&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following integer type function &amp;lt;b&amp;gt;delayVal()&amp;lt;/b&amp;gt; is used to insert a delay value into a program by reading a potentiometer. First a local variable &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is created. Next, &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is equated with the position of the potentiometer, which can have a value between &amp;lt;b&amp;gt;0 and 1023&amp;lt;/b&amp;gt;. The value is then &amp;lt;b&amp;gt;divided by 4 to get a scale from 0 to 255&amp;lt;/b&amp;gt; and at the end the result of the function is returned to the main program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int delayVal()&lt;br /&gt;
{&lt;br /&gt;
 int v;                     // create temporary variable &#039;v&lt;br /&gt;
 v = analogRead(pot);       // read potentiometer Value&lt;br /&gt;
 v /= 4;                    // Convert from 0-1023 to 0-255&lt;br /&gt;
 return v;                  // return the calculated value&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== {} curly brackets ===&lt;br /&gt;
Curly brackets (also called &amp;lt;b&amp;gt;&#039;curly brackets&#039;&amp;lt;/b&amp;gt;) define the start and end of function and statement blocks as in the &amp;lt;b&amp;gt;&#039;void loop()&#039;&amp;lt;/b&amp;gt; function and also in the &amp;lt;b&amp;gt;&#039;for&#039; and &#039;if&#039;&amp;lt;/b&amp;gt; statement. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type function()&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: An opening curved bracket &#039;{&#039; must always be followed by a closing curved bracket &#039;}&#039;. Here it is often said that the number of brackets must be balanced. Unbalanced parentheses often lead to cryptic, inscrutable errors in the compiler, which are sometimes hard to find, especially in large programs.&lt;br /&gt;
&lt;br /&gt;
The Arduino programming environment helps to check that the curved brackets are balanced. To do this, simply select a brace or click just behind it, and the logically connected counterpart is highlighted. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ;semicolon ===&lt;br /&gt;
A semicolon must be used at the end of a statement and is used to separate the elements of a program.&lt;br /&gt;
A semicolon is also used to separate the elements of a for loop. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int x = 13; // declares variable &#039;x&#039; as integer with value 13&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Forgetting a semicolon at the end of a line leads to an error in the compiler. The error description can be very clear and directly point to the missing semicolon, but this does not have to be the case. If an inscrutable or apparently illogical error is reported, the first thing to do is to add missing semicolons near the reported error. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== /*... */ block comments ===&lt;br /&gt;
Block comments or multiline comments are text areas that are ignored by the program. They are used for longer descriptions or comments and help other authors to understand program parts. They start with /* and end with */ and can cover several lines. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/* This is an inserted block comment&lt;br /&gt;
 please do not forget the closing comment -&lt;br /&gt;
 These must be balanced&lt;br /&gt;
*/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== // Single line comments ===&lt;br /&gt;
Simple single-line comments are defined with a // at the beginning of the line and end with the end of the line. They are ignored by the program and do not consume memory. &lt;br /&gt;
&amp;lt;pre&amp;gt;// this is a single line comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
A variable is the name of a numeric value with a name and memory location for later use in a program. A variable must be declared and optionally provided with a value. The following example declares a variable &#039;inputVariable&#039; and assigns the value of analog pin 2 to it: &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;          // declares a variable and&lt;br /&gt;
                                     // sets its value to 0&lt;br /&gt;
inputVariable = analogRead(2);      // sets the value of the variable equal&lt;br /&gt;
                                    // with the value of analog pin 2 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;inputVariable&#039; is the variable itself. The first line explains that its data type is &#039;int&#039;, which is the short expression for integer. The second line gives the variable the value of the analog pin 2, making the value of the pin available everywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Variables should always have descriptive names as clearly as possible to make the code easier to read.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Declaration of variables: ===&lt;br /&gt;
All variables must be declared before use. Declaring a variable means defining its type such as int, long, float, etc., giving it a name and optionally an initial value.This only needs to be done once in the program. Afterwards the value can be changed at any time by calculations or various assignments. &lt;br /&gt;
&lt;br /&gt;
The following example declares &#039;inputVariable&#039; as &#039;int&#039;, i.e. integer data type and sets the initial value to 0. This is called a &#039;simple assignment&#039;. &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A variable can be declared at many places in the program. The location of the declaration determines which program parts have access to the variable. &lt;br /&gt;
&lt;br /&gt;
== Data types ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;byte&amp;lt;/b&amp;gt;: Byte stores an &amp;lt;b&amp;gt;8-bit numeric&amp;lt;/b&amp;gt;, integer value without decimal point. The &amp;lt;b&amp;gt;value&amp;lt;/b&amp;gt; can be between &amp;lt;b&amp;gt;0 and 255&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;byte someVariable = 180;         // declares &#039;someVariable as a &#039;byte&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;int&amp;lt;/b&amp;gt;: Integers are the most common data type for storing integer values without decimal point. Its &amp;lt;b&amp;gt;value&amp;lt;/b&amp;gt; is &amp;lt;b&amp;gt;16 bits and ranges from -32,767 to 32,768&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;int someVariable = 1500;        // declares &#039;someVariable as an &#039;integer&#039; data type&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;long&amp;lt;/b&amp;gt;: Data type for long integers with extended size, without decimal point, &amp;lt;b&amp;gt;stored in a 32-bit&amp;lt;/b&amp;gt; value in a spectrum from &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp;&amp;lt;b&amp;gt;-2,147,483,648 to 2,147,483,647&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;long someVariable = 90000;      // declares &#039;someVariable as a &#039;long&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;float&amp;lt;/b&amp;gt;: A data type for floating point values or numbers with decimal places. Floating point numbers have a better resolution than integers and are&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; expressed as &amp;lt;b&amp;gt;32-bit values with a spectrum from -3.4028235E+38 to 3.4028235E+38&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;float someVariable = 3.14;      // declares &#039;someVariable&#039; as a &#039;float&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Floating point numbers are not precise and may lead to strange results when compared. Also, floating-point calculations are much slower than with integer data types. Calculations with floating-point values should be avoided if possible. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;arrays&amp;lt;/b&amp;gt;: An array is a collection of values that are accessed with an index number.&lt;br /&gt;
Each value in the array can be accessed by retrieving the name of&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; the array and the index number of the value. The index number always starts at 0 for an array.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; An array must be declared and optionally assigned values before it can be used.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[] = {value0, value1, value2...} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the same way it is possible to declare an array first with datatype and size and later to give a value to an index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[5];        // declare datatype &#039;integer&#039; as array with 5 Positions&lt;br /&gt;
myArray[3] = 10;            // gives the 4th index the value 10  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To read the value of an array you can simply assign it to a variable specifying the array and the index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;x = myArray[3];       // x now has the value 10 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arrays are often used for loops, where the counter of the loop is also used as index position for the values in the array. The following example uses an array to make an LED flicker. With a for loop and a counter starting at 0 an index position in the array is read, sent to the LED pin, paused for 200ms and then the same is done with the next index position. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 10; // LED on pin 10&lt;br /&gt;
byte flicker[] = {180, 30, 255, 200, 10, 90, 150, 60};    // array with 8 different values&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);    // Sets the OUTPUT pin&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for(int i=0; i&amp;lt;7; i++)               // loop equals the number&lt;br /&gt;
 { // of the values in the array&lt;br /&gt;
 analogWrite(ledPin, flicker[i]);     // writes the index value to the LED&lt;br /&gt;
 delay(200);                          // 200ms pause&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Digitaler Input - Output ==&lt;br /&gt;
=== pinMode(pin,mode) ===&lt;br /&gt;
Used in &#039;void setup()&#039; to configure a specific pin as either input or output. &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, OUTPUT); // sets &#039;pin&#039; as output &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arduino digital pins are inputs by default, so they don&#039;t need to be specified as inputs with &#039;pinMode()&#039;. Pins configured as inputs have a high impedance state. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: There are also comfortable 20 k &#039;pullup&#039; resistors in the ATmega chip which are accessible via software.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These built-in &#039;pullup&#039; resistors can be accessed in the following way: &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, INPUT);        // sets &#039;pin&#039; as input&lt;br /&gt;
digitalWrite(pin, HIGH);        // switches on the &#039;Pullup&#039; resistor&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pullup resistors are normally used to connect inputs like switches. In the example shown here it is noticeable that the pin is not defined as an output&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; although it is written to. It is only the method to activate the internal &#039;pullup&#039; resistor.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pins configured as output are in a low impedance state and can be loaded with a maximum of 40 mAmpere current from connected elements&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; and circuits. This is enough to make an LED light up (don&#039;t forget the serial resistor), but not enough to drive most relays, solenoids or motors.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Short circuits at the Arduino pins as well as too high current can destroy the output pin or even the whole ATmega chip. For this reason it is a good idea&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; to connect an output pin with external elements in series with a 470 or 1K resistor to&lt;br /&gt;
switch.&lt;br /&gt;
&lt;br /&gt;
=== digitalRead(pin) ===&lt;br /&gt;
digitalRead(pin)&#039; reads the value from a specified digital pin, with the result either HIGH or LOW. The pin can be set either as a variable or constant (0-13). &lt;br /&gt;
&amp;lt;pre&amp;gt;value = digitalRead(Pin);      // sets &#039;value&#039; equal to the input pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
digitalWrite(pin,value)&lt;br /&gt;
Outputs either logic level HIGH or LOW at a specified pin. The pin can be set as a variable or constant (0-13).&lt;br /&gt;
&amp;lt;pre&amp;gt;digitalWrite(pin, HIGH);       // sets &#039;pin&#039; to high&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example reads a button on a digital input and switches an LED on when the button is pressed: &lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 13;            // LED connected to pin 13&lt;br /&gt;
int pin = 7;                 // Button connected to pin 7&lt;br /&gt;
int value = 0;              // Variable to store the readout value&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(led, OUTPUT);    // defines pin 13 as output&lt;br /&gt;
 pinMode(pin, INPUT);     // sets pin 7 as input&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = digitalRead(pin);    // sets &#039;value&#039; equal to&lt;br /&gt;
 // the input pin&lt;br /&gt;
 digitalWrite(led, value);    // sets &#039;led&#039; equal to the&lt;br /&gt;
}                             // Value of the button&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Analoger Input - Output ==&lt;br /&gt;
=== analogRead(pin) ===&lt;br /&gt;
Reads the value of a specified analog pin with a 10 bit resolution. This function is only available for pins (0-5). The resulting integer values have a spectrum from 0 to 1023. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = analogRead(pin);     // sets &#039;value&#039; equal to &#039;pin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Unlike digital pins, analog pins do not have to be declared as input or output first. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analogWrite(pin, value) ===&lt;br /&gt;
Writes pseudo-analog values to an output pin using hardware-based pulse width modulation (PWM). On newer Arduino boards with the ATmega 168 chip this function is applicable to pins 3, 5, 6, 9, 10 and 11. Older Arduinos with the ATmega8 only support pins 9,10 and 11. The value can be set as a variable or constant in the range 0-255.&lt;br /&gt;
&amp;lt;pre&amp;gt;analogWrite(pin, value);     // writes &#039;value&#039; to the analog &#039;pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A value of 0 generates a uniform voltage of 0 volts at a fixed pin; a value of 255 generates a uniform voltage of 5 volts at a fixed pin. For values between 0 and 255, the pin changes very quickly between 0 and 5 volts - the higher the value, the longer the pin is HIGH (5 volts). For a value of 64, the pin is at 0 volts for three-quarters of the time and at 5 volts for one-quarter of the time. A value of 128 means that the output voltage is HIGH half of the time and LOW the other half. A value of 192 means that the voltage at the pin measures 0 volts at one quarter of the time and the full 5 volts at three quarters of the time. &lt;br /&gt;
&lt;br /&gt;
Because this is a hardware-based function, the constant wave runs independently of the program until the next change of state via analogWrite (or a call to digitalRead or digitalWrite on the same pin). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: In contrast to digital pins, analog pins do not have to be declared as input or output before. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The following example reads an analog value from &#039;pin&#039;, converts the value by dividing it by 4 and then outputs it as a PWM signal to &#039;led&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 10;    // LED with 220 resistor at pin 10&lt;br /&gt;
int pin = 0;         // Potentiometer at analog pin 0&lt;br /&gt;
int value;           // Value for readout&lt;br /&gt;
&lt;br /&gt;
void setup(){}      // no setup required&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = analogRead(pin);      // sets &#039;value&#039; equal to &#039;pin&lt;br /&gt;
 value /= 4; // converts 0-1023 into 0-255&lt;br /&gt;
 analogWrite(led, value);     // outputs the PWM signal &#039;led&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Random functions ==&lt;br /&gt;
=== randomSeed(seed) ===&lt;br /&gt;
Sets a value or &#039;Seed&#039; as starting point for the random() function.&lt;br /&gt;
&amp;lt;pre&amp;gt;randomSeed(value);       // sets &#039;value&#039; as the random seed&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Arduino itself is not able to produce a truly random value. With randomSeed() a variable can be used as &#039;seed&#039; to get better random results. For example, millis() or analogRead() can be used as a seed variable or function to use electrical noise through the analog pin as an output for random values. &lt;br /&gt;
&lt;br /&gt;
=== random(min, max) ===&lt;br /&gt;
The random function allows the generation of pseudo-random values within a defined range of minimum and maxium values. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = random(100, 200);        // sets &#039;value&#039; with a random number between 100 and 200 equal &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example generates a random value between 0 and 255 and outputs it as PWM signal on a PWM pin. &lt;br /&gt;
&amp;lt;pre&amp;gt;int randNumber;      // Variable to store the random value&lt;br /&gt;
int led = 10;            // LED with 220 Ohm resistor at pin 10&lt;br /&gt;
&lt;br /&gt;
void setup() {}          // no setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 randomSeed(millis());              // uses millis() as seed&lt;br /&gt;
 randNumber = random(255);          // Random number in the range 0-255&lt;br /&gt;
 analogWrite(led, randNumber);      // PWM signal as output&lt;br /&gt;
 delay(500);                        // half second pause&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Serial communication ==&lt;br /&gt;
=== Serial.begin(rate) ===&lt;br /&gt;
Serial.begin(rate)&#039; Opens the serial port and sets the baud rate for the serial transmission. The typical baud rate with the computer is 9600 baud. Other speeds are also supported.&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);             // opens serial port sets the data rate to 9600 bps&lt;br /&gt;
}&amp;lt;/pre&amp;gt; &lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: When using serial communication, &amp;lt;b&amp;gt;digital pins 0 (RX) and 1 (TX)&amp;lt;/b&amp;gt; cannot be used at the same time. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Serial.println(data) ===&lt;br /&gt;
Writes data to the serial port, followed by an automatic line break as carrier return and line feed. This function has the same form as &#039;Serial.print()&#039;, but is easier to read on the serial monitor. &lt;br /&gt;
&amp;lt;pre&amp;gt;Serial.println(analogValue);         // sends the value of &#039;analogValue&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More detailed information about the numerous variants of the &#039;Serial.println()&#039; and &#039;Serial.print()&#039; functions can be found on the Arduino website. &lt;br /&gt;
&lt;br /&gt;
The following simple example reads a value from analog pin 0 and sends the data to the computer once per second. &lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);                  // sets the data rate to 9600 bps&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 Serial.println(analogRead(0));      // sends the analog value&lt;br /&gt;
 delay(1000);                        // pauses for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Digital output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Output.JPG|thumb|none|300px|Arduino-Example-Digital-Output]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a simple &#039;Hello World&#039; program and turns something on and off. In this example a LED is connected to PIN 13 and flashes every second. The resistor may be superfluous at this pin because the Arduino has a built-in resistor. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;            // LED off digital pin 13&lt;br /&gt;
&lt;br /&gt;
void setup()                     // will run through once&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // sets pin 13 as output&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()                      // Running as endless loop&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);    // switches the LED on&lt;br /&gt;
 delay(1000);                   // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);    // switches the LED off&lt;br /&gt;
 delay(1000);                 // Pause for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Digital input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Input.JPG|thumb|none|300px|Arduino-Example-Digital-Input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the simplest form of an input with only two possible states: on or off.&lt;br /&gt;
This example reads out a simple switch or button at pin 2. When the switch is closed and the input pin is HIGH, the LED is turned on. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;               // Output pin for the LED&lt;br /&gt;
int inPin = 2;                     // Input pin for a switch&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);         // declares LED as output&lt;br /&gt;
 pinMode(inPin, INPUT);           // declares switch as input&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
 if (digitalRead(inPin) == HIGH)   // check if this is the HIGH input&lt;br /&gt;
 {&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches the LED on&lt;br /&gt;
 delay(1000);                  // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);   // switches the LED off&lt;br /&gt;
 delay(1000);                // Pause for 1 second&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analog PWM output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pulse width modulation (PWM) is a method of simulating analog outputs by pulsing the output voltage. This allows you to make an LED brighter or darker or check a servomotor later. The following example uses a loop to slowly make an LED brighter and darker. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 9;            // PWM Pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup(){}                  // No setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for (int i=0; i&amp;lt;=255; i++)     // ascending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);        // sets the brightness value to i&lt;br /&gt;
 delay(100);                    // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 for (int i=255; i&amp;gt;=0; i--)     // descending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);       // sets the brightness value to i&lt;br /&gt;
 delay(100);                   // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== potentiometer Input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With a potentiometer and one of the analog-digital converter (ADC) inputs of the Arduino it is possible to read analog values from 0-1024. The following example uses a potentiometer to control the blinking rate of an LED.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int potPin = 0;              // Input pin for the potentiometer&lt;br /&gt;
int ledPin = 13;                 // Output pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // declare ledPin as OUTPUT&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches on ledPin&lt;br /&gt;
 delay(analogRead(potPin));      // pauses the program by the value of potentiometers&lt;br /&gt;
 digitalWrite(ledPin, LOW);      // switches ledPin off&lt;br /&gt;
 delay(analogRead(potPin));     // pauses the program by the value of potentiometers&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR WAN 1300 LoRa]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR LoRa Gateway Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.elektronik-kompendium.de/sites/com/1810231.htm&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://myhomearchiv.synology.me/download/Anleitung_Furduino.pdf&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/arduino-uno/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/category/projekte/arduino-projekte/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.netzmafia.de/skripten/hardware/Arduino/Arduino_Programmierhandbuch.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4540</id>
		<title>Arduino Board Uno Rev3-Atmega 328: Programming Guide</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4540"/>
		<updated>2020-08-10T20:56:51Z</updated>

		<summary type="html">&lt;p&gt;CCinay: /* Serial.begin(rate) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The &amp;lt;b&amp;gt;Arduino IDE&amp;lt;/b&amp;gt; is a cross-platform Java application that acts as a program code editor and compiler and is also able to send firmware serially to the board. The development environment is based on Processing, an IDE designed to program artists, who normally do not have much contact with the art world programming environments. The programming language is based on Wiring, a C similar language which has a similar scope for a more restricted board design, whose IDE is also based on processing. Make sure you have an updated version of &amp;lt;b&amp;gt;[https://www.arduino.cc/en/Main/Software Arduino IDE]&amp;lt;/b&amp;gt; installed.&lt;br /&gt;
&lt;br /&gt;
== Struktur ==&lt;br /&gt;
The basic structure of the Arduino programming language is relatively simple and is divided into at least two parts. These two required parts or functions enclose blocks of statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup() {     // put your setup code here, to run once:&lt;br /&gt;
}&lt;br /&gt;
void loop() {      // put your main code here, to run repeatedly:&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Here &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; is the preparation and &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; is the execution. Both functions are necessary to execute the program. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup function should follow the variable definition, which must be listed before. Setup must be run through as the first function in a program. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; It is executed only once and is used to set &amp;lt;b&amp;gt;PinMode&amp;lt;/b&amp;gt; or to initiate serial communication. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set PinModes or start serial communication. The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; appear in every program, even if it does not contain any instructions.  &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; After the &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function follows the &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; function. It contains program code that is executed continuously in an infinite loop - read inputs, trigger &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; outputs, etc. This function is the core of all Arduino programs and does the main work. &lt;br /&gt;
&lt;br /&gt;
=== setup() ===&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set &amp;lt;b&amp;gt;PinModes&amp;lt;/b&amp;gt; or start serial communication.&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must appear in every program, even if it does not contain any instructions. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(pin, OUTPUT);     // &#039;pin&#039; define as output&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== loop() ===&lt;br /&gt;
After running through the &amp;lt;b&amp;gt;setup() function&amp;lt;/b&amp;gt;, the &amp;lt;b&amp;gt;loop() function&amp;lt;/b&amp;gt; does exactly what its name suggests and runs in an endless loop. This allows the program to interact with the Arduino board via changes, reactions and controls. &lt;br /&gt;
&amp;lt;pre&amp;gt;void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(pin, HIGH);    // switches &#039;pin&#039; on&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
 digitalWrite(pin, LOW);     // switches &#039;pin&#039; off&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
A function is a block of program code that has a name and a set of instructions that are executed when the function is called. The functions &amp;lt;b&amp;gt;void setup()&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;void loop()&amp;lt;/b&amp;gt; have already been explained. There are more built-in functions that will be discussed later. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Type FunctionName(parameter)&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following integer type function &amp;lt;b&amp;gt;delayVal()&amp;lt;/b&amp;gt; is used to insert a delay value into a program by reading a potentiometer. First a local variable &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is created. Next, &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is equated with the position of the potentiometer, which can have a value between &amp;lt;b&amp;gt;0 and 1023&amp;lt;/b&amp;gt;. The value is then &amp;lt;b&amp;gt;divided by 4 to get a scale from 0 to 255&amp;lt;/b&amp;gt; and at the end the result of the function is returned to the main program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int delayVal()&lt;br /&gt;
{&lt;br /&gt;
 int v;                     // create temporary variable &#039;v&lt;br /&gt;
 v = analogRead(pot);       // read potentiometer Value&lt;br /&gt;
 v /= 4;                    // Convert from 0-1023 to 0-255&lt;br /&gt;
 return v;                  // return the calculated value&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== {} curly brackets ===&lt;br /&gt;
Curly brackets (also called &amp;lt;b&amp;gt;&#039;curly brackets&#039;&amp;lt;/b&amp;gt;) define the start and end of function and statement blocks as in the &amp;lt;b&amp;gt;&#039;void loop()&#039;&amp;lt;/b&amp;gt; function and also in the &amp;lt;b&amp;gt;&#039;for&#039; and &#039;if&#039;&amp;lt;/b&amp;gt; statement. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type function()&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: An opening curved bracket &#039;{&#039; must always be followed by a closing curved bracket &#039;}&#039;. Here it is often said that the number of brackets must be balanced. Unbalanced parentheses often lead to cryptic, inscrutable errors in the compiler, which are sometimes hard to find, especially in large programs.&lt;br /&gt;
&lt;br /&gt;
The Arduino programming environment helps to check that the curved brackets are balanced. To do this, simply select a brace or click just behind it, and the logically connected counterpart is highlighted. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ;semicolon ===&lt;br /&gt;
A semicolon must be used at the end of a statement and is used to separate the elements of a program.&lt;br /&gt;
A semicolon is also used to separate the elements of a for loop. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int x = 13; // declares variable &#039;x&#039; as integer with value 13&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Forgetting a semicolon at the end of a line leads to an error in the compiler. The error description can be very clear and directly point to the missing semicolon, but this does not have to be the case. If an inscrutable or apparently illogical error is reported, the first thing to do is to add missing semicolons near the reported error. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== /*... */ block comments ===&lt;br /&gt;
Block comments or multiline comments are text areas that are ignored by the program. They are used for longer descriptions or comments and help other authors to understand program parts. They start with /* and end with */ and can cover several lines. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/* This is an inserted block comment&lt;br /&gt;
 please do not forget the closing comment -&lt;br /&gt;
 These must be balanced&lt;br /&gt;
*/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== // Single line comments ===&lt;br /&gt;
Simple single-line comments are defined with a // at the beginning of the line and end with the end of the line. They are ignored by the program and do not consume memory. &lt;br /&gt;
&amp;lt;pre&amp;gt;// this is a single line comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
A variable is the name of a numeric value with a name and memory location for later use in a program. A variable must be declared and optionally provided with a value. The following example declares a variable &#039;inputVariable&#039; and assigns the value of analog pin 2 to it: &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;          // declares a variable and&lt;br /&gt;
                                     // sets its value to 0&lt;br /&gt;
inputVariable = analogRead(2);      // sets the value of the variable equal&lt;br /&gt;
                                    // with the value of analog pin 2 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;inputVariable&#039; is the variable itself. The first line explains that its data type is &#039;int&#039;, which is the short expression for integer. The second line gives the variable the value of the analog pin 2, making the value of the pin available everywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Variables should always have descriptive names as clearly as possible to make the code easier to read.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Declaration of variables: ===&lt;br /&gt;
All variables must be declared before use. Declaring a variable means defining its type such as int, long, float, etc., giving it a name and optionally an initial value.This only needs to be done once in the program. Afterwards the value can be changed at any time by calculations or various assignments. &lt;br /&gt;
&lt;br /&gt;
The following example declares &#039;inputVariable&#039; as &#039;int&#039;, i.e. integer data type and sets the initial value to 0. This is called a &#039;simple assignment&#039;. &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A variable can be declared at many places in the program. The location of the declaration determines which program parts have access to the variable. &lt;br /&gt;
&lt;br /&gt;
== Data types ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;byte&amp;lt;/b&amp;gt;: Byte stores an &amp;lt;b&amp;gt;8-bit numeric&amp;lt;/b&amp;gt;, integer value without decimal point. The &amp;lt;b&amp;gt;value&amp;lt;/b&amp;gt; can be between &amp;lt;b&amp;gt;0 and 255&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;byte someVariable = 180;         // declares &#039;someVariable as a &#039;byte&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;int&amp;lt;/b&amp;gt;: Integers are the most common data type for storing integer values without decimal point. Its &amp;lt;b&amp;gt;value&amp;lt;/b&amp;gt; is &amp;lt;b&amp;gt;16 bits and ranges from -32,767 to 32,768&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;int someVariable = 1500;        // declares &#039;someVariable as an &#039;integer&#039; data type&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;long&amp;lt;/b&amp;gt;: Data type for long integers with extended size, without decimal point, &amp;lt;b&amp;gt;stored in a 32-bit&amp;lt;/b&amp;gt; value in a spectrum from &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp;&amp;lt;b&amp;gt;-2,147,483,648 to 2,147,483,647&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;long someVariable = 90000;      // declares &#039;someVariable as a &#039;long&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;float&amp;lt;/b&amp;gt;: A data type for floating point values or numbers with decimal places. Floating point numbers have a better resolution than integers and are&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; expressed as &amp;lt;b&amp;gt;32-bit values with a spectrum from -3.4028235E+38 to 3.4028235E+38&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;float someVariable = 3.14;      // declares &#039;someVariable&#039; as a &#039;float&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Floating point numbers are not precise and may lead to strange results when compared. Also, floating-point calculations are much slower than with integer data types. Calculations with floating-point values should be avoided if possible. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;arrays&amp;lt;/b&amp;gt;: An array is a collection of values that are accessed with an index number.&lt;br /&gt;
Each value in the array can be accessed by retrieving the name of&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; the array and the index number of the value. The index number always starts at 0 for an array.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; An array must be declared and optionally assigned values before it can be used.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[] = {value0, value1, value2...} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the same way it is possible to declare an array first with datatype and size and later to give a value to an index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[5];        // declare datatype &#039;integer&#039; as array with 5 Positions&lt;br /&gt;
myArray[3] = 10;            // gives the 4th index the value 10  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To read the value of an array you can simply assign it to a variable specifying the array and the index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;x = myArray[3];       // x now has the value 10 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arrays are often used for loops, where the counter of the loop is also used as index position for the values in the array. The following example uses an array to make an LED flicker. With a for loop and a counter starting at 0 an index position in the array is read, sent to the LED pin, paused for 200ms and then the same is done with the next index position. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 10; // LED on pin 10&lt;br /&gt;
byte flicker[] = {180, 30, 255, 200, 10, 90, 150, 60};    // array with 8 different values&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);    // Sets the OUTPUT pin&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for(int i=0; i&amp;lt;7; i++)               // loop equals the number&lt;br /&gt;
 { // of the values in the array&lt;br /&gt;
 analogWrite(ledPin, flicker[i]);     // writes the index value to the LED&lt;br /&gt;
 delay(200);                          // 200ms pause&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Digitaler Input - Output ==&lt;br /&gt;
=== pinMode(pin,mode) ===&lt;br /&gt;
Used in &#039;void setup()&#039; to configure a specific pin as either input or output. &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, OUTPUT); // sets &#039;pin&#039; as output &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arduino digital pins are inputs by default, so they don&#039;t need to be specified as inputs with &#039;pinMode()&#039;. Pins configured as inputs have a high impedance state. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: There are also comfortable 20 k &#039;pullup&#039; resistors in the ATmega chip which are accessible via software.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These built-in &#039;pullup&#039; resistors can be accessed in the following way: &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, INPUT);        // sets &#039;pin&#039; as input&lt;br /&gt;
digitalWrite(pin, HIGH);        // switches on the &#039;Pullup&#039; resistor&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pullup resistors are normally used to connect inputs like switches. In the example shown here it is noticeable that the pin is not defined as an output&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; although it is written to. It is only the method to activate the internal &#039;pullup&#039; resistor.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pins configured as output are in a low impedance state and can be loaded with a maximum of 40 mAmpere current from connected elements&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; and circuits. This is enough to make an LED light up (don&#039;t forget the serial resistor), but not enough to drive most relays, solenoids or motors.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Short circuits at the Arduino pins as well as too high current can destroy the output pin or even the whole ATmega chip. For this reason it is a good idea&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; to connect an output pin with external elements in series with a 470 or 1K resistor to&lt;br /&gt;
switch.&lt;br /&gt;
&lt;br /&gt;
=== digitalRead(pin) ===&lt;br /&gt;
digitalRead(pin)&#039; reads the value from a specified digital pin, with the result either HIGH or LOW. The pin can be set either as a variable or constant (0-13). &lt;br /&gt;
&amp;lt;pre&amp;gt;value = digitalRead(Pin);      // sets &#039;value&#039; equal to the input pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
digitalWrite(pin,value)&lt;br /&gt;
Outputs either logic level HIGH or LOW at a specified pin. The pin can be set as a variable or constant (0-13).&lt;br /&gt;
&amp;lt;pre&amp;gt;digitalWrite(pin, HIGH);       // sets &#039;pin&#039; to high&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example reads a button on a digital input and switches an LED on when the button is pressed: &lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 13;            // LED connected to pin 13&lt;br /&gt;
int pin = 7;                 // Button connected to pin 7&lt;br /&gt;
int value = 0;              // Variable to store the readout value&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(led, OUTPUT);    // defines pin 13 as output&lt;br /&gt;
 pinMode(pin, INPUT);     // sets pin 7 as input&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = digitalRead(pin);    // sets &#039;value&#039; equal to&lt;br /&gt;
 // the input pin&lt;br /&gt;
 digitalWrite(led, value);    // sets &#039;led&#039; equal to the&lt;br /&gt;
}                             // Value of the button&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Analoger Input - Output ==&lt;br /&gt;
=== analogRead(pin) ===&lt;br /&gt;
Reads the value of a specified analog pin with a 10 bit resolution. This function is only available for pins (0-5). The resulting integer values have a spectrum from 0 to 1023. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = analogRead(pin);     // sets &#039;value&#039; equal to &#039;pin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Unlike digital pins, analog pins do not have to be declared as input or output first. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analogWrite(pin, value) ===&lt;br /&gt;
Writes pseudo-analog values to an output pin using hardware-based pulse width modulation (PWM). On newer Arduino boards with the ATmega 168 chip this function is applicable to pins 3, 5, 6, 9, 10 and 11. Older Arduinos with the ATmega8 only support pins 9,10 and 11. The value can be set as a variable or constant in the range 0-255.&lt;br /&gt;
&amp;lt;pre&amp;gt;analogWrite(pin, value);     // writes &#039;value&#039; to the analog &#039;pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A value of 0 generates a uniform voltage of 0 volts at a fixed pin; a value of 255 generates a uniform voltage of 5 volts at a fixed pin. For values between 0 and 255, the pin changes very quickly between 0 and 5 volts - the higher the value, the longer the pin is HIGH (5 volts). For a value of 64, the pin is at 0 volts for three-quarters of the time and at 5 volts for one-quarter of the time. A value of 128 means that the output voltage is HIGH half of the time and LOW the other half. A value of 192 means that the voltage at the pin measures 0 volts at one quarter of the time and the full 5 volts at three quarters of the time. &lt;br /&gt;
&lt;br /&gt;
Because this is a hardware-based function, the constant wave runs independently of the program until the next change of state via analogWrite (or a call to digitalRead or digitalWrite on the same pin). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: In contrast to digital pins, analog pins do not have to be declared as input or output before. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The following example reads an analog value from &#039;pin&#039;, converts the value by dividing it by 4 and then outputs it as a PWM signal to &#039;led&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 10;    // LED with 220 resistor at pin 10&lt;br /&gt;
int pin = 0;         // Potentiometer at analog pin 0&lt;br /&gt;
int value;           // Value for readout&lt;br /&gt;
&lt;br /&gt;
void setup(){}      // no setup required&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = analogRead(pin);      // sets &#039;value&#039; equal to &#039;pin&lt;br /&gt;
 value /= 4; // converts 0-1023 into 0-255&lt;br /&gt;
 analogWrite(led, value);     // outputs the PWM signal &#039;led&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Random functions ==&lt;br /&gt;
=== randomSeed(seed) ===&lt;br /&gt;
Sets a value or &#039;Seed&#039; as starting point for the random() function.&lt;br /&gt;
&amp;lt;pre&amp;gt;randomSeed(value);       // sets &#039;value&#039; as the random seed&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Arduino itself is not able to produce a truly random value. With randomSeed() a variable can be used as &#039;seed&#039; to get better random results. For example, millis() or analogRead() can be used as a seed variable or function to use electrical noise through the analog pin as an output for random values. &lt;br /&gt;
&lt;br /&gt;
=== random(min, max) ===&lt;br /&gt;
The random function allows the generation of pseudo-random values within a defined range of minimum and maxium values. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = random(100, 200);        // sets &#039;value&#039; with a random number between 100 and 200 equal &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example generates a random value between 0 and 255 and outputs it as PWM signal on a PWM pin. &lt;br /&gt;
&amp;lt;pre&amp;gt;int randNumber;      // Variable to store the random value&lt;br /&gt;
int led = 10;            // LED with 220 Ohm resistor at pin 10&lt;br /&gt;
&lt;br /&gt;
void setup() {}          // no setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 randomSeed(millis());              // uses millis() as seed&lt;br /&gt;
 randNumber = random(255);          // Random number in the range 0-255&lt;br /&gt;
 analogWrite(led, randNumber);      // PWM signal as output&lt;br /&gt;
 delay(500);                        // half second pause&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Serial communication ==&lt;br /&gt;
=== Serial.begin(rate) ===&lt;br /&gt;
Serial.begin(rate)&#039; Opens the serial port and sets the baud rate for the serial transmission. The typical baud rate with the computer is 9600 baud. Other speeds are also supported.&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);             // opens serial port sets the data rate to 9600 bps&lt;br /&gt;
}&amp;lt;/pre&amp;gt; &lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: When using serial communication, &amp;lt;b&amp;gt;digital pins 0 (RX) and 1 (TX)&amp;lt;/b&amp;gt; cannot be used at the same time. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Serial.println(data) ===&lt;br /&gt;
Writes data to the serial port, followed by an automatic line break as carrier return and line feed. This function has the same form as &#039;Serial.print()&#039;, but is easier to read on the serial monitor. &lt;br /&gt;
&amp;lt;pre&amp;gt;Serial.println(analogValue);         // sends the value of &#039;analogValue&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More detailed information about the numerous variants of the &#039;Serial.println()&#039; and &#039;Serial.print()&#039; functions can be found on the Arduino website. &lt;br /&gt;
&lt;br /&gt;
The following simple example reads a value from analog pin 0 and sends the data to the computer once per second. &lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);                // sets the data rate to 9600 bps&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 Serial.println(analogRead(0));   // sends the analog value&lt;br /&gt;
 delay(1000);                    // pauses for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Digital output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Output.JPG|thumb|none|300px|Arduino-Example-Digital-Output]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a simple &#039;Hello World&#039; program and turns something on and off. In this example a LED is connected to PIN 13 and flashes every second. The resistor may be superfluous at this pin because the Arduino has a built-in resistor. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;            // LED off digital pin 13&lt;br /&gt;
&lt;br /&gt;
void setup()                     // will run through once&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // sets pin 13 as output&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()                      // Running as endless loop&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);    // switches the LED on&lt;br /&gt;
 delay(1000);                   // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);    // switches the LED off&lt;br /&gt;
 delay(1000);                 // Pause for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Digital input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Input.JPG|thumb|none|300px|Arduino-Example-Digital-Input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the simplest form of an input with only two possible states: on or off.&lt;br /&gt;
This example reads out a simple switch or button at pin 2. When the switch is closed and the input pin is HIGH, the LED is turned on. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;               // Output pin for the LED&lt;br /&gt;
int inPin = 2;                     // Input pin for a switch&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);         // declares LED as output&lt;br /&gt;
 pinMode(inPin, INPUT);           // declares switch as input&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
 if (digitalRead(inPin) == HIGH)   // check if this is the HIGH input&lt;br /&gt;
 {&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches the LED on&lt;br /&gt;
 delay(1000);                  // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);   // switches the LED off&lt;br /&gt;
 delay(1000);                // Pause for 1 second&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analog PWM output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pulse width modulation (PWM) is a method of simulating analog outputs by pulsing the output voltage. This allows you to make an LED brighter or darker or check a servomotor later. The following example uses a loop to slowly make an LED brighter and darker. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 9;            // PWM Pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup(){}                  // No setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for (int i=0; i&amp;lt;=255; i++)     // ascending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);        // sets the brightness value to i&lt;br /&gt;
 delay(100);                    // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 for (int i=255; i&amp;gt;=0; i--)     // descending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);       // sets the brightness value to i&lt;br /&gt;
 delay(100);                   // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== potentiometer Input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With a potentiometer and one of the analog-digital converter (ADC) inputs of the Arduino it is possible to read analog values from 0-1024. The following example uses a potentiometer to control the blinking rate of an LED.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int potPin = 0;              // Input pin for the potentiometer&lt;br /&gt;
int ledPin = 13;                 // Output pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // declare ledPin as OUTPUT&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches on ledPin&lt;br /&gt;
 delay(analogRead(potPin));      // pauses the program by the value of potentiometers&lt;br /&gt;
 digitalWrite(ledPin, LOW);      // switches ledPin off&lt;br /&gt;
 delay(analogRead(potPin));     // pauses the program by the value of potentiometers&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR WAN 1300 LoRa]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR LoRa Gateway Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.elektronik-kompendium.de/sites/com/1810231.htm&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://myhomearchiv.synology.me/download/Anleitung_Furduino.pdf&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/arduino-uno/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/category/projekte/arduino-projekte/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.netzmafia.de/skripten/hardware/Arduino/Arduino_Programmierhandbuch.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4539</id>
		<title>Arduino Board Uno Rev3-Atmega 328: Programming Guide</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4539"/>
		<updated>2020-08-10T20:56:24Z</updated>

		<summary type="html">&lt;p&gt;CCinay: /* Serial communication */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The &amp;lt;b&amp;gt;Arduino IDE&amp;lt;/b&amp;gt; is a cross-platform Java application that acts as a program code editor and compiler and is also able to send firmware serially to the board. The development environment is based on Processing, an IDE designed to program artists, who normally do not have much contact with the art world programming environments. The programming language is based on Wiring, a C similar language which has a similar scope for a more restricted board design, whose IDE is also based on processing. Make sure you have an updated version of &amp;lt;b&amp;gt;[https://www.arduino.cc/en/Main/Software Arduino IDE]&amp;lt;/b&amp;gt; installed.&lt;br /&gt;
&lt;br /&gt;
== Struktur ==&lt;br /&gt;
The basic structure of the Arduino programming language is relatively simple and is divided into at least two parts. These two required parts or functions enclose blocks of statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup() {     // put your setup code here, to run once:&lt;br /&gt;
}&lt;br /&gt;
void loop() {      // put your main code here, to run repeatedly:&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Here &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; is the preparation and &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; is the execution. Both functions are necessary to execute the program. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup function should follow the variable definition, which must be listed before. Setup must be run through as the first function in a program. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; It is executed only once and is used to set &amp;lt;b&amp;gt;PinMode&amp;lt;/b&amp;gt; or to initiate serial communication. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set PinModes or start serial communication. The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; appear in every program, even if it does not contain any instructions.  &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; After the &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function follows the &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; function. It contains program code that is executed continuously in an infinite loop - read inputs, trigger &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; outputs, etc. This function is the core of all Arduino programs and does the main work. &lt;br /&gt;
&lt;br /&gt;
=== setup() ===&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set &amp;lt;b&amp;gt;PinModes&amp;lt;/b&amp;gt; or start serial communication.&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must appear in every program, even if it does not contain any instructions. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(pin, OUTPUT);     // &#039;pin&#039; define as output&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== loop() ===&lt;br /&gt;
After running through the &amp;lt;b&amp;gt;setup() function&amp;lt;/b&amp;gt;, the &amp;lt;b&amp;gt;loop() function&amp;lt;/b&amp;gt; does exactly what its name suggests and runs in an endless loop. This allows the program to interact with the Arduino board via changes, reactions and controls. &lt;br /&gt;
&amp;lt;pre&amp;gt;void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(pin, HIGH);    // switches &#039;pin&#039; on&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
 digitalWrite(pin, LOW);     // switches &#039;pin&#039; off&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
A function is a block of program code that has a name and a set of instructions that are executed when the function is called. The functions &amp;lt;b&amp;gt;void setup()&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;void loop()&amp;lt;/b&amp;gt; have already been explained. There are more built-in functions that will be discussed later. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Type FunctionName(parameter)&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following integer type function &amp;lt;b&amp;gt;delayVal()&amp;lt;/b&amp;gt; is used to insert a delay value into a program by reading a potentiometer. First a local variable &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is created. Next, &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is equated with the position of the potentiometer, which can have a value between &amp;lt;b&amp;gt;0 and 1023&amp;lt;/b&amp;gt;. The value is then &amp;lt;b&amp;gt;divided by 4 to get a scale from 0 to 255&amp;lt;/b&amp;gt; and at the end the result of the function is returned to the main program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int delayVal()&lt;br /&gt;
{&lt;br /&gt;
 int v;                     // create temporary variable &#039;v&lt;br /&gt;
 v = analogRead(pot);       // read potentiometer Value&lt;br /&gt;
 v /= 4;                    // Convert from 0-1023 to 0-255&lt;br /&gt;
 return v;                  // return the calculated value&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== {} curly brackets ===&lt;br /&gt;
Curly brackets (also called &amp;lt;b&amp;gt;&#039;curly brackets&#039;&amp;lt;/b&amp;gt;) define the start and end of function and statement blocks as in the &amp;lt;b&amp;gt;&#039;void loop()&#039;&amp;lt;/b&amp;gt; function and also in the &amp;lt;b&amp;gt;&#039;for&#039; and &#039;if&#039;&amp;lt;/b&amp;gt; statement. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type function()&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: An opening curved bracket &#039;{&#039; must always be followed by a closing curved bracket &#039;}&#039;. Here it is often said that the number of brackets must be balanced. Unbalanced parentheses often lead to cryptic, inscrutable errors in the compiler, which are sometimes hard to find, especially in large programs.&lt;br /&gt;
&lt;br /&gt;
The Arduino programming environment helps to check that the curved brackets are balanced. To do this, simply select a brace or click just behind it, and the logically connected counterpart is highlighted. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ;semicolon ===&lt;br /&gt;
A semicolon must be used at the end of a statement and is used to separate the elements of a program.&lt;br /&gt;
A semicolon is also used to separate the elements of a for loop. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int x = 13; // declares variable &#039;x&#039; as integer with value 13&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Forgetting a semicolon at the end of a line leads to an error in the compiler. The error description can be very clear and directly point to the missing semicolon, but this does not have to be the case. If an inscrutable or apparently illogical error is reported, the first thing to do is to add missing semicolons near the reported error. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== /*... */ block comments ===&lt;br /&gt;
Block comments or multiline comments are text areas that are ignored by the program. They are used for longer descriptions or comments and help other authors to understand program parts. They start with /* and end with */ and can cover several lines. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/* This is an inserted block comment&lt;br /&gt;
 please do not forget the closing comment -&lt;br /&gt;
 These must be balanced&lt;br /&gt;
*/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== // Single line comments ===&lt;br /&gt;
Simple single-line comments are defined with a // at the beginning of the line and end with the end of the line. They are ignored by the program and do not consume memory. &lt;br /&gt;
&amp;lt;pre&amp;gt;// this is a single line comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
A variable is the name of a numeric value with a name and memory location for later use in a program. A variable must be declared and optionally provided with a value. The following example declares a variable &#039;inputVariable&#039; and assigns the value of analog pin 2 to it: &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;          // declares a variable and&lt;br /&gt;
                                     // sets its value to 0&lt;br /&gt;
inputVariable = analogRead(2);      // sets the value of the variable equal&lt;br /&gt;
                                    // with the value of analog pin 2 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;inputVariable&#039; is the variable itself. The first line explains that its data type is &#039;int&#039;, which is the short expression for integer. The second line gives the variable the value of the analog pin 2, making the value of the pin available everywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Variables should always have descriptive names as clearly as possible to make the code easier to read.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Declaration of variables: ===&lt;br /&gt;
All variables must be declared before use. Declaring a variable means defining its type such as int, long, float, etc., giving it a name and optionally an initial value.This only needs to be done once in the program. Afterwards the value can be changed at any time by calculations or various assignments. &lt;br /&gt;
&lt;br /&gt;
The following example declares &#039;inputVariable&#039; as &#039;int&#039;, i.e. integer data type and sets the initial value to 0. This is called a &#039;simple assignment&#039;. &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A variable can be declared at many places in the program. The location of the declaration determines which program parts have access to the variable. &lt;br /&gt;
&lt;br /&gt;
== Data types ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;byte&amp;lt;/b&amp;gt;: Byte stores an &amp;lt;b&amp;gt;8-bit numeric&amp;lt;/b&amp;gt;, integer value without decimal point. The &amp;lt;b&amp;gt;value&amp;lt;/b&amp;gt; can be between &amp;lt;b&amp;gt;0 and 255&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;byte someVariable = 180;         // declares &#039;someVariable as a &#039;byte&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;int&amp;lt;/b&amp;gt;: Integers are the most common data type for storing integer values without decimal point. Its &amp;lt;b&amp;gt;value&amp;lt;/b&amp;gt; is &amp;lt;b&amp;gt;16 bits and ranges from -32,767 to 32,768&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;int someVariable = 1500;        // declares &#039;someVariable as an &#039;integer&#039; data type&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;long&amp;lt;/b&amp;gt;: Data type for long integers with extended size, without decimal point, &amp;lt;b&amp;gt;stored in a 32-bit&amp;lt;/b&amp;gt; value in a spectrum from &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp;&amp;lt;b&amp;gt;-2,147,483,648 to 2,147,483,647&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;long someVariable = 90000;      // declares &#039;someVariable as a &#039;long&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;float&amp;lt;/b&amp;gt;: A data type for floating point values or numbers with decimal places. Floating point numbers have a better resolution than integers and are&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; expressed as &amp;lt;b&amp;gt;32-bit values with a spectrum from -3.4028235E+38 to 3.4028235E+38&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;float someVariable = 3.14;      // declares &#039;someVariable&#039; as a &#039;float&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Floating point numbers are not precise and may lead to strange results when compared. Also, floating-point calculations are much slower than with integer data types. Calculations with floating-point values should be avoided if possible. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;arrays&amp;lt;/b&amp;gt;: An array is a collection of values that are accessed with an index number.&lt;br /&gt;
Each value in the array can be accessed by retrieving the name of&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; the array and the index number of the value. The index number always starts at 0 for an array.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; An array must be declared and optionally assigned values before it can be used.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[] = {value0, value1, value2...} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the same way it is possible to declare an array first with datatype and size and later to give a value to an index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[5];        // declare datatype &#039;integer&#039; as array with 5 Positions&lt;br /&gt;
myArray[3] = 10;            // gives the 4th index the value 10  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To read the value of an array you can simply assign it to a variable specifying the array and the index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;x = myArray[3];       // x now has the value 10 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arrays are often used for loops, where the counter of the loop is also used as index position for the values in the array. The following example uses an array to make an LED flicker. With a for loop and a counter starting at 0 an index position in the array is read, sent to the LED pin, paused for 200ms and then the same is done with the next index position. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 10; // LED on pin 10&lt;br /&gt;
byte flicker[] = {180, 30, 255, 200, 10, 90, 150, 60};    // array with 8 different values&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);    // Sets the OUTPUT pin&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for(int i=0; i&amp;lt;7; i++)               // loop equals the number&lt;br /&gt;
 { // of the values in the array&lt;br /&gt;
 analogWrite(ledPin, flicker[i]);     // writes the index value to the LED&lt;br /&gt;
 delay(200);                          // 200ms pause&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Digitaler Input - Output ==&lt;br /&gt;
=== pinMode(pin,mode) ===&lt;br /&gt;
Used in &#039;void setup()&#039; to configure a specific pin as either input or output. &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, OUTPUT); // sets &#039;pin&#039; as output &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arduino digital pins are inputs by default, so they don&#039;t need to be specified as inputs with &#039;pinMode()&#039;. Pins configured as inputs have a high impedance state. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: There are also comfortable 20 k &#039;pullup&#039; resistors in the ATmega chip which are accessible via software.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These built-in &#039;pullup&#039; resistors can be accessed in the following way: &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, INPUT);        // sets &#039;pin&#039; as input&lt;br /&gt;
digitalWrite(pin, HIGH);        // switches on the &#039;Pullup&#039; resistor&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pullup resistors are normally used to connect inputs like switches. In the example shown here it is noticeable that the pin is not defined as an output&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; although it is written to. It is only the method to activate the internal &#039;pullup&#039; resistor.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pins configured as output are in a low impedance state and can be loaded with a maximum of 40 mAmpere current from connected elements&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; and circuits. This is enough to make an LED light up (don&#039;t forget the serial resistor), but not enough to drive most relays, solenoids or motors.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Short circuits at the Arduino pins as well as too high current can destroy the output pin or even the whole ATmega chip. For this reason it is a good idea&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; to connect an output pin with external elements in series with a 470 or 1K resistor to&lt;br /&gt;
switch.&lt;br /&gt;
&lt;br /&gt;
=== digitalRead(pin) ===&lt;br /&gt;
digitalRead(pin)&#039; reads the value from a specified digital pin, with the result either HIGH or LOW. The pin can be set either as a variable or constant (0-13). &lt;br /&gt;
&amp;lt;pre&amp;gt;value = digitalRead(Pin);      // sets &#039;value&#039; equal to the input pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
digitalWrite(pin,value)&lt;br /&gt;
Outputs either logic level HIGH or LOW at a specified pin. The pin can be set as a variable or constant (0-13).&lt;br /&gt;
&amp;lt;pre&amp;gt;digitalWrite(pin, HIGH);       // sets &#039;pin&#039; to high&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example reads a button on a digital input and switches an LED on when the button is pressed: &lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 13;            // LED connected to pin 13&lt;br /&gt;
int pin = 7;                 // Button connected to pin 7&lt;br /&gt;
int value = 0;              // Variable to store the readout value&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(led, OUTPUT);    // defines pin 13 as output&lt;br /&gt;
 pinMode(pin, INPUT);     // sets pin 7 as input&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = digitalRead(pin);    // sets &#039;value&#039; equal to&lt;br /&gt;
 // the input pin&lt;br /&gt;
 digitalWrite(led, value);    // sets &#039;led&#039; equal to the&lt;br /&gt;
}                             // Value of the button&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Analoger Input - Output ==&lt;br /&gt;
=== analogRead(pin) ===&lt;br /&gt;
Reads the value of a specified analog pin with a 10 bit resolution. This function is only available for pins (0-5). The resulting integer values have a spectrum from 0 to 1023. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = analogRead(pin);     // sets &#039;value&#039; equal to &#039;pin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Unlike digital pins, analog pins do not have to be declared as input or output first. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analogWrite(pin, value) ===&lt;br /&gt;
Writes pseudo-analog values to an output pin using hardware-based pulse width modulation (PWM). On newer Arduino boards with the ATmega 168 chip this function is applicable to pins 3, 5, 6, 9, 10 and 11. Older Arduinos with the ATmega8 only support pins 9,10 and 11. The value can be set as a variable or constant in the range 0-255.&lt;br /&gt;
&amp;lt;pre&amp;gt;analogWrite(pin, value);     // writes &#039;value&#039; to the analog &#039;pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A value of 0 generates a uniform voltage of 0 volts at a fixed pin; a value of 255 generates a uniform voltage of 5 volts at a fixed pin. For values between 0 and 255, the pin changes very quickly between 0 and 5 volts - the higher the value, the longer the pin is HIGH (5 volts). For a value of 64, the pin is at 0 volts for three-quarters of the time and at 5 volts for one-quarter of the time. A value of 128 means that the output voltage is HIGH half of the time and LOW the other half. A value of 192 means that the voltage at the pin measures 0 volts at one quarter of the time and the full 5 volts at three quarters of the time. &lt;br /&gt;
&lt;br /&gt;
Because this is a hardware-based function, the constant wave runs independently of the program until the next change of state via analogWrite (or a call to digitalRead or digitalWrite on the same pin). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: In contrast to digital pins, analog pins do not have to be declared as input or output before. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The following example reads an analog value from &#039;pin&#039;, converts the value by dividing it by 4 and then outputs it as a PWM signal to &#039;led&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 10;    // LED with 220 resistor at pin 10&lt;br /&gt;
int pin = 0;         // Potentiometer at analog pin 0&lt;br /&gt;
int value;           // Value for readout&lt;br /&gt;
&lt;br /&gt;
void setup(){}      // no setup required&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = analogRead(pin);      // sets &#039;value&#039; equal to &#039;pin&lt;br /&gt;
 value /= 4; // converts 0-1023 into 0-255&lt;br /&gt;
 analogWrite(led, value);     // outputs the PWM signal &#039;led&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Random functions ==&lt;br /&gt;
=== randomSeed(seed) ===&lt;br /&gt;
Sets a value or &#039;Seed&#039; as starting point for the random() function.&lt;br /&gt;
&amp;lt;pre&amp;gt;randomSeed(value);       // sets &#039;value&#039; as the random seed&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Arduino itself is not able to produce a truly random value. With randomSeed() a variable can be used as &#039;seed&#039; to get better random results. For example, millis() or analogRead() can be used as a seed variable or function to use electrical noise through the analog pin as an output for random values. &lt;br /&gt;
&lt;br /&gt;
=== random(min, max) ===&lt;br /&gt;
The random function allows the generation of pseudo-random values within a defined range of minimum and maxium values. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = random(100, 200);        // sets &#039;value&#039; with a random number between 100 and 200 equal &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example generates a random value between 0 and 255 and outputs it as PWM signal on a PWM pin. &lt;br /&gt;
&amp;lt;pre&amp;gt;int randNumber;      // Variable to store the random value&lt;br /&gt;
int led = 10;            // LED with 220 Ohm resistor at pin 10&lt;br /&gt;
&lt;br /&gt;
void setup() {}          // no setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 randomSeed(millis());              // uses millis() as seed&lt;br /&gt;
 randNumber = random(255);          // Random number in the range 0-255&lt;br /&gt;
 analogWrite(led, randNumber);      // PWM signal as output&lt;br /&gt;
 delay(500);                        // half second pause&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Serial communication ==&lt;br /&gt;
=== Serial.begin(rate) ===&lt;br /&gt;
Serial.begin(rate)&#039; Opens the serial port and sets the baud rate for the serial transmission. The typical baud rate with the computer is 9600 baud. Other speeds are also supported.&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);             // opens serial port sets the data rate to 9600 bps&lt;br /&gt;
}&amp;lt;/pre&amp;gt; &lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: When using serial communication, digital pins 0 (RX) and 1 (TX) cannot be used at the same time. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Serial.println(data) ===&lt;br /&gt;
Writes data to the serial port, followed by an automatic line break as carrier return and line feed. This function has the same form as &#039;Serial.print()&#039;, but is easier to read on the serial monitor. &lt;br /&gt;
&amp;lt;pre&amp;gt;Serial.println(analogValue);         // sends the value of &#039;analogValue&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More detailed information about the numerous variants of the &#039;Serial.println()&#039; and &#039;Serial.print()&#039; functions can be found on the Arduino website. &lt;br /&gt;
&lt;br /&gt;
The following simple example reads a value from analog pin 0 and sends the data to the computer once per second. &lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);                // sets the data rate to 9600 bps&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 Serial.println(analogRead(0));   // sends the analog value&lt;br /&gt;
 delay(1000);                    // pauses for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Digital output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Output.JPG|thumb|none|300px|Arduino-Example-Digital-Output]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a simple &#039;Hello World&#039; program and turns something on and off. In this example a LED is connected to PIN 13 and flashes every second. The resistor may be superfluous at this pin because the Arduino has a built-in resistor. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;            // LED off digital pin 13&lt;br /&gt;
&lt;br /&gt;
void setup()                     // will run through once&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // sets pin 13 as output&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()                      // Running as endless loop&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);    // switches the LED on&lt;br /&gt;
 delay(1000);                   // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);    // switches the LED off&lt;br /&gt;
 delay(1000);                 // Pause for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Digital input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Input.JPG|thumb|none|300px|Arduino-Example-Digital-Input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the simplest form of an input with only two possible states: on or off.&lt;br /&gt;
This example reads out a simple switch or button at pin 2. When the switch is closed and the input pin is HIGH, the LED is turned on. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;               // Output pin for the LED&lt;br /&gt;
int inPin = 2;                     // Input pin for a switch&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);         // declares LED as output&lt;br /&gt;
 pinMode(inPin, INPUT);           // declares switch as input&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
 if (digitalRead(inPin) == HIGH)   // check if this is the HIGH input&lt;br /&gt;
 {&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches the LED on&lt;br /&gt;
 delay(1000);                  // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);   // switches the LED off&lt;br /&gt;
 delay(1000);                // Pause for 1 second&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analog PWM output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pulse width modulation (PWM) is a method of simulating analog outputs by pulsing the output voltage. This allows you to make an LED brighter or darker or check a servomotor later. The following example uses a loop to slowly make an LED brighter and darker. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 9;            // PWM Pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup(){}                  // No setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for (int i=0; i&amp;lt;=255; i++)     // ascending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);        // sets the brightness value to i&lt;br /&gt;
 delay(100);                    // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 for (int i=255; i&amp;gt;=0; i--)     // descending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);       // sets the brightness value to i&lt;br /&gt;
 delay(100);                   // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== potentiometer Input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With a potentiometer and one of the analog-digital converter (ADC) inputs of the Arduino it is possible to read analog values from 0-1024. The following example uses a potentiometer to control the blinking rate of an LED.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int potPin = 0;              // Input pin for the potentiometer&lt;br /&gt;
int ledPin = 13;                 // Output pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // declare ledPin as OUTPUT&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches on ledPin&lt;br /&gt;
 delay(analogRead(potPin));      // pauses the program by the value of potentiometers&lt;br /&gt;
 digitalWrite(ledPin, LOW);      // switches ledPin off&lt;br /&gt;
 delay(analogRead(potPin));     // pauses the program by the value of potentiometers&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR WAN 1300 LoRa]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR LoRa Gateway Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.elektronik-kompendium.de/sites/com/1810231.htm&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://myhomearchiv.synology.me/download/Anleitung_Furduino.pdf&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/arduino-uno/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/category/projekte/arduino-projekte/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.netzmafia.de/skripten/hardware/Arduino/Arduino_Programmierhandbuch.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4538</id>
		<title>Arduino Board Uno Rev3-Atmega 328: Programming Guide</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4538"/>
		<updated>2020-08-10T20:54:39Z</updated>

		<summary type="html">&lt;p&gt;CCinay: /* Random functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The &amp;lt;b&amp;gt;Arduino IDE&amp;lt;/b&amp;gt; is a cross-platform Java application that acts as a program code editor and compiler and is also able to send firmware serially to the board. The development environment is based on Processing, an IDE designed to program artists, who normally do not have much contact with the art world programming environments. The programming language is based on Wiring, a C similar language which has a similar scope for a more restricted board design, whose IDE is also based on processing. Make sure you have an updated version of &amp;lt;b&amp;gt;[https://www.arduino.cc/en/Main/Software Arduino IDE]&amp;lt;/b&amp;gt; installed.&lt;br /&gt;
&lt;br /&gt;
== Struktur ==&lt;br /&gt;
The basic structure of the Arduino programming language is relatively simple and is divided into at least two parts. These two required parts or functions enclose blocks of statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup() {     // put your setup code here, to run once:&lt;br /&gt;
}&lt;br /&gt;
void loop() {      // put your main code here, to run repeatedly:&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Here &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; is the preparation and &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; is the execution. Both functions are necessary to execute the program. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup function should follow the variable definition, which must be listed before. Setup must be run through as the first function in a program. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; It is executed only once and is used to set &amp;lt;b&amp;gt;PinMode&amp;lt;/b&amp;gt; or to initiate serial communication. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set PinModes or start serial communication. The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; appear in every program, even if it does not contain any instructions.  &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; After the &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function follows the &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; function. It contains program code that is executed continuously in an infinite loop - read inputs, trigger &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; outputs, etc. This function is the core of all Arduino programs and does the main work. &lt;br /&gt;
&lt;br /&gt;
=== setup() ===&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set &amp;lt;b&amp;gt;PinModes&amp;lt;/b&amp;gt; or start serial communication.&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must appear in every program, even if it does not contain any instructions. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(pin, OUTPUT);     // &#039;pin&#039; define as output&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== loop() ===&lt;br /&gt;
After running through the &amp;lt;b&amp;gt;setup() function&amp;lt;/b&amp;gt;, the &amp;lt;b&amp;gt;loop() function&amp;lt;/b&amp;gt; does exactly what its name suggests and runs in an endless loop. This allows the program to interact with the Arduino board via changes, reactions and controls. &lt;br /&gt;
&amp;lt;pre&amp;gt;void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(pin, HIGH);    // switches &#039;pin&#039; on&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
 digitalWrite(pin, LOW);     // switches &#039;pin&#039; off&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
A function is a block of program code that has a name and a set of instructions that are executed when the function is called. The functions &amp;lt;b&amp;gt;void setup()&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;void loop()&amp;lt;/b&amp;gt; have already been explained. There are more built-in functions that will be discussed later. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Type FunctionName(parameter)&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following integer type function &amp;lt;b&amp;gt;delayVal()&amp;lt;/b&amp;gt; is used to insert a delay value into a program by reading a potentiometer. First a local variable &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is created. Next, &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is equated with the position of the potentiometer, which can have a value between &amp;lt;b&amp;gt;0 and 1023&amp;lt;/b&amp;gt;. The value is then &amp;lt;b&amp;gt;divided by 4 to get a scale from 0 to 255&amp;lt;/b&amp;gt; and at the end the result of the function is returned to the main program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int delayVal()&lt;br /&gt;
{&lt;br /&gt;
 int v;                     // create temporary variable &#039;v&lt;br /&gt;
 v = analogRead(pot);       // read potentiometer Value&lt;br /&gt;
 v /= 4;                    // Convert from 0-1023 to 0-255&lt;br /&gt;
 return v;                  // return the calculated value&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== {} curly brackets ===&lt;br /&gt;
Curly brackets (also called &amp;lt;b&amp;gt;&#039;curly brackets&#039;&amp;lt;/b&amp;gt;) define the start and end of function and statement blocks as in the &amp;lt;b&amp;gt;&#039;void loop()&#039;&amp;lt;/b&amp;gt; function and also in the &amp;lt;b&amp;gt;&#039;for&#039; and &#039;if&#039;&amp;lt;/b&amp;gt; statement. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type function()&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: An opening curved bracket &#039;{&#039; must always be followed by a closing curved bracket &#039;}&#039;. Here it is often said that the number of brackets must be balanced. Unbalanced parentheses often lead to cryptic, inscrutable errors in the compiler, which are sometimes hard to find, especially in large programs.&lt;br /&gt;
&lt;br /&gt;
The Arduino programming environment helps to check that the curved brackets are balanced. To do this, simply select a brace or click just behind it, and the logically connected counterpart is highlighted. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ;semicolon ===&lt;br /&gt;
A semicolon must be used at the end of a statement and is used to separate the elements of a program.&lt;br /&gt;
A semicolon is also used to separate the elements of a for loop. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int x = 13; // declares variable &#039;x&#039; as integer with value 13&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Forgetting a semicolon at the end of a line leads to an error in the compiler. The error description can be very clear and directly point to the missing semicolon, but this does not have to be the case. If an inscrutable or apparently illogical error is reported, the first thing to do is to add missing semicolons near the reported error. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== /*... */ block comments ===&lt;br /&gt;
Block comments or multiline comments are text areas that are ignored by the program. They are used for longer descriptions or comments and help other authors to understand program parts. They start with /* and end with */ and can cover several lines. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/* This is an inserted block comment&lt;br /&gt;
 please do not forget the closing comment -&lt;br /&gt;
 These must be balanced&lt;br /&gt;
*/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== // Single line comments ===&lt;br /&gt;
Simple single-line comments are defined with a // at the beginning of the line and end with the end of the line. They are ignored by the program and do not consume memory. &lt;br /&gt;
&amp;lt;pre&amp;gt;// this is a single line comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
A variable is the name of a numeric value with a name and memory location for later use in a program. A variable must be declared and optionally provided with a value. The following example declares a variable &#039;inputVariable&#039; and assigns the value of analog pin 2 to it: &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;          // declares a variable and&lt;br /&gt;
                                     // sets its value to 0&lt;br /&gt;
inputVariable = analogRead(2);      // sets the value of the variable equal&lt;br /&gt;
                                    // with the value of analog pin 2 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;inputVariable&#039; is the variable itself. The first line explains that its data type is &#039;int&#039;, which is the short expression for integer. The second line gives the variable the value of the analog pin 2, making the value of the pin available everywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Variables should always have descriptive names as clearly as possible to make the code easier to read.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Declaration of variables: ===&lt;br /&gt;
All variables must be declared before use. Declaring a variable means defining its type such as int, long, float, etc., giving it a name and optionally an initial value.This only needs to be done once in the program. Afterwards the value can be changed at any time by calculations or various assignments. &lt;br /&gt;
&lt;br /&gt;
The following example declares &#039;inputVariable&#039; as &#039;int&#039;, i.e. integer data type and sets the initial value to 0. This is called a &#039;simple assignment&#039;. &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A variable can be declared at many places in the program. The location of the declaration determines which program parts have access to the variable. &lt;br /&gt;
&lt;br /&gt;
== Data types ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;byte&amp;lt;/b&amp;gt;: Byte stores an &amp;lt;b&amp;gt;8-bit numeric&amp;lt;/b&amp;gt;, integer value without decimal point. The &amp;lt;b&amp;gt;value&amp;lt;/b&amp;gt; can be between &amp;lt;b&amp;gt;0 and 255&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;byte someVariable = 180;         // declares &#039;someVariable as a &#039;byte&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;int&amp;lt;/b&amp;gt;: Integers are the most common data type for storing integer values without decimal point. Its &amp;lt;b&amp;gt;value&amp;lt;/b&amp;gt; is &amp;lt;b&amp;gt;16 bits and ranges from -32,767 to 32,768&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;int someVariable = 1500;        // declares &#039;someVariable as an &#039;integer&#039; data type&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;long&amp;lt;/b&amp;gt;: Data type for long integers with extended size, without decimal point, &amp;lt;b&amp;gt;stored in a 32-bit&amp;lt;/b&amp;gt; value in a spectrum from &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp;&amp;lt;b&amp;gt;-2,147,483,648 to 2,147,483,647&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;long someVariable = 90000;      // declares &#039;someVariable as a &#039;long&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;float&amp;lt;/b&amp;gt;: A data type for floating point values or numbers with decimal places. Floating point numbers have a better resolution than integers and are&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; expressed as &amp;lt;b&amp;gt;32-bit values with a spectrum from -3.4028235E+38 to 3.4028235E+38&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;float someVariable = 3.14;      // declares &#039;someVariable&#039; as a &#039;float&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Floating point numbers are not precise and may lead to strange results when compared. Also, floating-point calculations are much slower than with integer data types. Calculations with floating-point values should be avoided if possible. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;arrays&amp;lt;/b&amp;gt;: An array is a collection of values that are accessed with an index number.&lt;br /&gt;
Each value in the array can be accessed by retrieving the name of&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; the array and the index number of the value. The index number always starts at 0 for an array.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; An array must be declared and optionally assigned values before it can be used.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[] = {value0, value1, value2...} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the same way it is possible to declare an array first with datatype and size and later to give a value to an index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[5];        // declare datatype &#039;integer&#039; as array with 5 Positions&lt;br /&gt;
myArray[3] = 10;            // gives the 4th index the value 10  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To read the value of an array you can simply assign it to a variable specifying the array and the index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;x = myArray[3];       // x now has the value 10 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arrays are often used for loops, where the counter of the loop is also used as index position for the values in the array. The following example uses an array to make an LED flicker. With a for loop and a counter starting at 0 an index position in the array is read, sent to the LED pin, paused for 200ms and then the same is done with the next index position. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 10; // LED on pin 10&lt;br /&gt;
byte flicker[] = {180, 30, 255, 200, 10, 90, 150, 60};    // array with 8 different values&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);    // Sets the OUTPUT pin&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for(int i=0; i&amp;lt;7; i++)               // loop equals the number&lt;br /&gt;
 { // of the values in the array&lt;br /&gt;
 analogWrite(ledPin, flicker[i]);     // writes the index value to the LED&lt;br /&gt;
 delay(200);                          // 200ms pause&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Digitaler Input - Output ==&lt;br /&gt;
=== pinMode(pin,mode) ===&lt;br /&gt;
Used in &#039;void setup()&#039; to configure a specific pin as either input or output. &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, OUTPUT); // sets &#039;pin&#039; as output &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arduino digital pins are inputs by default, so they don&#039;t need to be specified as inputs with &#039;pinMode()&#039;. Pins configured as inputs have a high impedance state. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: There are also comfortable 20 k &#039;pullup&#039; resistors in the ATmega chip which are accessible via software.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These built-in &#039;pullup&#039; resistors can be accessed in the following way: &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, INPUT);        // sets &#039;pin&#039; as input&lt;br /&gt;
digitalWrite(pin, HIGH);        // switches on the &#039;Pullup&#039; resistor&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pullup resistors are normally used to connect inputs like switches. In the example shown here it is noticeable that the pin is not defined as an output&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; although it is written to. It is only the method to activate the internal &#039;pullup&#039; resistor.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pins configured as output are in a low impedance state and can be loaded with a maximum of 40 mAmpere current from connected elements&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; and circuits. This is enough to make an LED light up (don&#039;t forget the serial resistor), but not enough to drive most relays, solenoids or motors.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Short circuits at the Arduino pins as well as too high current can destroy the output pin or even the whole ATmega chip. For this reason it is a good idea&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; to connect an output pin with external elements in series with a 470 or 1K resistor to&lt;br /&gt;
switch.&lt;br /&gt;
&lt;br /&gt;
=== digitalRead(pin) ===&lt;br /&gt;
digitalRead(pin)&#039; reads the value from a specified digital pin, with the result either HIGH or LOW. The pin can be set either as a variable or constant (0-13). &lt;br /&gt;
&amp;lt;pre&amp;gt;value = digitalRead(Pin);      // sets &#039;value&#039; equal to the input pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
digitalWrite(pin,value)&lt;br /&gt;
Outputs either logic level HIGH or LOW at a specified pin. The pin can be set as a variable or constant (0-13).&lt;br /&gt;
&amp;lt;pre&amp;gt;digitalWrite(pin, HIGH);       // sets &#039;pin&#039; to high&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example reads a button on a digital input and switches an LED on when the button is pressed: &lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 13;            // LED connected to pin 13&lt;br /&gt;
int pin = 7;                 // Button connected to pin 7&lt;br /&gt;
int value = 0;              // Variable to store the readout value&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(led, OUTPUT);    // defines pin 13 as output&lt;br /&gt;
 pinMode(pin, INPUT);     // sets pin 7 as input&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = digitalRead(pin);    // sets &#039;value&#039; equal to&lt;br /&gt;
 // the input pin&lt;br /&gt;
 digitalWrite(led, value);    // sets &#039;led&#039; equal to the&lt;br /&gt;
}                             // Value of the button&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Analoger Input - Output ==&lt;br /&gt;
=== analogRead(pin) ===&lt;br /&gt;
Reads the value of a specified analog pin with a 10 bit resolution. This function is only available for pins (0-5). The resulting integer values have a spectrum from 0 to 1023. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = analogRead(pin);     // sets &#039;value&#039; equal to &#039;pin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Unlike digital pins, analog pins do not have to be declared as input or output first. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analogWrite(pin, value) ===&lt;br /&gt;
Writes pseudo-analog values to an output pin using hardware-based pulse width modulation (PWM). On newer Arduino boards with the ATmega 168 chip this function is applicable to pins 3, 5, 6, 9, 10 and 11. Older Arduinos with the ATmega8 only support pins 9,10 and 11. The value can be set as a variable or constant in the range 0-255.&lt;br /&gt;
&amp;lt;pre&amp;gt;analogWrite(pin, value);     // writes &#039;value&#039; to the analog &#039;pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A value of 0 generates a uniform voltage of 0 volts at a fixed pin; a value of 255 generates a uniform voltage of 5 volts at a fixed pin. For values between 0 and 255, the pin changes very quickly between 0 and 5 volts - the higher the value, the longer the pin is HIGH (5 volts). For a value of 64, the pin is at 0 volts for three-quarters of the time and at 5 volts for one-quarter of the time. A value of 128 means that the output voltage is HIGH half of the time and LOW the other half. A value of 192 means that the voltage at the pin measures 0 volts at one quarter of the time and the full 5 volts at three quarters of the time. &lt;br /&gt;
&lt;br /&gt;
Because this is a hardware-based function, the constant wave runs independently of the program until the next change of state via analogWrite (or a call to digitalRead or digitalWrite on the same pin). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: In contrast to digital pins, analog pins do not have to be declared as input or output before. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The following example reads an analog value from &#039;pin&#039;, converts the value by dividing it by 4 and then outputs it as a PWM signal to &#039;led&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 10;    // LED with 220 resistor at pin 10&lt;br /&gt;
int pin = 0;         // Potentiometer at analog pin 0&lt;br /&gt;
int value;           // Value for readout&lt;br /&gt;
&lt;br /&gt;
void setup(){}      // no setup required&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = analogRead(pin);      // sets &#039;value&#039; equal to &#039;pin&lt;br /&gt;
 value /= 4; // converts 0-1023 into 0-255&lt;br /&gt;
 analogWrite(led, value);     // outputs the PWM signal &#039;led&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Random functions ==&lt;br /&gt;
=== randomSeed(seed) ===&lt;br /&gt;
Sets a value or &#039;Seed&#039; as starting point for the random() function.&lt;br /&gt;
&amp;lt;pre&amp;gt;randomSeed(value);       // sets &#039;value&#039; as the random seed&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Arduino itself is not able to produce a truly random value. With randomSeed() a variable can be used as &#039;seed&#039; to get better random results. For example, millis() or analogRead() can be used as a seed variable or function to use electrical noise through the analog pin as an output for random values. &lt;br /&gt;
&lt;br /&gt;
=== random(min, max) ===&lt;br /&gt;
The random function allows the generation of pseudo-random values within a defined range of minimum and maxium values. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = random(100, 200);        // sets &#039;value&#039; with a random number between 100 and 200 equal &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example generates a random value between 0 and 255 and outputs it as PWM signal on a PWM pin. &lt;br /&gt;
&amp;lt;pre&amp;gt;int randNumber;      // Variable to store the random value&lt;br /&gt;
int led = 10;            // LED with 220 Ohm resistor at pin 10&lt;br /&gt;
&lt;br /&gt;
void setup() {}          // no setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 randomSeed(millis());              // uses millis() as seed&lt;br /&gt;
 randNumber = random(255);          // Random number in the range 0-255&lt;br /&gt;
 analogWrite(led, randNumber);      // PWM signal as output&lt;br /&gt;
 delay(500);                        // half second pause&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Serial communication ==&lt;br /&gt;
=== Serial.begin(rate) ===&lt;br /&gt;
Serial.begin(rate)&#039; Opens the serial port and sets the baud rate for the serial transmission. The typical baud rate with the computer is 9600 baud. Other speeds are also supported.&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);      // opens serial port&lt;br /&gt;
} // sets the data rate to 9600 bps&amp;lt;/pre&amp;gt; &lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: When using serial communication, digital pins 0 (RX) and 1 (TX) cannot be used at the same time. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Serial.println(data) ===&lt;br /&gt;
Writes data to the serial port, followed by an automatic line break as carrier return and line feed. This function has the same form as &#039;Serial.print()&#039;, but is easier to read on the serial monitor. &lt;br /&gt;
&amp;lt;pre&amp;gt;Serial.println(analogValue);         // sends the value of &#039;analogValue&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More detailed information about the numerous variants of the &#039;Serial.println()&#039; and &#039;Serial.print()&#039; functions can be found on the Arduino website. &lt;br /&gt;
&lt;br /&gt;
The following simple example reads a value from analog pin 0 and sends the data to the computer once per second. &lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);                // sets the data rate to 9600 bps&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 Serial.println(analogRead(0));   // sends the analog value&lt;br /&gt;
 delay(1000);                    // pauses for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Digital output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Output.JPG|thumb|none|300px|Arduino-Example-Digital-Output]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a simple &#039;Hello World&#039; program and turns something on and off. In this example a LED is connected to PIN 13 and flashes every second. The resistor may be superfluous at this pin because the Arduino has a built-in resistor. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;            // LED off digital pin 13&lt;br /&gt;
&lt;br /&gt;
void setup()                     // will run through once&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // sets pin 13 as output&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()                      // Running as endless loop&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);    // switches the LED on&lt;br /&gt;
 delay(1000);                   // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);    // switches the LED off&lt;br /&gt;
 delay(1000);                 // Pause for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Digital input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Input.JPG|thumb|none|300px|Arduino-Example-Digital-Input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the simplest form of an input with only two possible states: on or off.&lt;br /&gt;
This example reads out a simple switch or button at pin 2. When the switch is closed and the input pin is HIGH, the LED is turned on. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;               // Output pin for the LED&lt;br /&gt;
int inPin = 2;                     // Input pin for a switch&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);         // declares LED as output&lt;br /&gt;
 pinMode(inPin, INPUT);           // declares switch as input&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
 if (digitalRead(inPin) == HIGH)   // check if this is the HIGH input&lt;br /&gt;
 {&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches the LED on&lt;br /&gt;
 delay(1000);                  // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);   // switches the LED off&lt;br /&gt;
 delay(1000);                // Pause for 1 second&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analog PWM output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pulse width modulation (PWM) is a method of simulating analog outputs by pulsing the output voltage. This allows you to make an LED brighter or darker or check a servomotor later. The following example uses a loop to slowly make an LED brighter and darker. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 9;            // PWM Pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup(){}                  // No setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for (int i=0; i&amp;lt;=255; i++)     // ascending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);        // sets the brightness value to i&lt;br /&gt;
 delay(100);                    // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 for (int i=255; i&amp;gt;=0; i--)     // descending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);       // sets the brightness value to i&lt;br /&gt;
 delay(100);                   // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== potentiometer Input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With a potentiometer and one of the analog-digital converter (ADC) inputs of the Arduino it is possible to read analog values from 0-1024. The following example uses a potentiometer to control the blinking rate of an LED.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int potPin = 0;              // Input pin for the potentiometer&lt;br /&gt;
int ledPin = 13;                 // Output pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // declare ledPin as OUTPUT&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches on ledPin&lt;br /&gt;
 delay(analogRead(potPin));      // pauses the program by the value of potentiometers&lt;br /&gt;
 digitalWrite(ledPin, LOW);      // switches ledPin off&lt;br /&gt;
 delay(analogRead(potPin));     // pauses the program by the value of potentiometers&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR WAN 1300 LoRa]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR LoRa Gateway Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.elektronik-kompendium.de/sites/com/1810231.htm&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://myhomearchiv.synology.me/download/Anleitung_Furduino.pdf&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/arduino-uno/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/category/projekte/arduino-projekte/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.netzmafia.de/skripten/hardware/Arduino/Arduino_Programmierhandbuch.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4537</id>
		<title>Arduino Board Uno Rev3-Atmega 328: Programming Guide</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4537"/>
		<updated>2020-08-10T20:52:32Z</updated>

		<summary type="html">&lt;p&gt;CCinay: /* Data types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The &amp;lt;b&amp;gt;Arduino IDE&amp;lt;/b&amp;gt; is a cross-platform Java application that acts as a program code editor and compiler and is also able to send firmware serially to the board. The development environment is based on Processing, an IDE designed to program artists, who normally do not have much contact with the art world programming environments. The programming language is based on Wiring, a C similar language which has a similar scope for a more restricted board design, whose IDE is also based on processing. Make sure you have an updated version of &amp;lt;b&amp;gt;[https://www.arduino.cc/en/Main/Software Arduino IDE]&amp;lt;/b&amp;gt; installed.&lt;br /&gt;
&lt;br /&gt;
== Struktur ==&lt;br /&gt;
The basic structure of the Arduino programming language is relatively simple and is divided into at least two parts. These two required parts or functions enclose blocks of statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup() {     // put your setup code here, to run once:&lt;br /&gt;
}&lt;br /&gt;
void loop() {      // put your main code here, to run repeatedly:&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Here &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; is the preparation and &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; is the execution. Both functions are necessary to execute the program. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup function should follow the variable definition, which must be listed before. Setup must be run through as the first function in a program. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; It is executed only once and is used to set &amp;lt;b&amp;gt;PinMode&amp;lt;/b&amp;gt; or to initiate serial communication. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set PinModes or start serial communication. The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; appear in every program, even if it does not contain any instructions.  &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; After the &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function follows the &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; function. It contains program code that is executed continuously in an infinite loop - read inputs, trigger &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; outputs, etc. This function is the core of all Arduino programs and does the main work. &lt;br /&gt;
&lt;br /&gt;
=== setup() ===&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set &amp;lt;b&amp;gt;PinModes&amp;lt;/b&amp;gt; or start serial communication.&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must appear in every program, even if it does not contain any instructions. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(pin, OUTPUT);     // &#039;pin&#039; define as output&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== loop() ===&lt;br /&gt;
After running through the &amp;lt;b&amp;gt;setup() function&amp;lt;/b&amp;gt;, the &amp;lt;b&amp;gt;loop() function&amp;lt;/b&amp;gt; does exactly what its name suggests and runs in an endless loop. This allows the program to interact with the Arduino board via changes, reactions and controls. &lt;br /&gt;
&amp;lt;pre&amp;gt;void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(pin, HIGH);    // switches &#039;pin&#039; on&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
 digitalWrite(pin, LOW);     // switches &#039;pin&#039; off&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
A function is a block of program code that has a name and a set of instructions that are executed when the function is called. The functions &amp;lt;b&amp;gt;void setup()&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;void loop()&amp;lt;/b&amp;gt; have already been explained. There are more built-in functions that will be discussed later. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Type FunctionName(parameter)&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following integer type function &amp;lt;b&amp;gt;delayVal()&amp;lt;/b&amp;gt; is used to insert a delay value into a program by reading a potentiometer. First a local variable &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is created. Next, &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is equated with the position of the potentiometer, which can have a value between &amp;lt;b&amp;gt;0 and 1023&amp;lt;/b&amp;gt;. The value is then &amp;lt;b&amp;gt;divided by 4 to get a scale from 0 to 255&amp;lt;/b&amp;gt; and at the end the result of the function is returned to the main program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int delayVal()&lt;br /&gt;
{&lt;br /&gt;
 int v;                     // create temporary variable &#039;v&lt;br /&gt;
 v = analogRead(pot);       // read potentiometer Value&lt;br /&gt;
 v /= 4;                    // Convert from 0-1023 to 0-255&lt;br /&gt;
 return v;                  // return the calculated value&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== {} curly brackets ===&lt;br /&gt;
Curly brackets (also called &amp;lt;b&amp;gt;&#039;curly brackets&#039;&amp;lt;/b&amp;gt;) define the start and end of function and statement blocks as in the &amp;lt;b&amp;gt;&#039;void loop()&#039;&amp;lt;/b&amp;gt; function and also in the &amp;lt;b&amp;gt;&#039;for&#039; and &#039;if&#039;&amp;lt;/b&amp;gt; statement. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type function()&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: An opening curved bracket &#039;{&#039; must always be followed by a closing curved bracket &#039;}&#039;. Here it is often said that the number of brackets must be balanced. Unbalanced parentheses often lead to cryptic, inscrutable errors in the compiler, which are sometimes hard to find, especially in large programs.&lt;br /&gt;
&lt;br /&gt;
The Arduino programming environment helps to check that the curved brackets are balanced. To do this, simply select a brace or click just behind it, and the logically connected counterpart is highlighted. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ;semicolon ===&lt;br /&gt;
A semicolon must be used at the end of a statement and is used to separate the elements of a program.&lt;br /&gt;
A semicolon is also used to separate the elements of a for loop. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int x = 13; // declares variable &#039;x&#039; as integer with value 13&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Forgetting a semicolon at the end of a line leads to an error in the compiler. The error description can be very clear and directly point to the missing semicolon, but this does not have to be the case. If an inscrutable or apparently illogical error is reported, the first thing to do is to add missing semicolons near the reported error. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== /*... */ block comments ===&lt;br /&gt;
Block comments or multiline comments are text areas that are ignored by the program. They are used for longer descriptions or comments and help other authors to understand program parts. They start with /* and end with */ and can cover several lines. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/* This is an inserted block comment&lt;br /&gt;
 please do not forget the closing comment -&lt;br /&gt;
 These must be balanced&lt;br /&gt;
*/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== // Single line comments ===&lt;br /&gt;
Simple single-line comments are defined with a // at the beginning of the line and end with the end of the line. They are ignored by the program and do not consume memory. &lt;br /&gt;
&amp;lt;pre&amp;gt;// this is a single line comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
A variable is the name of a numeric value with a name and memory location for later use in a program. A variable must be declared and optionally provided with a value. The following example declares a variable &#039;inputVariable&#039; and assigns the value of analog pin 2 to it: &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;          // declares a variable and&lt;br /&gt;
                                     // sets its value to 0&lt;br /&gt;
inputVariable = analogRead(2);      // sets the value of the variable equal&lt;br /&gt;
                                    // with the value of analog pin 2 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;inputVariable&#039; is the variable itself. The first line explains that its data type is &#039;int&#039;, which is the short expression for integer. The second line gives the variable the value of the analog pin 2, making the value of the pin available everywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Variables should always have descriptive names as clearly as possible to make the code easier to read.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Declaration of variables: ===&lt;br /&gt;
All variables must be declared before use. Declaring a variable means defining its type such as int, long, float, etc., giving it a name and optionally an initial value.This only needs to be done once in the program. Afterwards the value can be changed at any time by calculations or various assignments. &lt;br /&gt;
&lt;br /&gt;
The following example declares &#039;inputVariable&#039; as &#039;int&#039;, i.e. integer data type and sets the initial value to 0. This is called a &#039;simple assignment&#039;. &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A variable can be declared at many places in the program. The location of the declaration determines which program parts have access to the variable. &lt;br /&gt;
&lt;br /&gt;
== Data types ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;byte&amp;lt;/b&amp;gt;: Byte stores an &amp;lt;b&amp;gt;8-bit numeric&amp;lt;/b&amp;gt;, integer value without decimal point. The &amp;lt;b&amp;gt;value&amp;lt;/b&amp;gt; can be between &amp;lt;b&amp;gt;0 and 255&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;byte someVariable = 180;         // declares &#039;someVariable as a &#039;byte&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;int&amp;lt;/b&amp;gt;: Integers are the most common data type for storing integer values without decimal point. Its &amp;lt;b&amp;gt;value&amp;lt;/b&amp;gt; is &amp;lt;b&amp;gt;16 bits and ranges from -32,767 to 32,768&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;int someVariable = 1500;        // declares &#039;someVariable as an &#039;integer&#039; data type&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;long&amp;lt;/b&amp;gt;: Data type for long integers with extended size, without decimal point, &amp;lt;b&amp;gt;stored in a 32-bit&amp;lt;/b&amp;gt; value in a spectrum from &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp;&amp;lt;b&amp;gt;-2,147,483,648 to 2,147,483,647&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;long someVariable = 90000;      // declares &#039;someVariable as a &#039;long&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;float&amp;lt;/b&amp;gt;: A data type for floating point values or numbers with decimal places. Floating point numbers have a better resolution than integers and are&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; expressed as &amp;lt;b&amp;gt;32-bit values with a spectrum from -3.4028235E+38 to 3.4028235E+38&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;float someVariable = 3.14;      // declares &#039;someVariable&#039; as a &#039;float&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Floating point numbers are not precise and may lead to strange results when compared. Also, floating-point calculations are much slower than with integer data types. Calculations with floating-point values should be avoided if possible. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;arrays&amp;lt;/b&amp;gt;: An array is a collection of values that are accessed with an index number.&lt;br /&gt;
Each value in the array can be accessed by retrieving the name of&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; the array and the index number of the value. The index number always starts at 0 for an array.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; An array must be declared and optionally assigned values before it can be used.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[] = {value0, value1, value2...} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the same way it is possible to declare an array first with datatype and size and later to give a value to an index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[5];        // declare datatype &#039;integer&#039; as array with 5 Positions&lt;br /&gt;
myArray[3] = 10;            // gives the 4th index the value 10  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To read the value of an array you can simply assign it to a variable specifying the array and the index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;x = myArray[3];       // x now has the value 10 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arrays are often used for loops, where the counter of the loop is also used as index position for the values in the array. The following example uses an array to make an LED flicker. With a for loop and a counter starting at 0 an index position in the array is read, sent to the LED pin, paused for 200ms and then the same is done with the next index position. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 10; // LED on pin 10&lt;br /&gt;
byte flicker[] = {180, 30, 255, 200, 10, 90, 150, 60};    // array with 8 different values&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);    // Sets the OUTPUT pin&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for(int i=0; i&amp;lt;7; i++)               // loop equals the number&lt;br /&gt;
 { // of the values in the array&lt;br /&gt;
 analogWrite(ledPin, flicker[i]);     // writes the index value to the LED&lt;br /&gt;
 delay(200);                          // 200ms pause&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Digitaler Input - Output ==&lt;br /&gt;
=== pinMode(pin,mode) ===&lt;br /&gt;
Used in &#039;void setup()&#039; to configure a specific pin as either input or output. &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, OUTPUT); // sets &#039;pin&#039; as output &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arduino digital pins are inputs by default, so they don&#039;t need to be specified as inputs with &#039;pinMode()&#039;. Pins configured as inputs have a high impedance state. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: There are also comfortable 20 k &#039;pullup&#039; resistors in the ATmega chip which are accessible via software.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These built-in &#039;pullup&#039; resistors can be accessed in the following way: &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, INPUT);        // sets &#039;pin&#039; as input&lt;br /&gt;
digitalWrite(pin, HIGH);        // switches on the &#039;Pullup&#039; resistor&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pullup resistors are normally used to connect inputs like switches. In the example shown here it is noticeable that the pin is not defined as an output&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; although it is written to. It is only the method to activate the internal &#039;pullup&#039; resistor.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pins configured as output are in a low impedance state and can be loaded with a maximum of 40 mAmpere current from connected elements&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; and circuits. This is enough to make an LED light up (don&#039;t forget the serial resistor), but not enough to drive most relays, solenoids or motors.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Short circuits at the Arduino pins as well as too high current can destroy the output pin or even the whole ATmega chip. For this reason it is a good idea&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; to connect an output pin with external elements in series with a 470 or 1K resistor to&lt;br /&gt;
switch.&lt;br /&gt;
&lt;br /&gt;
=== digitalRead(pin) ===&lt;br /&gt;
digitalRead(pin)&#039; reads the value from a specified digital pin, with the result either HIGH or LOW. The pin can be set either as a variable or constant (0-13). &lt;br /&gt;
&amp;lt;pre&amp;gt;value = digitalRead(Pin);      // sets &#039;value&#039; equal to the input pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
digitalWrite(pin,value)&lt;br /&gt;
Outputs either logic level HIGH or LOW at a specified pin. The pin can be set as a variable or constant (0-13).&lt;br /&gt;
&amp;lt;pre&amp;gt;digitalWrite(pin, HIGH);       // sets &#039;pin&#039; to high&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example reads a button on a digital input and switches an LED on when the button is pressed: &lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 13;            // LED connected to pin 13&lt;br /&gt;
int pin = 7;                 // Button connected to pin 7&lt;br /&gt;
int value = 0;              // Variable to store the readout value&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(led, OUTPUT);    // defines pin 13 as output&lt;br /&gt;
 pinMode(pin, INPUT);     // sets pin 7 as input&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = digitalRead(pin);    // sets &#039;value&#039; equal to&lt;br /&gt;
 // the input pin&lt;br /&gt;
 digitalWrite(led, value);    // sets &#039;led&#039; equal to the&lt;br /&gt;
}                             // Value of the button&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Analoger Input - Output ==&lt;br /&gt;
=== analogRead(pin) ===&lt;br /&gt;
Reads the value of a specified analog pin with a 10 bit resolution. This function is only available for pins (0-5). The resulting integer values have a spectrum from 0 to 1023. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = analogRead(pin);     // sets &#039;value&#039; equal to &#039;pin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Unlike digital pins, analog pins do not have to be declared as input or output first. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analogWrite(pin, value) ===&lt;br /&gt;
Writes pseudo-analog values to an output pin using hardware-based pulse width modulation (PWM). On newer Arduino boards with the ATmega 168 chip this function is applicable to pins 3, 5, 6, 9, 10 and 11. Older Arduinos with the ATmega8 only support pins 9,10 and 11. The value can be set as a variable or constant in the range 0-255.&lt;br /&gt;
&amp;lt;pre&amp;gt;analogWrite(pin, value);     // writes &#039;value&#039; to the analog &#039;pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A value of 0 generates a uniform voltage of 0 volts at a fixed pin; a value of 255 generates a uniform voltage of 5 volts at a fixed pin. For values between 0 and 255, the pin changes very quickly between 0 and 5 volts - the higher the value, the longer the pin is HIGH (5 volts). For a value of 64, the pin is at 0 volts for three-quarters of the time and at 5 volts for one-quarter of the time. A value of 128 means that the output voltage is HIGH half of the time and LOW the other half. A value of 192 means that the voltage at the pin measures 0 volts at one quarter of the time and the full 5 volts at three quarters of the time. &lt;br /&gt;
&lt;br /&gt;
Because this is a hardware-based function, the constant wave runs independently of the program until the next change of state via analogWrite (or a call to digitalRead or digitalWrite on the same pin). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: In contrast to digital pins, analog pins do not have to be declared as input or output before. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The following example reads an analog value from &#039;pin&#039;, converts the value by dividing it by 4 and then outputs it as a PWM signal to &#039;led&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 10;    // LED with 220 resistor at pin 10&lt;br /&gt;
int pin = 0;         // Potentiometer at analog pin 0&lt;br /&gt;
int value;           // Value for readout&lt;br /&gt;
&lt;br /&gt;
void setup(){}      // no setup required&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = analogRead(pin);      // sets &#039;value&#039; equal to &#039;pin&lt;br /&gt;
 value /= 4; // converts 0-1023 into 0-255&lt;br /&gt;
 analogWrite(led, value);     // outputs the PWM signal &#039;led&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Random functions ==&lt;br /&gt;
=== randomSeed(seed) ===&lt;br /&gt;
Sets a value or &#039;Seed&#039; as starting point for the random() function.&lt;br /&gt;
&amp;lt;pre&amp;gt;randomSeed(value);       // sets &#039;value&#039; as the random seed&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Arduino itself is not able to produce a truly random value. With randomSeed() a variable can be used as &#039;seed&#039; to get better random results. For example, millis() or analogRead() can be used as a seed variable or function to use electrical noise through the analog pin as an output for random values. &lt;br /&gt;
&lt;br /&gt;
=== random(min, max) ===&lt;br /&gt;
The random function allows the generation of pseudo-random values within a defined range of minimum and maxium values. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = random(100, 200);        // sets &#039;value&#039; with a random number&lt;br /&gt;
                                     // between 100 and 200 equal &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example generates a random value between 0 and 255 and outputs it as PWM signal on a PWM pin. &lt;br /&gt;
&amp;lt;pre&amp;gt;int randNumber;     // Variable to store the random value&lt;br /&gt;
int led = 10;           // LED with 220 Ohm resistor at pin 10&lt;br /&gt;
&lt;br /&gt;
void setup() {}         // no setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 randomSeed(millis());              // uses millis() as seed&lt;br /&gt;
 randNumber = random(255);          // Random number in the range 0-255&lt;br /&gt;
 analogWrite(led, randNumber);      // PWM signal as output&lt;br /&gt;
 delay(500);                        // half second pause&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Serial communication ==&lt;br /&gt;
=== Serial.begin(rate) ===&lt;br /&gt;
Serial.begin(rate)&#039; Opens the serial port and sets the baud rate for the serial transmission. The typical baud rate with the computer is 9600 baud. Other speeds are also supported.&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);      // opens serial port&lt;br /&gt;
} // sets the data rate to 9600 bps&amp;lt;/pre&amp;gt; &lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: When using serial communication, digital pins 0 (RX) and 1 (TX) cannot be used at the same time. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Serial.println(data) ===&lt;br /&gt;
Writes data to the serial port, followed by an automatic line break as carrier return and line feed. This function has the same form as &#039;Serial.print()&#039;, but is easier to read on the serial monitor. &lt;br /&gt;
&amp;lt;pre&amp;gt;Serial.println(analogValue);         // sends the value of &#039;analogValue&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More detailed information about the numerous variants of the &#039;Serial.println()&#039; and &#039;Serial.print()&#039; functions can be found on the Arduino website. &lt;br /&gt;
&lt;br /&gt;
The following simple example reads a value from analog pin 0 and sends the data to the computer once per second. &lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);                // sets the data rate to 9600 bps&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 Serial.println(analogRead(0));   // sends the analog value&lt;br /&gt;
 delay(1000);                    // pauses for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Digital output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Output.JPG|thumb|none|300px|Arduino-Example-Digital-Output]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a simple &#039;Hello World&#039; program and turns something on and off. In this example a LED is connected to PIN 13 and flashes every second. The resistor may be superfluous at this pin because the Arduino has a built-in resistor. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;            // LED off digital pin 13&lt;br /&gt;
&lt;br /&gt;
void setup()                     // will run through once&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // sets pin 13 as output&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()                      // Running as endless loop&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);    // switches the LED on&lt;br /&gt;
 delay(1000);                   // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);    // switches the LED off&lt;br /&gt;
 delay(1000);                 // Pause for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Digital input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Input.JPG|thumb|none|300px|Arduino-Example-Digital-Input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the simplest form of an input with only two possible states: on or off.&lt;br /&gt;
This example reads out a simple switch or button at pin 2. When the switch is closed and the input pin is HIGH, the LED is turned on. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;               // Output pin for the LED&lt;br /&gt;
int inPin = 2;                     // Input pin for a switch&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);         // declares LED as output&lt;br /&gt;
 pinMode(inPin, INPUT);           // declares switch as input&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
 if (digitalRead(inPin) == HIGH)   // check if this is the HIGH input&lt;br /&gt;
 {&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches the LED on&lt;br /&gt;
 delay(1000);                  // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);   // switches the LED off&lt;br /&gt;
 delay(1000);                // Pause for 1 second&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analog PWM output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pulse width modulation (PWM) is a method of simulating analog outputs by pulsing the output voltage. This allows you to make an LED brighter or darker or check a servomotor later. The following example uses a loop to slowly make an LED brighter and darker. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 9;            // PWM Pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup(){}                  // No setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for (int i=0; i&amp;lt;=255; i++)     // ascending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);        // sets the brightness value to i&lt;br /&gt;
 delay(100);                    // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 for (int i=255; i&amp;gt;=0; i--)     // descending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);       // sets the brightness value to i&lt;br /&gt;
 delay(100);                   // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== potentiometer Input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With a potentiometer and one of the analog-digital converter (ADC) inputs of the Arduino it is possible to read analog values from 0-1024. The following example uses a potentiometer to control the blinking rate of an LED.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int potPin = 0;              // Input pin for the potentiometer&lt;br /&gt;
int ledPin = 13;                 // Output pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // declare ledPin as OUTPUT&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches on ledPin&lt;br /&gt;
 delay(analogRead(potPin));      // pauses the program by the value of potentiometers&lt;br /&gt;
 digitalWrite(ledPin, LOW);      // switches ledPin off&lt;br /&gt;
 delay(analogRead(potPin));     // pauses the program by the value of potentiometers&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR WAN 1300 LoRa]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR LoRa Gateway Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.elektronik-kompendium.de/sites/com/1810231.htm&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://myhomearchiv.synology.me/download/Anleitung_Furduino.pdf&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/arduino-uno/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/category/projekte/arduino-projekte/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.netzmafia.de/skripten/hardware/Arduino/Arduino_Programmierhandbuch.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4536</id>
		<title>Arduino Board Uno Rev3-Atmega 328: Programming Guide</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4536"/>
		<updated>2020-08-10T20:50:18Z</updated>

		<summary type="html">&lt;p&gt;CCinay: /* Data types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The &amp;lt;b&amp;gt;Arduino IDE&amp;lt;/b&amp;gt; is a cross-platform Java application that acts as a program code editor and compiler and is also able to send firmware serially to the board. The development environment is based on Processing, an IDE designed to program artists, who normally do not have much contact with the art world programming environments. The programming language is based on Wiring, a C similar language which has a similar scope for a more restricted board design, whose IDE is also based on processing. Make sure you have an updated version of &amp;lt;b&amp;gt;[https://www.arduino.cc/en/Main/Software Arduino IDE]&amp;lt;/b&amp;gt; installed.&lt;br /&gt;
&lt;br /&gt;
== Struktur ==&lt;br /&gt;
The basic structure of the Arduino programming language is relatively simple and is divided into at least two parts. These two required parts or functions enclose blocks of statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup() {     // put your setup code here, to run once:&lt;br /&gt;
}&lt;br /&gt;
void loop() {      // put your main code here, to run repeatedly:&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Here &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; is the preparation and &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; is the execution. Both functions are necessary to execute the program. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup function should follow the variable definition, which must be listed before. Setup must be run through as the first function in a program. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; It is executed only once and is used to set &amp;lt;b&amp;gt;PinMode&amp;lt;/b&amp;gt; or to initiate serial communication. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set PinModes or start serial communication. The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; appear in every program, even if it does not contain any instructions.  &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; After the &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function follows the &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; function. It contains program code that is executed continuously in an infinite loop - read inputs, trigger &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; outputs, etc. This function is the core of all Arduino programs and does the main work. &lt;br /&gt;
&lt;br /&gt;
=== setup() ===&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set &amp;lt;b&amp;gt;PinModes&amp;lt;/b&amp;gt; or start serial communication.&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must appear in every program, even if it does not contain any instructions. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(pin, OUTPUT);     // &#039;pin&#039; define as output&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== loop() ===&lt;br /&gt;
After running through the &amp;lt;b&amp;gt;setup() function&amp;lt;/b&amp;gt;, the &amp;lt;b&amp;gt;loop() function&amp;lt;/b&amp;gt; does exactly what its name suggests and runs in an endless loop. This allows the program to interact with the Arduino board via changes, reactions and controls. &lt;br /&gt;
&amp;lt;pre&amp;gt;void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(pin, HIGH);    // switches &#039;pin&#039; on&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
 digitalWrite(pin, LOW);     // switches &#039;pin&#039; off&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
A function is a block of program code that has a name and a set of instructions that are executed when the function is called. The functions &amp;lt;b&amp;gt;void setup()&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;void loop()&amp;lt;/b&amp;gt; have already been explained. There are more built-in functions that will be discussed later. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Type FunctionName(parameter)&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following integer type function &amp;lt;b&amp;gt;delayVal()&amp;lt;/b&amp;gt; is used to insert a delay value into a program by reading a potentiometer. First a local variable &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is created. Next, &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is equated with the position of the potentiometer, which can have a value between &amp;lt;b&amp;gt;0 and 1023&amp;lt;/b&amp;gt;. The value is then &amp;lt;b&amp;gt;divided by 4 to get a scale from 0 to 255&amp;lt;/b&amp;gt; and at the end the result of the function is returned to the main program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int delayVal()&lt;br /&gt;
{&lt;br /&gt;
 int v;                     // create temporary variable &#039;v&lt;br /&gt;
 v = analogRead(pot);       // read potentiometer Value&lt;br /&gt;
 v /= 4;                    // Convert from 0-1023 to 0-255&lt;br /&gt;
 return v;                  // return the calculated value&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== {} curly brackets ===&lt;br /&gt;
Curly brackets (also called &amp;lt;b&amp;gt;&#039;curly brackets&#039;&amp;lt;/b&amp;gt;) define the start and end of function and statement blocks as in the &amp;lt;b&amp;gt;&#039;void loop()&#039;&amp;lt;/b&amp;gt; function and also in the &amp;lt;b&amp;gt;&#039;for&#039; and &#039;if&#039;&amp;lt;/b&amp;gt; statement. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type function()&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: An opening curved bracket &#039;{&#039; must always be followed by a closing curved bracket &#039;}&#039;. Here it is often said that the number of brackets must be balanced. Unbalanced parentheses often lead to cryptic, inscrutable errors in the compiler, which are sometimes hard to find, especially in large programs.&lt;br /&gt;
&lt;br /&gt;
The Arduino programming environment helps to check that the curved brackets are balanced. To do this, simply select a brace or click just behind it, and the logically connected counterpart is highlighted. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ;semicolon ===&lt;br /&gt;
A semicolon must be used at the end of a statement and is used to separate the elements of a program.&lt;br /&gt;
A semicolon is also used to separate the elements of a for loop. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int x = 13; // declares variable &#039;x&#039; as integer with value 13&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Forgetting a semicolon at the end of a line leads to an error in the compiler. The error description can be very clear and directly point to the missing semicolon, but this does not have to be the case. If an inscrutable or apparently illogical error is reported, the first thing to do is to add missing semicolons near the reported error. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== /*... */ block comments ===&lt;br /&gt;
Block comments or multiline comments are text areas that are ignored by the program. They are used for longer descriptions or comments and help other authors to understand program parts. They start with /* and end with */ and can cover several lines. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/* This is an inserted block comment&lt;br /&gt;
 please do not forget the closing comment -&lt;br /&gt;
 These must be balanced&lt;br /&gt;
*/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== // Single line comments ===&lt;br /&gt;
Simple single-line comments are defined with a // at the beginning of the line and end with the end of the line. They are ignored by the program and do not consume memory. &lt;br /&gt;
&amp;lt;pre&amp;gt;// this is a single line comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
A variable is the name of a numeric value with a name and memory location for later use in a program. A variable must be declared and optionally provided with a value. The following example declares a variable &#039;inputVariable&#039; and assigns the value of analog pin 2 to it: &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;          // declares a variable and&lt;br /&gt;
                                     // sets its value to 0&lt;br /&gt;
inputVariable = analogRead(2);      // sets the value of the variable equal&lt;br /&gt;
                                    // with the value of analog pin 2 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;inputVariable&#039; is the variable itself. The first line explains that its data type is &#039;int&#039;, which is the short expression for integer. The second line gives the variable the value of the analog pin 2, making the value of the pin available everywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Variables should always have descriptive names as clearly as possible to make the code easier to read.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Declaration of variables: ===&lt;br /&gt;
All variables must be declared before use. Declaring a variable means defining its type such as int, long, float, etc., giving it a name and optionally an initial value.This only needs to be done once in the program. Afterwards the value can be changed at any time by calculations or various assignments. &lt;br /&gt;
&lt;br /&gt;
The following example declares &#039;inputVariable&#039; as &#039;int&#039;, i.e. integer data type and sets the initial value to 0. This is called a &#039;simple assignment&#039;. &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A variable can be declared at many places in the program. The location of the declaration determines which program parts have access to the variable. &lt;br /&gt;
&lt;br /&gt;
== Data types ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;byte&amp;lt;/b&amp;gt;: Byte stores an &amp;lt;b&amp;gt;8-bit numeric&amp;lt;/b&amp;gt;, integer value without decimal point. The &amp;lt;b&amp;gt;value&amp;lt;/b&amp;gt; can be between &amp;lt;b&amp;gt;0 and 255&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;byte someVariable = 180;         // declares &#039;someVariable as a &#039;byte&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;int&amp;lt;/b&amp;gt;: Integers are the most common data type for storing integer values without decimal point. Its &amp;lt;b&amp;gt;value&amp;lt;/b&amp;gt; is &amp;lt;b&amp;gt;16 bits and ranges from -32,767 to 32,768&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;int someVariable = 1500;        // declares &#039;someVariable as an &#039;integer&#039; data type&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;long&amp;lt;/b&amp;gt;: Data type for long integers with extended size, without decimal point, &amp;lt;b&amp;gt;stored in a 32-bit&amp;lt;/b&amp;gt; value in a spectrum from &amp;lt;b&amp;gt;-2,147,483,648 to 2,147,483,647&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;long someVariable = 90000;      // declares &#039;someVariable as a &#039;long&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;float&amp;lt;/b&amp;gt;: A data type for floating point values or numbers with decimal places. Floating point numbers have a better resolution than integers and are&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; expressed as &amp;lt;b&amp;gt;32-bit values with a spectrum from -3.4028235E+38 to 3.4028235E+38&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;float someVariable = 3.14;      // declares &#039;someVariable&#039; as a &#039;float&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Floating point numbers are not precise and may lead to strange results when compared. Also, floating-point calculations are much slower than with integer data types. Calculations with floating-point values should be avoided if possible. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;arrays&amp;lt;/b&amp;gt;: An array is a collection of values that are accessed with an index number.&lt;br /&gt;
Each value in the array can be accessed by retrieving the name of&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; the array and the index number of the value. The index number always starts at 0 for an array.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; An array must be declared and optionally assigned values before it can be used.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[] = {value0, value1, value2...} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the same way it is possible to declare an array first with datatype and size and later to give a value to an index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[5];        // declare datatype &#039;integer&#039; as array with 5 Positions&lt;br /&gt;
myArray[3] = 10;            // gives the 4th index the value 10  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To read the value of an array you can simply assign it to a variable specifying the array and the index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;x = myArray[3];       // x now has the value 10 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arrays are often used for loops, where the counter of the loop is also used as index position for the values in the array. The following example uses an array to make an LED flicker. With a for loop and a counter starting at 0 an index position in the array is read, sent to the LED pin, paused for 200ms and then the same is done with the next index position. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 10; // LED on pin 10&lt;br /&gt;
byte flicker[] = {180, 30, 255, 200, 10, 90, 150, 60};    // array with 8 different values&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);    // Sets the OUTPUT pin&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for(int i=0; i&amp;lt;7; i++)               // loop equals the number&lt;br /&gt;
 { // of the values in the array&lt;br /&gt;
 analogWrite(ledPin, flicker[i]);     // writes the index value to the LED&lt;br /&gt;
 delay(200);                          // 200ms pause&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Digitaler Input - Output ==&lt;br /&gt;
=== pinMode(pin,mode) ===&lt;br /&gt;
Used in &#039;void setup()&#039; to configure a specific pin as either input or output. &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, OUTPUT); // sets &#039;pin&#039; as output &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arduino digital pins are inputs by default, so they don&#039;t need to be specified as inputs with &#039;pinMode()&#039;. Pins configured as inputs have a high impedance state. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: There are also comfortable 20 k &#039;pullup&#039; resistors in the ATmega chip which are accessible via software.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These built-in &#039;pullup&#039; resistors can be accessed in the following way: &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, INPUT);        // sets &#039;pin&#039; as input&lt;br /&gt;
digitalWrite(pin, HIGH);        // switches on the &#039;Pullup&#039; resistor&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pullup resistors are normally used to connect inputs like switches. In the example shown here it is noticeable that the pin is not defined as an output&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; although it is written to. It is only the method to activate the internal &#039;pullup&#039; resistor.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pins configured as output are in a low impedance state and can be loaded with a maximum of 40 mAmpere current from connected elements&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; and circuits. This is enough to make an LED light up (don&#039;t forget the serial resistor), but not enough to drive most relays, solenoids or motors.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Short circuits at the Arduino pins as well as too high current can destroy the output pin or even the whole ATmega chip. For this reason it is a good idea&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; to connect an output pin with external elements in series with a 470 or 1K resistor to&lt;br /&gt;
switch.&lt;br /&gt;
&lt;br /&gt;
=== digitalRead(pin) ===&lt;br /&gt;
digitalRead(pin)&#039; reads the value from a specified digital pin, with the result either HIGH or LOW. The pin can be set either as a variable or constant (0-13). &lt;br /&gt;
&amp;lt;pre&amp;gt;value = digitalRead(Pin);      // sets &#039;value&#039; equal to the input pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
digitalWrite(pin,value)&lt;br /&gt;
Outputs either logic level HIGH or LOW at a specified pin. The pin can be set as a variable or constant (0-13).&lt;br /&gt;
&amp;lt;pre&amp;gt;digitalWrite(pin, HIGH);       // sets &#039;pin&#039; to high&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example reads a button on a digital input and switches an LED on when the button is pressed: &lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 13;            // LED connected to pin 13&lt;br /&gt;
int pin = 7;                 // Button connected to pin 7&lt;br /&gt;
int value = 0;              // Variable to store the readout value&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(led, OUTPUT);    // defines pin 13 as output&lt;br /&gt;
 pinMode(pin, INPUT);     // sets pin 7 as input&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = digitalRead(pin);    // sets &#039;value&#039; equal to&lt;br /&gt;
 // the input pin&lt;br /&gt;
 digitalWrite(led, value);    // sets &#039;led&#039; equal to the&lt;br /&gt;
}                             // Value of the button&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Analoger Input - Output ==&lt;br /&gt;
=== analogRead(pin) ===&lt;br /&gt;
Reads the value of a specified analog pin with a 10 bit resolution. This function is only available for pins (0-5). The resulting integer values have a spectrum from 0 to 1023. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = analogRead(pin);     // sets &#039;value&#039; equal to &#039;pin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Unlike digital pins, analog pins do not have to be declared as input or output first. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analogWrite(pin, value) ===&lt;br /&gt;
Writes pseudo-analog values to an output pin using hardware-based pulse width modulation (PWM). On newer Arduino boards with the ATmega 168 chip this function is applicable to pins 3, 5, 6, 9, 10 and 11. Older Arduinos with the ATmega8 only support pins 9,10 and 11. The value can be set as a variable or constant in the range 0-255.&lt;br /&gt;
&amp;lt;pre&amp;gt;analogWrite(pin, value);     // writes &#039;value&#039; to the analog &#039;pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A value of 0 generates a uniform voltage of 0 volts at a fixed pin; a value of 255 generates a uniform voltage of 5 volts at a fixed pin. For values between 0 and 255, the pin changes very quickly between 0 and 5 volts - the higher the value, the longer the pin is HIGH (5 volts). For a value of 64, the pin is at 0 volts for three-quarters of the time and at 5 volts for one-quarter of the time. A value of 128 means that the output voltage is HIGH half of the time and LOW the other half. A value of 192 means that the voltage at the pin measures 0 volts at one quarter of the time and the full 5 volts at three quarters of the time. &lt;br /&gt;
&lt;br /&gt;
Because this is a hardware-based function, the constant wave runs independently of the program until the next change of state via analogWrite (or a call to digitalRead or digitalWrite on the same pin). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: In contrast to digital pins, analog pins do not have to be declared as input or output before. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The following example reads an analog value from &#039;pin&#039;, converts the value by dividing it by 4 and then outputs it as a PWM signal to &#039;led&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 10;    // LED with 220 resistor at pin 10&lt;br /&gt;
int pin = 0;         // Potentiometer at analog pin 0&lt;br /&gt;
int value;           // Value for readout&lt;br /&gt;
&lt;br /&gt;
void setup(){}      // no setup required&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = analogRead(pin);      // sets &#039;value&#039; equal to &#039;pin&lt;br /&gt;
 value /= 4; // converts 0-1023 into 0-255&lt;br /&gt;
 analogWrite(led, value);     // outputs the PWM signal &#039;led&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Random functions ==&lt;br /&gt;
=== randomSeed(seed) ===&lt;br /&gt;
Sets a value or &#039;Seed&#039; as starting point for the random() function.&lt;br /&gt;
&amp;lt;pre&amp;gt;randomSeed(value);       // sets &#039;value&#039; as the random seed&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Arduino itself is not able to produce a truly random value. With randomSeed() a variable can be used as &#039;seed&#039; to get better random results. For example, millis() or analogRead() can be used as a seed variable or function to use electrical noise through the analog pin as an output for random values. &lt;br /&gt;
&lt;br /&gt;
=== random(min, max) ===&lt;br /&gt;
The random function allows the generation of pseudo-random values within a defined range of minimum and maxium values. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = random(100, 200);        // sets &#039;value&#039; with a random number&lt;br /&gt;
                                     // between 100 and 200 equal &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example generates a random value between 0 and 255 and outputs it as PWM signal on a PWM pin. &lt;br /&gt;
&amp;lt;pre&amp;gt;int randNumber;     // Variable to store the random value&lt;br /&gt;
int led = 10;           // LED with 220 Ohm resistor at pin 10&lt;br /&gt;
&lt;br /&gt;
void setup() {}         // no setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 randomSeed(millis());              // uses millis() as seed&lt;br /&gt;
 randNumber = random(255);          // Random number in the range 0-255&lt;br /&gt;
 analogWrite(led, randNumber);      // PWM signal as output&lt;br /&gt;
 delay(500);                        // half second pause&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Serial communication ==&lt;br /&gt;
=== Serial.begin(rate) ===&lt;br /&gt;
Serial.begin(rate)&#039; Opens the serial port and sets the baud rate for the serial transmission. The typical baud rate with the computer is 9600 baud. Other speeds are also supported.&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);      // opens serial port&lt;br /&gt;
} // sets the data rate to 9600 bps&amp;lt;/pre&amp;gt; &lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: When using serial communication, digital pins 0 (RX) and 1 (TX) cannot be used at the same time. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Serial.println(data) ===&lt;br /&gt;
Writes data to the serial port, followed by an automatic line break as carrier return and line feed. This function has the same form as &#039;Serial.print()&#039;, but is easier to read on the serial monitor. &lt;br /&gt;
&amp;lt;pre&amp;gt;Serial.println(analogValue);         // sends the value of &#039;analogValue&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More detailed information about the numerous variants of the &#039;Serial.println()&#039; and &#039;Serial.print()&#039; functions can be found on the Arduino website. &lt;br /&gt;
&lt;br /&gt;
The following simple example reads a value from analog pin 0 and sends the data to the computer once per second. &lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);                // sets the data rate to 9600 bps&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 Serial.println(analogRead(0));   // sends the analog value&lt;br /&gt;
 delay(1000);                    // pauses for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Digital output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Output.JPG|thumb|none|300px|Arduino-Example-Digital-Output]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a simple &#039;Hello World&#039; program and turns something on and off. In this example a LED is connected to PIN 13 and flashes every second. The resistor may be superfluous at this pin because the Arduino has a built-in resistor. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;            // LED off digital pin 13&lt;br /&gt;
&lt;br /&gt;
void setup()                     // will run through once&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // sets pin 13 as output&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()                      // Running as endless loop&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);    // switches the LED on&lt;br /&gt;
 delay(1000);                   // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);    // switches the LED off&lt;br /&gt;
 delay(1000);                 // Pause for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Digital input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Input.JPG|thumb|none|300px|Arduino-Example-Digital-Input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the simplest form of an input with only two possible states: on or off.&lt;br /&gt;
This example reads out a simple switch or button at pin 2. When the switch is closed and the input pin is HIGH, the LED is turned on. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;               // Output pin for the LED&lt;br /&gt;
int inPin = 2;                     // Input pin for a switch&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);         // declares LED as output&lt;br /&gt;
 pinMode(inPin, INPUT);           // declares switch as input&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
 if (digitalRead(inPin) == HIGH)   // check if this is the HIGH input&lt;br /&gt;
 {&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches the LED on&lt;br /&gt;
 delay(1000);                  // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);   // switches the LED off&lt;br /&gt;
 delay(1000);                // Pause for 1 second&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analog PWM output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pulse width modulation (PWM) is a method of simulating analog outputs by pulsing the output voltage. This allows you to make an LED brighter or darker or check a servomotor later. The following example uses a loop to slowly make an LED brighter and darker. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 9;            // PWM Pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup(){}                  // No setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for (int i=0; i&amp;lt;=255; i++)     // ascending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);        // sets the brightness value to i&lt;br /&gt;
 delay(100);                    // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 for (int i=255; i&amp;gt;=0; i--)     // descending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);       // sets the brightness value to i&lt;br /&gt;
 delay(100);                   // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== potentiometer Input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With a potentiometer and one of the analog-digital converter (ADC) inputs of the Arduino it is possible to read analog values from 0-1024. The following example uses a potentiometer to control the blinking rate of an LED.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int potPin = 0;              // Input pin for the potentiometer&lt;br /&gt;
int ledPin = 13;                 // Output pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // declare ledPin as OUTPUT&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches on ledPin&lt;br /&gt;
 delay(analogRead(potPin));      // pauses the program by the value of potentiometers&lt;br /&gt;
 digitalWrite(ledPin, LOW);      // switches ledPin off&lt;br /&gt;
 delay(analogRead(potPin));     // pauses the program by the value of potentiometers&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR WAN 1300 LoRa]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR LoRa Gateway Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.elektronik-kompendium.de/sites/com/1810231.htm&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://myhomearchiv.synology.me/download/Anleitung_Furduino.pdf&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/arduino-uno/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/category/projekte/arduino-projekte/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.netzmafia.de/skripten/hardware/Arduino/Arduino_Programmierhandbuch.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4535</id>
		<title>Arduino Board Uno Rev3-Atmega 328: Programming Guide</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4535"/>
		<updated>2020-08-10T20:48:31Z</updated>

		<summary type="html">&lt;p&gt;CCinay: /* Data types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The &amp;lt;b&amp;gt;Arduino IDE&amp;lt;/b&amp;gt; is a cross-platform Java application that acts as a program code editor and compiler and is also able to send firmware serially to the board. The development environment is based on Processing, an IDE designed to program artists, who normally do not have much contact with the art world programming environments. The programming language is based on Wiring, a C similar language which has a similar scope for a more restricted board design, whose IDE is also based on processing. Make sure you have an updated version of &amp;lt;b&amp;gt;[https://www.arduino.cc/en/Main/Software Arduino IDE]&amp;lt;/b&amp;gt; installed.&lt;br /&gt;
&lt;br /&gt;
== Struktur ==&lt;br /&gt;
The basic structure of the Arduino programming language is relatively simple and is divided into at least two parts. These two required parts or functions enclose blocks of statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup() {     // put your setup code here, to run once:&lt;br /&gt;
}&lt;br /&gt;
void loop() {      // put your main code here, to run repeatedly:&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Here &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; is the preparation and &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; is the execution. Both functions are necessary to execute the program. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup function should follow the variable definition, which must be listed before. Setup must be run through as the first function in a program. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; It is executed only once and is used to set &amp;lt;b&amp;gt;PinMode&amp;lt;/b&amp;gt; or to initiate serial communication. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set PinModes or start serial communication. The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; appear in every program, even if it does not contain any instructions.  &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; After the &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function follows the &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; function. It contains program code that is executed continuously in an infinite loop - read inputs, trigger &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; outputs, etc. This function is the core of all Arduino programs and does the main work. &lt;br /&gt;
&lt;br /&gt;
=== setup() ===&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set &amp;lt;b&amp;gt;PinModes&amp;lt;/b&amp;gt; or start serial communication.&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must appear in every program, even if it does not contain any instructions. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(pin, OUTPUT);     // &#039;pin&#039; define as output&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== loop() ===&lt;br /&gt;
After running through the &amp;lt;b&amp;gt;setup() function&amp;lt;/b&amp;gt;, the &amp;lt;b&amp;gt;loop() function&amp;lt;/b&amp;gt; does exactly what its name suggests and runs in an endless loop. This allows the program to interact with the Arduino board via changes, reactions and controls. &lt;br /&gt;
&amp;lt;pre&amp;gt;void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(pin, HIGH);    // switches &#039;pin&#039; on&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
 digitalWrite(pin, LOW);     // switches &#039;pin&#039; off&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
A function is a block of program code that has a name and a set of instructions that are executed when the function is called. The functions &amp;lt;b&amp;gt;void setup()&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;void loop()&amp;lt;/b&amp;gt; have already been explained. There are more built-in functions that will be discussed later. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Type FunctionName(parameter)&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following integer type function &amp;lt;b&amp;gt;delayVal()&amp;lt;/b&amp;gt; is used to insert a delay value into a program by reading a potentiometer. First a local variable &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is created. Next, &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is equated with the position of the potentiometer, which can have a value between &amp;lt;b&amp;gt;0 and 1023&amp;lt;/b&amp;gt;. The value is then &amp;lt;b&amp;gt;divided by 4 to get a scale from 0 to 255&amp;lt;/b&amp;gt; and at the end the result of the function is returned to the main program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int delayVal()&lt;br /&gt;
{&lt;br /&gt;
 int v;                     // create temporary variable &#039;v&lt;br /&gt;
 v = analogRead(pot);       // read potentiometer Value&lt;br /&gt;
 v /= 4;                    // Convert from 0-1023 to 0-255&lt;br /&gt;
 return v;                  // return the calculated value&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== {} curly brackets ===&lt;br /&gt;
Curly brackets (also called &amp;lt;b&amp;gt;&#039;curly brackets&#039;&amp;lt;/b&amp;gt;) define the start and end of function and statement blocks as in the &amp;lt;b&amp;gt;&#039;void loop()&#039;&amp;lt;/b&amp;gt; function and also in the &amp;lt;b&amp;gt;&#039;for&#039; and &#039;if&#039;&amp;lt;/b&amp;gt; statement. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type function()&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: An opening curved bracket &#039;{&#039; must always be followed by a closing curved bracket &#039;}&#039;. Here it is often said that the number of brackets must be balanced. Unbalanced parentheses often lead to cryptic, inscrutable errors in the compiler, which are sometimes hard to find, especially in large programs.&lt;br /&gt;
&lt;br /&gt;
The Arduino programming environment helps to check that the curved brackets are balanced. To do this, simply select a brace or click just behind it, and the logically connected counterpart is highlighted. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ;semicolon ===&lt;br /&gt;
A semicolon must be used at the end of a statement and is used to separate the elements of a program.&lt;br /&gt;
A semicolon is also used to separate the elements of a for loop. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int x = 13; // declares variable &#039;x&#039; as integer with value 13&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Forgetting a semicolon at the end of a line leads to an error in the compiler. The error description can be very clear and directly point to the missing semicolon, but this does not have to be the case. If an inscrutable or apparently illogical error is reported, the first thing to do is to add missing semicolons near the reported error. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== /*... */ block comments ===&lt;br /&gt;
Block comments or multiline comments are text areas that are ignored by the program. They are used for longer descriptions or comments and help other authors to understand program parts. They start with /* and end with */ and can cover several lines. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/* This is an inserted block comment&lt;br /&gt;
 please do not forget the closing comment -&lt;br /&gt;
 These must be balanced&lt;br /&gt;
*/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== // Single line comments ===&lt;br /&gt;
Simple single-line comments are defined with a // at the beginning of the line and end with the end of the line. They are ignored by the program and do not consume memory. &lt;br /&gt;
&amp;lt;pre&amp;gt;// this is a single line comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
A variable is the name of a numeric value with a name and memory location for later use in a program. A variable must be declared and optionally provided with a value. The following example declares a variable &#039;inputVariable&#039; and assigns the value of analog pin 2 to it: &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;          // declares a variable and&lt;br /&gt;
                                     // sets its value to 0&lt;br /&gt;
inputVariable = analogRead(2);      // sets the value of the variable equal&lt;br /&gt;
                                    // with the value of analog pin 2 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;inputVariable&#039; is the variable itself. The first line explains that its data type is &#039;int&#039;, which is the short expression for integer. The second line gives the variable the value of the analog pin 2, making the value of the pin available everywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Variables should always have descriptive names as clearly as possible to make the code easier to read.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Declaration of variables: ===&lt;br /&gt;
All variables must be declared before use. Declaring a variable means defining its type such as int, long, float, etc., giving it a name and optionally an initial value.This only needs to be done once in the program. Afterwards the value can be changed at any time by calculations or various assignments. &lt;br /&gt;
&lt;br /&gt;
The following example declares &#039;inputVariable&#039; as &#039;int&#039;, i.e. integer data type and sets the initial value to 0. This is called a &#039;simple assignment&#039;. &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A variable can be declared at many places in the program. The location of the declaration determines which program parts have access to the variable. &lt;br /&gt;
&lt;br /&gt;
== Data types ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;byte&amp;lt;/b&amp;gt;: Byte stores an &amp;lt;b&amp;gt;8-bit numeric&amp;lt;/b&amp;gt;, integer value without decimal point. The &amp;lt;b&amp;gt;value&amp;lt;/b&amp;gt; can be between &amp;lt;b&amp;gt;0 and 255&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;byte someVariable = 180;        // declares &#039;someVariable&lt;br /&gt;
                                    // as a &#039;byte&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;int&amp;lt;/b&amp;gt;: Integers are the most common data type for storing integer values without decimal point. Its &amp;lt;b&amp;gt;value&amp;lt;/b&amp;gt; is &amp;lt;b&amp;gt;16 bits and ranges from -32,767 to 32,768&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;int someVariable = 1500;       // declares &#039;someVariable&lt;br /&gt;
                                   // as an &#039;integer&#039; data type&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;long&amp;lt;/b&amp;gt;: Data type for long integers with extended size, without decimal point, &amp;lt;b&amp;gt;stored in a 32-bit&amp;lt;/b&amp;gt; value in a spectrum from &amp;lt;b&amp;gt;-2,147,483,648 to 2,147,483,647&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;long someVariable = 90000;    // declares &#039;someVariable&lt;br /&gt;
                                  // as a &#039;long&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;float&amp;lt;/b&amp;gt;: A data type for floating point values or numbers with decimal places. Floating point numbers have a better resolution than integers and are&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; expressed as &amp;lt;b&amp;gt;32-bit values with a spectrum from -3.4028235E+38 to 3.4028235E+38&amp;lt;/b&amp;gt;.&lt;br /&gt;
&amp;lt;pre&amp;gt;float someVariable = 3.14;     // declares &#039;someVariable&#039;&lt;br /&gt;
                                    // as a &#039;float&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Floating point numbers are not precise and may lead to strange results when compared. Also, floating-point calculations are much slower than with integer data types. Calculations with floating-point values should be avoided if possible. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;arrays&amp;lt;/b&amp;gt;: An array is a collection of values that are accessed with an index number.&lt;br /&gt;
Each value in the array can be accessed by retrieving the name of&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; the array and the index number of the value. The index number always starts at 0 for an array.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; An array must be declared and optionally assigned values before it can be used.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[] = {value0, value1, value2...} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the same way it is possible to declare an array first with datatype and size and later to give a value to an index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[5];        // declare datatype &#039;integer&#039; as array with 5 Positions&lt;br /&gt;
myArray[3] = 10;            // gives the 4th index the value 10  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To read the value of an array you can simply assign it to a variable specifying the array and the index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;x = myArray[3];       // x now has the value 10 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arrays are often used for loops, where the counter of the loop is also used as index position for the values in the array. The following example uses an array to make an LED flicker. With a for loop and a counter starting at 0 an index position in the array is read, sent to the LED pin, paused for 200ms and then the same is done with the next index position. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 10; // LED on pin 10&lt;br /&gt;
byte flicker[] = {180, 30, 255, 200, 10, 90, 150, 60};    // array with 8 different values&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);    // Sets the OUTPUT pin&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for(int i=0; i&amp;lt;7; i++)               // loop equals the number&lt;br /&gt;
 { // of the values in the array&lt;br /&gt;
 analogWrite(ledPin, flicker[i]);     // writes the index value to the LED&lt;br /&gt;
 delay(200);                          // 200ms pause&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Digitaler Input - Output ==&lt;br /&gt;
=== pinMode(pin,mode) ===&lt;br /&gt;
Used in &#039;void setup()&#039; to configure a specific pin as either input or output. &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, OUTPUT); // sets &#039;pin&#039; as output &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arduino digital pins are inputs by default, so they don&#039;t need to be specified as inputs with &#039;pinMode()&#039;. Pins configured as inputs have a high impedance state. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: There are also comfortable 20 k &#039;pullup&#039; resistors in the ATmega chip which are accessible via software.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These built-in &#039;pullup&#039; resistors can be accessed in the following way: &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, INPUT);        // sets &#039;pin&#039; as input&lt;br /&gt;
digitalWrite(pin, HIGH);        // switches on the &#039;Pullup&#039; resistor&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pullup resistors are normally used to connect inputs like switches. In the example shown here it is noticeable that the pin is not defined as an output&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; although it is written to. It is only the method to activate the internal &#039;pullup&#039; resistor.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pins configured as output are in a low impedance state and can be loaded with a maximum of 40 mAmpere current from connected elements&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; and circuits. This is enough to make an LED light up (don&#039;t forget the serial resistor), but not enough to drive most relays, solenoids or motors.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Short circuits at the Arduino pins as well as too high current can destroy the output pin or even the whole ATmega chip. For this reason it is a good idea&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; to connect an output pin with external elements in series with a 470 or 1K resistor to&lt;br /&gt;
switch.&lt;br /&gt;
&lt;br /&gt;
=== digitalRead(pin) ===&lt;br /&gt;
digitalRead(pin)&#039; reads the value from a specified digital pin, with the result either HIGH or LOW. The pin can be set either as a variable or constant (0-13). &lt;br /&gt;
&amp;lt;pre&amp;gt;value = digitalRead(Pin);      // sets &#039;value&#039; equal to the input pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
digitalWrite(pin,value)&lt;br /&gt;
Outputs either logic level HIGH or LOW at a specified pin. The pin can be set as a variable or constant (0-13).&lt;br /&gt;
&amp;lt;pre&amp;gt;digitalWrite(pin, HIGH);       // sets &#039;pin&#039; to high&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example reads a button on a digital input and switches an LED on when the button is pressed: &lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 13;            // LED connected to pin 13&lt;br /&gt;
int pin = 7;                 // Button connected to pin 7&lt;br /&gt;
int value = 0;              // Variable to store the readout value&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(led, OUTPUT);    // defines pin 13 as output&lt;br /&gt;
 pinMode(pin, INPUT);     // sets pin 7 as input&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = digitalRead(pin);    // sets &#039;value&#039; equal to&lt;br /&gt;
 // the input pin&lt;br /&gt;
 digitalWrite(led, value);    // sets &#039;led&#039; equal to the&lt;br /&gt;
}                             // Value of the button&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Analoger Input - Output ==&lt;br /&gt;
=== analogRead(pin) ===&lt;br /&gt;
Reads the value of a specified analog pin with a 10 bit resolution. This function is only available for pins (0-5). The resulting integer values have a spectrum from 0 to 1023. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = analogRead(pin);     // sets &#039;value&#039; equal to &#039;pin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Unlike digital pins, analog pins do not have to be declared as input or output first. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analogWrite(pin, value) ===&lt;br /&gt;
Writes pseudo-analog values to an output pin using hardware-based pulse width modulation (PWM). On newer Arduino boards with the ATmega 168 chip this function is applicable to pins 3, 5, 6, 9, 10 and 11. Older Arduinos with the ATmega8 only support pins 9,10 and 11. The value can be set as a variable or constant in the range 0-255.&lt;br /&gt;
&amp;lt;pre&amp;gt;analogWrite(pin, value);     // writes &#039;value&#039; to the analog &#039;pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A value of 0 generates a uniform voltage of 0 volts at a fixed pin; a value of 255 generates a uniform voltage of 5 volts at a fixed pin. For values between 0 and 255, the pin changes very quickly between 0 and 5 volts - the higher the value, the longer the pin is HIGH (5 volts). For a value of 64, the pin is at 0 volts for three-quarters of the time and at 5 volts for one-quarter of the time. A value of 128 means that the output voltage is HIGH half of the time and LOW the other half. A value of 192 means that the voltage at the pin measures 0 volts at one quarter of the time and the full 5 volts at three quarters of the time. &lt;br /&gt;
&lt;br /&gt;
Because this is a hardware-based function, the constant wave runs independently of the program until the next change of state via analogWrite (or a call to digitalRead or digitalWrite on the same pin). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: In contrast to digital pins, analog pins do not have to be declared as input or output before. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The following example reads an analog value from &#039;pin&#039;, converts the value by dividing it by 4 and then outputs it as a PWM signal to &#039;led&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 10;    // LED with 220 resistor at pin 10&lt;br /&gt;
int pin = 0;         // Potentiometer at analog pin 0&lt;br /&gt;
int value;           // Value for readout&lt;br /&gt;
&lt;br /&gt;
void setup(){}      // no setup required&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = analogRead(pin);      // sets &#039;value&#039; equal to &#039;pin&lt;br /&gt;
 value /= 4; // converts 0-1023 into 0-255&lt;br /&gt;
 analogWrite(led, value);     // outputs the PWM signal &#039;led&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Random functions ==&lt;br /&gt;
=== randomSeed(seed) ===&lt;br /&gt;
Sets a value or &#039;Seed&#039; as starting point for the random() function.&lt;br /&gt;
&amp;lt;pre&amp;gt;randomSeed(value);       // sets &#039;value&#039; as the random seed&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Arduino itself is not able to produce a truly random value. With randomSeed() a variable can be used as &#039;seed&#039; to get better random results. For example, millis() or analogRead() can be used as a seed variable or function to use electrical noise through the analog pin as an output for random values. &lt;br /&gt;
&lt;br /&gt;
=== random(min, max) ===&lt;br /&gt;
The random function allows the generation of pseudo-random values within a defined range of minimum and maxium values. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = random(100, 200);        // sets &#039;value&#039; with a random number&lt;br /&gt;
                                     // between 100 and 200 equal &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example generates a random value between 0 and 255 and outputs it as PWM signal on a PWM pin. &lt;br /&gt;
&amp;lt;pre&amp;gt;int randNumber;     // Variable to store the random value&lt;br /&gt;
int led = 10;           // LED with 220 Ohm resistor at pin 10&lt;br /&gt;
&lt;br /&gt;
void setup() {}         // no setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 randomSeed(millis());              // uses millis() as seed&lt;br /&gt;
 randNumber = random(255);          // Random number in the range 0-255&lt;br /&gt;
 analogWrite(led, randNumber);      // PWM signal as output&lt;br /&gt;
 delay(500);                        // half second pause&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Serial communication ==&lt;br /&gt;
=== Serial.begin(rate) ===&lt;br /&gt;
Serial.begin(rate)&#039; Opens the serial port and sets the baud rate for the serial transmission. The typical baud rate with the computer is 9600 baud. Other speeds are also supported.&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);      // opens serial port&lt;br /&gt;
} // sets the data rate to 9600 bps&amp;lt;/pre&amp;gt; &lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: When using serial communication, digital pins 0 (RX) and 1 (TX) cannot be used at the same time. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Serial.println(data) ===&lt;br /&gt;
Writes data to the serial port, followed by an automatic line break as carrier return and line feed. This function has the same form as &#039;Serial.print()&#039;, but is easier to read on the serial monitor. &lt;br /&gt;
&amp;lt;pre&amp;gt;Serial.println(analogValue);         // sends the value of &#039;analogValue&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More detailed information about the numerous variants of the &#039;Serial.println()&#039; and &#039;Serial.print()&#039; functions can be found on the Arduino website. &lt;br /&gt;
&lt;br /&gt;
The following simple example reads a value from analog pin 0 and sends the data to the computer once per second. &lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);                // sets the data rate to 9600 bps&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 Serial.println(analogRead(0));   // sends the analog value&lt;br /&gt;
 delay(1000);                    // pauses for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Digital output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Output.JPG|thumb|none|300px|Arduino-Example-Digital-Output]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a simple &#039;Hello World&#039; program and turns something on and off. In this example a LED is connected to PIN 13 and flashes every second. The resistor may be superfluous at this pin because the Arduino has a built-in resistor. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;            // LED off digital pin 13&lt;br /&gt;
&lt;br /&gt;
void setup()                     // will run through once&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // sets pin 13 as output&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()                      // Running as endless loop&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);    // switches the LED on&lt;br /&gt;
 delay(1000);                   // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);    // switches the LED off&lt;br /&gt;
 delay(1000);                 // Pause for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Digital input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Input.JPG|thumb|none|300px|Arduino-Example-Digital-Input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the simplest form of an input with only two possible states: on or off.&lt;br /&gt;
This example reads out a simple switch or button at pin 2. When the switch is closed and the input pin is HIGH, the LED is turned on. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;               // Output pin for the LED&lt;br /&gt;
int inPin = 2;                     // Input pin for a switch&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);         // declares LED as output&lt;br /&gt;
 pinMode(inPin, INPUT);           // declares switch as input&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
 if (digitalRead(inPin) == HIGH)   // check if this is the HIGH input&lt;br /&gt;
 {&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches the LED on&lt;br /&gt;
 delay(1000);                  // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);   // switches the LED off&lt;br /&gt;
 delay(1000);                // Pause for 1 second&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analog PWM output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pulse width modulation (PWM) is a method of simulating analog outputs by pulsing the output voltage. This allows you to make an LED brighter or darker or check a servomotor later. The following example uses a loop to slowly make an LED brighter and darker. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 9;            // PWM Pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup(){}                  // No setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for (int i=0; i&amp;lt;=255; i++)     // ascending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);        // sets the brightness value to i&lt;br /&gt;
 delay(100);                    // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 for (int i=255; i&amp;gt;=0; i--)     // descending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);       // sets the brightness value to i&lt;br /&gt;
 delay(100);                   // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== potentiometer Input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With a potentiometer and one of the analog-digital converter (ADC) inputs of the Arduino it is possible to read analog values from 0-1024. The following example uses a potentiometer to control the blinking rate of an LED.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int potPin = 0;              // Input pin for the potentiometer&lt;br /&gt;
int ledPin = 13;                 // Output pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // declare ledPin as OUTPUT&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches on ledPin&lt;br /&gt;
 delay(analogRead(potPin));      // pauses the program by the value of potentiometers&lt;br /&gt;
 digitalWrite(ledPin, LOW);      // switches ledPin off&lt;br /&gt;
 delay(analogRead(potPin));     // pauses the program by the value of potentiometers&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR WAN 1300 LoRa]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR LoRa Gateway Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.elektronik-kompendium.de/sites/com/1810231.htm&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://myhomearchiv.synology.me/download/Anleitung_Furduino.pdf&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/arduino-uno/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/category/projekte/arduino-projekte/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.netzmafia.de/skripten/hardware/Arduino/Arduino_Programmierhandbuch.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4534</id>
		<title>Arduino Board Uno Rev3-Atmega 328: Programming Guide</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4534"/>
		<updated>2020-08-10T20:45:03Z</updated>

		<summary type="html">&lt;p&gt;CCinay: /* {} curly brackets */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The &amp;lt;b&amp;gt;Arduino IDE&amp;lt;/b&amp;gt; is a cross-platform Java application that acts as a program code editor and compiler and is also able to send firmware serially to the board. The development environment is based on Processing, an IDE designed to program artists, who normally do not have much contact with the art world programming environments. The programming language is based on Wiring, a C similar language which has a similar scope for a more restricted board design, whose IDE is also based on processing. Make sure you have an updated version of &amp;lt;b&amp;gt;[https://www.arduino.cc/en/Main/Software Arduino IDE]&amp;lt;/b&amp;gt; installed.&lt;br /&gt;
&lt;br /&gt;
== Struktur ==&lt;br /&gt;
The basic structure of the Arduino programming language is relatively simple and is divided into at least two parts. These two required parts or functions enclose blocks of statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup() {     // put your setup code here, to run once:&lt;br /&gt;
}&lt;br /&gt;
void loop() {      // put your main code here, to run repeatedly:&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Here &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; is the preparation and &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; is the execution. Both functions are necessary to execute the program. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup function should follow the variable definition, which must be listed before. Setup must be run through as the first function in a program. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; It is executed only once and is used to set &amp;lt;b&amp;gt;PinMode&amp;lt;/b&amp;gt; or to initiate serial communication. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set PinModes or start serial communication. The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; appear in every program, even if it does not contain any instructions.  &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; After the &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function follows the &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; function. It contains program code that is executed continuously in an infinite loop - read inputs, trigger &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; outputs, etc. This function is the core of all Arduino programs and does the main work. &lt;br /&gt;
&lt;br /&gt;
=== setup() ===&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set &amp;lt;b&amp;gt;PinModes&amp;lt;/b&amp;gt; or start serial communication.&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must appear in every program, even if it does not contain any instructions. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(pin, OUTPUT);     // &#039;pin&#039; define as output&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== loop() ===&lt;br /&gt;
After running through the &amp;lt;b&amp;gt;setup() function&amp;lt;/b&amp;gt;, the &amp;lt;b&amp;gt;loop() function&amp;lt;/b&amp;gt; does exactly what its name suggests and runs in an endless loop. This allows the program to interact with the Arduino board via changes, reactions and controls. &lt;br /&gt;
&amp;lt;pre&amp;gt;void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(pin, HIGH);    // switches &#039;pin&#039; on&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
 digitalWrite(pin, LOW);     // switches &#039;pin&#039; off&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
A function is a block of program code that has a name and a set of instructions that are executed when the function is called. The functions &amp;lt;b&amp;gt;void setup()&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;void loop()&amp;lt;/b&amp;gt; have already been explained. There are more built-in functions that will be discussed later. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Type FunctionName(parameter)&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following integer type function &amp;lt;b&amp;gt;delayVal()&amp;lt;/b&amp;gt; is used to insert a delay value into a program by reading a potentiometer. First a local variable &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is created. Next, &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is equated with the position of the potentiometer, which can have a value between &amp;lt;b&amp;gt;0 and 1023&amp;lt;/b&amp;gt;. The value is then &amp;lt;b&amp;gt;divided by 4 to get a scale from 0 to 255&amp;lt;/b&amp;gt; and at the end the result of the function is returned to the main program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int delayVal()&lt;br /&gt;
{&lt;br /&gt;
 int v;                     // create temporary variable &#039;v&lt;br /&gt;
 v = analogRead(pot);       // read potentiometer Value&lt;br /&gt;
 v /= 4;                    // Convert from 0-1023 to 0-255&lt;br /&gt;
 return v;                  // return the calculated value&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== {} curly brackets ===&lt;br /&gt;
Curly brackets (also called &amp;lt;b&amp;gt;&#039;curly brackets&#039;&amp;lt;/b&amp;gt;) define the start and end of function and statement blocks as in the &amp;lt;b&amp;gt;&#039;void loop()&#039;&amp;lt;/b&amp;gt; function and also in the &amp;lt;b&amp;gt;&#039;for&#039; and &#039;if&#039;&amp;lt;/b&amp;gt; statement. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type function()&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: An opening curved bracket &#039;{&#039; must always be followed by a closing curved bracket &#039;}&#039;. Here it is often said that the number of brackets must be balanced. Unbalanced parentheses often lead to cryptic, inscrutable errors in the compiler, which are sometimes hard to find, especially in large programs.&lt;br /&gt;
&lt;br /&gt;
The Arduino programming environment helps to check that the curved brackets are balanced. To do this, simply select a brace or click just behind it, and the logically connected counterpart is highlighted. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ;semicolon ===&lt;br /&gt;
A semicolon must be used at the end of a statement and is used to separate the elements of a program.&lt;br /&gt;
A semicolon is also used to separate the elements of a for loop. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int x = 13; // declares variable &#039;x&#039; as integer with value 13&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Forgetting a semicolon at the end of a line leads to an error in the compiler. The error description can be very clear and directly point to the missing semicolon, but this does not have to be the case. If an inscrutable or apparently illogical error is reported, the first thing to do is to add missing semicolons near the reported error. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== /*... */ block comments ===&lt;br /&gt;
Block comments or multiline comments are text areas that are ignored by the program. They are used for longer descriptions or comments and help other authors to understand program parts. They start with /* and end with */ and can cover several lines. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/* This is an inserted block comment&lt;br /&gt;
 please do not forget the closing comment -&lt;br /&gt;
 These must be balanced&lt;br /&gt;
*/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== // Single line comments ===&lt;br /&gt;
Simple single-line comments are defined with a // at the beginning of the line and end with the end of the line. They are ignored by the program and do not consume memory. &lt;br /&gt;
&amp;lt;pre&amp;gt;// this is a single line comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
A variable is the name of a numeric value with a name and memory location for later use in a program. A variable must be declared and optionally provided with a value. The following example declares a variable &#039;inputVariable&#039; and assigns the value of analog pin 2 to it: &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;          // declares a variable and&lt;br /&gt;
                                     // sets its value to 0&lt;br /&gt;
inputVariable = analogRead(2);      // sets the value of the variable equal&lt;br /&gt;
                                    // with the value of analog pin 2 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;inputVariable&#039; is the variable itself. The first line explains that its data type is &#039;int&#039;, which is the short expression for integer. The second line gives the variable the value of the analog pin 2, making the value of the pin available everywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Variables should always have descriptive names as clearly as possible to make the code easier to read.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Declaration of variables: ===&lt;br /&gt;
All variables must be declared before use. Declaring a variable means defining its type such as int, long, float, etc., giving it a name and optionally an initial value.This only needs to be done once in the program. Afterwards the value can be changed at any time by calculations or various assignments. &lt;br /&gt;
&lt;br /&gt;
The following example declares &#039;inputVariable&#039; as &#039;int&#039;, i.e. integer data type and sets the initial value to 0. This is called a &#039;simple assignment&#039;. &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A variable can be declared at many places in the program. The location of the declaration determines which program parts have access to the variable. &lt;br /&gt;
&lt;br /&gt;
== Data types ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;byte&amp;lt;/b&amp;gt;: Byte stores an 8-bit numeric, integer value without decimal point. The value can be between 0 and 255.&lt;br /&gt;
&amp;lt;pre&amp;gt;byte someVariable = 180;        // declares &#039;someVariable&lt;br /&gt;
                                    // as a &#039;byte&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;int&amp;lt;/b&amp;gt;: Integers are the most common data type for storing integer values without decimal point. Its value is 16 bits and ranges from -32,767 to 32,768.&lt;br /&gt;
&amp;lt;pre&amp;gt;int someVariable = 1500;       // declares &#039;someVariable&lt;br /&gt;
                                   // as an &#039;integer&#039; data type&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;long&amp;lt;/b&amp;gt;: Data type for long integers with extended size, without decimal point, stored in a 32-bit value in a spectrum from -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
&amp;lt;pre&amp;gt;long someVariable = 90000;    // declares &#039;someVariable&lt;br /&gt;
                                  // as a &#039;long&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;float&amp;lt;/b&amp;gt;: A data type for floating point values or numbers with decimal places. Floating point numbers have a better resolution than integers and are&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; expressed as 32-bit values with a spectrum from -3.4028235E+38 to 3.4028235E+38.&lt;br /&gt;
&amp;lt;pre&amp;gt;float someVariable = 3.14;     // declares &#039;someVariable&#039;&lt;br /&gt;
                                    // as a &#039;float&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Floating point numbers are not precise and may lead to strange results when compared. Also, floating-point calculations are much slower than with integer data types. Calculations with floating-point values should be avoided if possible. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;arrays&amp;lt;/b&amp;gt;: An array is a collection of values that are accessed with an index number.&lt;br /&gt;
Each value in the array can be accessed by retrieving the name of&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; the array and the index number of the value. The index number always starts at 0 for an array.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; An array must be declared and optionally assigned values before it can be used.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[] = {value0, value1, value2...} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the same way it is possible to declare an array first with datatype and size and later to give a value to an index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[5];        // declare datatype &#039;integer&#039; as array with 5 Positions&lt;br /&gt;
myArray[3] = 10;            // gives the 4th index the value 10  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To read the value of an array you can simply assign it to a variable specifying the array and the index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;x = myArray[3];       // x now has the value 10 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arrays are often used for loops, where the counter of the loop is also used as index position for the values in the array. The following example uses an array to make an LED flicker. With a for loop and a counter starting at 0 an index position in the array is read, sent to the LED pin, paused for 200ms and then the same is done with the next index position. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 10; // LED on pin 10&lt;br /&gt;
byte flicker[] = {180, 30, 255, 200, 10, 90, 150, 60};    // array with 8 different values&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);    // Sets the OUTPUT pin&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for(int i=0; i&amp;lt;7; i++)               // loop equals the number&lt;br /&gt;
 { // of the values in the array&lt;br /&gt;
 analogWrite(ledPin, flicker[i]);     // writes the index value to the LED&lt;br /&gt;
 delay(200);                          // 200ms pause&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Digitaler Input - Output ==&lt;br /&gt;
=== pinMode(pin,mode) ===&lt;br /&gt;
Used in &#039;void setup()&#039; to configure a specific pin as either input or output. &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, OUTPUT); // sets &#039;pin&#039; as output &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arduino digital pins are inputs by default, so they don&#039;t need to be specified as inputs with &#039;pinMode()&#039;. Pins configured as inputs have a high impedance state. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: There are also comfortable 20 k &#039;pullup&#039; resistors in the ATmega chip which are accessible via software.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These built-in &#039;pullup&#039; resistors can be accessed in the following way: &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, INPUT);        // sets &#039;pin&#039; as input&lt;br /&gt;
digitalWrite(pin, HIGH);        // switches on the &#039;Pullup&#039; resistor&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pullup resistors are normally used to connect inputs like switches. In the example shown here it is noticeable that the pin is not defined as an output&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; although it is written to. It is only the method to activate the internal &#039;pullup&#039; resistor.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pins configured as output are in a low impedance state and can be loaded with a maximum of 40 mAmpere current from connected elements&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; and circuits. This is enough to make an LED light up (don&#039;t forget the serial resistor), but not enough to drive most relays, solenoids or motors.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Short circuits at the Arduino pins as well as too high current can destroy the output pin or even the whole ATmega chip. For this reason it is a good idea&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; to connect an output pin with external elements in series with a 470 or 1K resistor to&lt;br /&gt;
switch.&lt;br /&gt;
&lt;br /&gt;
=== digitalRead(pin) ===&lt;br /&gt;
digitalRead(pin)&#039; reads the value from a specified digital pin, with the result either HIGH or LOW. The pin can be set either as a variable or constant (0-13). &lt;br /&gt;
&amp;lt;pre&amp;gt;value = digitalRead(Pin);      // sets &#039;value&#039; equal to the input pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
digitalWrite(pin,value)&lt;br /&gt;
Outputs either logic level HIGH or LOW at a specified pin. The pin can be set as a variable or constant (0-13).&lt;br /&gt;
&amp;lt;pre&amp;gt;digitalWrite(pin, HIGH);       // sets &#039;pin&#039; to high&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example reads a button on a digital input and switches an LED on when the button is pressed: &lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 13;            // LED connected to pin 13&lt;br /&gt;
int pin = 7;                 // Button connected to pin 7&lt;br /&gt;
int value = 0;              // Variable to store the readout value&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(led, OUTPUT);    // defines pin 13 as output&lt;br /&gt;
 pinMode(pin, INPUT);     // sets pin 7 as input&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = digitalRead(pin);    // sets &#039;value&#039; equal to&lt;br /&gt;
 // the input pin&lt;br /&gt;
 digitalWrite(led, value);    // sets &#039;led&#039; equal to the&lt;br /&gt;
}                             // Value of the button&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Analoger Input - Output ==&lt;br /&gt;
=== analogRead(pin) ===&lt;br /&gt;
Reads the value of a specified analog pin with a 10 bit resolution. This function is only available for pins (0-5). The resulting integer values have a spectrum from 0 to 1023. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = analogRead(pin);     // sets &#039;value&#039; equal to &#039;pin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Unlike digital pins, analog pins do not have to be declared as input or output first. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analogWrite(pin, value) ===&lt;br /&gt;
Writes pseudo-analog values to an output pin using hardware-based pulse width modulation (PWM). On newer Arduino boards with the ATmega 168 chip this function is applicable to pins 3, 5, 6, 9, 10 and 11. Older Arduinos with the ATmega8 only support pins 9,10 and 11. The value can be set as a variable or constant in the range 0-255.&lt;br /&gt;
&amp;lt;pre&amp;gt;analogWrite(pin, value);     // writes &#039;value&#039; to the analog &#039;pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A value of 0 generates a uniform voltage of 0 volts at a fixed pin; a value of 255 generates a uniform voltage of 5 volts at a fixed pin. For values between 0 and 255, the pin changes very quickly between 0 and 5 volts - the higher the value, the longer the pin is HIGH (5 volts). For a value of 64, the pin is at 0 volts for three-quarters of the time and at 5 volts for one-quarter of the time. A value of 128 means that the output voltage is HIGH half of the time and LOW the other half. A value of 192 means that the voltage at the pin measures 0 volts at one quarter of the time and the full 5 volts at three quarters of the time. &lt;br /&gt;
&lt;br /&gt;
Because this is a hardware-based function, the constant wave runs independently of the program until the next change of state via analogWrite (or a call to digitalRead or digitalWrite on the same pin). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: In contrast to digital pins, analog pins do not have to be declared as input or output before. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The following example reads an analog value from &#039;pin&#039;, converts the value by dividing it by 4 and then outputs it as a PWM signal to &#039;led&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 10;    // LED with 220 resistor at pin 10&lt;br /&gt;
int pin = 0;         // Potentiometer at analog pin 0&lt;br /&gt;
int value;           // Value for readout&lt;br /&gt;
&lt;br /&gt;
void setup(){}      // no setup required&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = analogRead(pin);      // sets &#039;value&#039; equal to &#039;pin&lt;br /&gt;
 value /= 4; // converts 0-1023 into 0-255&lt;br /&gt;
 analogWrite(led, value);     // outputs the PWM signal &#039;led&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Random functions ==&lt;br /&gt;
=== randomSeed(seed) ===&lt;br /&gt;
Sets a value or &#039;Seed&#039; as starting point for the random() function.&lt;br /&gt;
&amp;lt;pre&amp;gt;randomSeed(value);       // sets &#039;value&#039; as the random seed&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Arduino itself is not able to produce a truly random value. With randomSeed() a variable can be used as &#039;seed&#039; to get better random results. For example, millis() or analogRead() can be used as a seed variable or function to use electrical noise through the analog pin as an output for random values. &lt;br /&gt;
&lt;br /&gt;
=== random(min, max) ===&lt;br /&gt;
The random function allows the generation of pseudo-random values within a defined range of minimum and maxium values. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = random(100, 200);        // sets &#039;value&#039; with a random number&lt;br /&gt;
                                     // between 100 and 200 equal &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example generates a random value between 0 and 255 and outputs it as PWM signal on a PWM pin. &lt;br /&gt;
&amp;lt;pre&amp;gt;int randNumber;     // Variable to store the random value&lt;br /&gt;
int led = 10;           // LED with 220 Ohm resistor at pin 10&lt;br /&gt;
&lt;br /&gt;
void setup() {}         // no setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 randomSeed(millis());              // uses millis() as seed&lt;br /&gt;
 randNumber = random(255);          // Random number in the range 0-255&lt;br /&gt;
 analogWrite(led, randNumber);      // PWM signal as output&lt;br /&gt;
 delay(500);                        // half second pause&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Serial communication ==&lt;br /&gt;
=== Serial.begin(rate) ===&lt;br /&gt;
Serial.begin(rate)&#039; Opens the serial port and sets the baud rate for the serial transmission. The typical baud rate with the computer is 9600 baud. Other speeds are also supported.&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);      // opens serial port&lt;br /&gt;
} // sets the data rate to 9600 bps&amp;lt;/pre&amp;gt; &lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: When using serial communication, digital pins 0 (RX) and 1 (TX) cannot be used at the same time. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Serial.println(data) ===&lt;br /&gt;
Writes data to the serial port, followed by an automatic line break as carrier return and line feed. This function has the same form as &#039;Serial.print()&#039;, but is easier to read on the serial monitor. &lt;br /&gt;
&amp;lt;pre&amp;gt;Serial.println(analogValue);         // sends the value of &#039;analogValue&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More detailed information about the numerous variants of the &#039;Serial.println()&#039; and &#039;Serial.print()&#039; functions can be found on the Arduino website. &lt;br /&gt;
&lt;br /&gt;
The following simple example reads a value from analog pin 0 and sends the data to the computer once per second. &lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);                // sets the data rate to 9600 bps&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 Serial.println(analogRead(0));   // sends the analog value&lt;br /&gt;
 delay(1000);                    // pauses for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Digital output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Output.JPG|thumb|none|300px|Arduino-Example-Digital-Output]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a simple &#039;Hello World&#039; program and turns something on and off. In this example a LED is connected to PIN 13 and flashes every second. The resistor may be superfluous at this pin because the Arduino has a built-in resistor. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;            // LED off digital pin 13&lt;br /&gt;
&lt;br /&gt;
void setup()                     // will run through once&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // sets pin 13 as output&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()                      // Running as endless loop&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);    // switches the LED on&lt;br /&gt;
 delay(1000);                   // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);    // switches the LED off&lt;br /&gt;
 delay(1000);                 // Pause for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Digital input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Input.JPG|thumb|none|300px|Arduino-Example-Digital-Input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the simplest form of an input with only two possible states: on or off.&lt;br /&gt;
This example reads out a simple switch or button at pin 2. When the switch is closed and the input pin is HIGH, the LED is turned on. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;               // Output pin for the LED&lt;br /&gt;
int inPin = 2;                     // Input pin for a switch&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);         // declares LED as output&lt;br /&gt;
 pinMode(inPin, INPUT);           // declares switch as input&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
 if (digitalRead(inPin) == HIGH)   // check if this is the HIGH input&lt;br /&gt;
 {&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches the LED on&lt;br /&gt;
 delay(1000);                  // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);   // switches the LED off&lt;br /&gt;
 delay(1000);                // Pause for 1 second&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analog PWM output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pulse width modulation (PWM) is a method of simulating analog outputs by pulsing the output voltage. This allows you to make an LED brighter or darker or check a servomotor later. The following example uses a loop to slowly make an LED brighter and darker. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 9;            // PWM Pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup(){}                  // No setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for (int i=0; i&amp;lt;=255; i++)     // ascending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);        // sets the brightness value to i&lt;br /&gt;
 delay(100);                    // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 for (int i=255; i&amp;gt;=0; i--)     // descending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);       // sets the brightness value to i&lt;br /&gt;
 delay(100);                   // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== potentiometer Input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With a potentiometer and one of the analog-digital converter (ADC) inputs of the Arduino it is possible to read analog values from 0-1024. The following example uses a potentiometer to control the blinking rate of an LED.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int potPin = 0;              // Input pin for the potentiometer&lt;br /&gt;
int ledPin = 13;                 // Output pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // declare ledPin as OUTPUT&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches on ledPin&lt;br /&gt;
 delay(analogRead(potPin));      // pauses the program by the value of potentiometers&lt;br /&gt;
 digitalWrite(ledPin, LOW);      // switches ledPin off&lt;br /&gt;
 delay(analogRead(potPin));     // pauses the program by the value of potentiometers&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR WAN 1300 LoRa]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR LoRa Gateway Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.elektronik-kompendium.de/sites/com/1810231.htm&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://myhomearchiv.synology.me/download/Anleitung_Furduino.pdf&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/arduino-uno/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/category/projekte/arduino-projekte/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.netzmafia.de/skripten/hardware/Arduino/Arduino_Programmierhandbuch.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4533</id>
		<title>Arduino Board Uno Rev3-Atmega 328: Programming Guide</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4533"/>
		<updated>2020-08-10T20:44:07Z</updated>

		<summary type="html">&lt;p&gt;CCinay: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The &amp;lt;b&amp;gt;Arduino IDE&amp;lt;/b&amp;gt; is a cross-platform Java application that acts as a program code editor and compiler and is also able to send firmware serially to the board. The development environment is based on Processing, an IDE designed to program artists, who normally do not have much contact with the art world programming environments. The programming language is based on Wiring, a C similar language which has a similar scope for a more restricted board design, whose IDE is also based on processing. Make sure you have an updated version of &amp;lt;b&amp;gt;[https://www.arduino.cc/en/Main/Software Arduino IDE]&amp;lt;/b&amp;gt; installed.&lt;br /&gt;
&lt;br /&gt;
== Struktur ==&lt;br /&gt;
The basic structure of the Arduino programming language is relatively simple and is divided into at least two parts. These two required parts or functions enclose blocks of statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup() {     // put your setup code here, to run once:&lt;br /&gt;
}&lt;br /&gt;
void loop() {      // put your main code here, to run repeatedly:&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Here &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; is the preparation and &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; is the execution. Both functions are necessary to execute the program. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup function should follow the variable definition, which must be listed before. Setup must be run through as the first function in a program. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; It is executed only once and is used to set &amp;lt;b&amp;gt;PinMode&amp;lt;/b&amp;gt; or to initiate serial communication. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set PinModes or start serial communication. The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; appear in every program, even if it does not contain any instructions.  &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; After the &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function follows the &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; function. It contains program code that is executed continuously in an infinite loop - read inputs, trigger &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; outputs, etc. This function is the core of all Arduino programs and does the main work. &lt;br /&gt;
&lt;br /&gt;
=== setup() ===&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set &amp;lt;b&amp;gt;PinModes&amp;lt;/b&amp;gt; or start serial communication.&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must appear in every program, even if it does not contain any instructions. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(pin, OUTPUT);     // &#039;pin&#039; define as output&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== loop() ===&lt;br /&gt;
After running through the &amp;lt;b&amp;gt;setup() function&amp;lt;/b&amp;gt;, the &amp;lt;b&amp;gt;loop() function&amp;lt;/b&amp;gt; does exactly what its name suggests and runs in an endless loop. This allows the program to interact with the Arduino board via changes, reactions and controls. &lt;br /&gt;
&amp;lt;pre&amp;gt;void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(pin, HIGH);    // switches &#039;pin&#039; on&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
 digitalWrite(pin, LOW);     // switches &#039;pin&#039; off&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
A function is a block of program code that has a name and a set of instructions that are executed when the function is called. The functions &amp;lt;b&amp;gt;void setup()&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;void loop()&amp;lt;/b&amp;gt; have already been explained. There are more built-in functions that will be discussed later. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Type FunctionName(parameter)&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following integer type function &amp;lt;b&amp;gt;delayVal()&amp;lt;/b&amp;gt; is used to insert a delay value into a program by reading a potentiometer. First a local variable &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is created. Next, &amp;lt;b&amp;gt;&#039;v&#039;&amp;lt;/b&amp;gt; is equated with the position of the potentiometer, which can have a value between &amp;lt;b&amp;gt;0 and 1023&amp;lt;/b&amp;gt;. The value is then &amp;lt;b&amp;gt;divided by 4 to get a scale from 0 to 255&amp;lt;/b&amp;gt; and at the end the result of the function is returned to the main program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int delayVal()&lt;br /&gt;
{&lt;br /&gt;
 int v;                     // create temporary variable &#039;v&lt;br /&gt;
 v = analogRead(pot);       // read potentiometer Value&lt;br /&gt;
 v /= 4;                    // Convert from 0-1023 to 0-255&lt;br /&gt;
 return v;                  // return the calculated value&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== {} curly brackets ===&lt;br /&gt;
Curly brackets (also called &#039;curly brackets&#039;) define the start and end of function and statement blocks as in the &#039;void loop()&#039; function and also in the &#039;for&#039; and &#039;if&#039; statement. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type function()&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: An opening curved bracket &#039;{&#039; must always be followed by a closing curved bracket &#039;}&#039;. Here it is often said that the number of brackets must be balanced. Unbalanced parentheses often lead to cryptic, inscrutable errors in the compiler, which are sometimes hard to find, especially in large programs.&lt;br /&gt;
&lt;br /&gt;
The Arduino programming environment helps to check that the curved brackets are balanced. To do this, simply select a brace or click just behind it, and the logically connected counterpart is highlighted. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ;semicolon ===&lt;br /&gt;
A semicolon must be used at the end of a statement and is used to separate the elements of a program.&lt;br /&gt;
A semicolon is also used to separate the elements of a for loop. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int x = 13; // declares variable &#039;x&#039; as integer with value 13&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Forgetting a semicolon at the end of a line leads to an error in the compiler. The error description can be very clear and directly point to the missing semicolon, but this does not have to be the case. If an inscrutable or apparently illogical error is reported, the first thing to do is to add missing semicolons near the reported error. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== /*... */ block comments ===&lt;br /&gt;
Block comments or multiline comments are text areas that are ignored by the program. They are used for longer descriptions or comments and help other authors to understand program parts. They start with /* and end with */ and can cover several lines. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/* This is an inserted block comment&lt;br /&gt;
 please do not forget the closing comment -&lt;br /&gt;
 These must be balanced&lt;br /&gt;
*/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== // Single line comments ===&lt;br /&gt;
Simple single-line comments are defined with a // at the beginning of the line and end with the end of the line. They are ignored by the program and do not consume memory. &lt;br /&gt;
&amp;lt;pre&amp;gt;// this is a single line comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
A variable is the name of a numeric value with a name and memory location for later use in a program. A variable must be declared and optionally provided with a value. The following example declares a variable &#039;inputVariable&#039; and assigns the value of analog pin 2 to it: &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;          // declares a variable and&lt;br /&gt;
                                     // sets its value to 0&lt;br /&gt;
inputVariable = analogRead(2);      // sets the value of the variable equal&lt;br /&gt;
                                    // with the value of analog pin 2 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;inputVariable&#039; is the variable itself. The first line explains that its data type is &#039;int&#039;, which is the short expression for integer. The second line gives the variable the value of the analog pin 2, making the value of the pin available everywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Variables should always have descriptive names as clearly as possible to make the code easier to read.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Declaration of variables: ===&lt;br /&gt;
All variables must be declared before use. Declaring a variable means defining its type such as int, long, float, etc., giving it a name and optionally an initial value.This only needs to be done once in the program. Afterwards the value can be changed at any time by calculations or various assignments. &lt;br /&gt;
&lt;br /&gt;
The following example declares &#039;inputVariable&#039; as &#039;int&#039;, i.e. integer data type and sets the initial value to 0. This is called a &#039;simple assignment&#039;. &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A variable can be declared at many places in the program. The location of the declaration determines which program parts have access to the variable. &lt;br /&gt;
&lt;br /&gt;
== Data types ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;byte&amp;lt;/b&amp;gt;: Byte stores an 8-bit numeric, integer value without decimal point. The value can be between 0 and 255.&lt;br /&gt;
&amp;lt;pre&amp;gt;byte someVariable = 180;        // declares &#039;someVariable&lt;br /&gt;
                                    // as a &#039;byte&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;int&amp;lt;/b&amp;gt;: Integers are the most common data type for storing integer values without decimal point. Its value is 16 bits and ranges from -32,767 to 32,768.&lt;br /&gt;
&amp;lt;pre&amp;gt;int someVariable = 1500;       // declares &#039;someVariable&lt;br /&gt;
                                   // as an &#039;integer&#039; data type&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;long&amp;lt;/b&amp;gt;: Data type for long integers with extended size, without decimal point, stored in a 32-bit value in a spectrum from -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
&amp;lt;pre&amp;gt;long someVariable = 90000;    // declares &#039;someVariable&lt;br /&gt;
                                  // as a &#039;long&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;float&amp;lt;/b&amp;gt;: A data type for floating point values or numbers with decimal places. Floating point numbers have a better resolution than integers and are&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; expressed as 32-bit values with a spectrum from -3.4028235E+38 to 3.4028235E+38.&lt;br /&gt;
&amp;lt;pre&amp;gt;float someVariable = 3.14;     // declares &#039;someVariable&#039;&lt;br /&gt;
                                    // as a &#039;float&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Floating point numbers are not precise and may lead to strange results when compared. Also, floating-point calculations are much slower than with integer data types. Calculations with floating-point values should be avoided if possible. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;arrays&amp;lt;/b&amp;gt;: An array is a collection of values that are accessed with an index number.&lt;br /&gt;
Each value in the array can be accessed by retrieving the name of&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; the array and the index number of the value. The index number always starts at 0 for an array.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; An array must be declared and optionally assigned values before it can be used.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[] = {value0, value1, value2...} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the same way it is possible to declare an array first with datatype and size and later to give a value to an index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[5];        // declare datatype &#039;integer&#039; as array with 5 Positions&lt;br /&gt;
myArray[3] = 10;            // gives the 4th index the value 10  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To read the value of an array you can simply assign it to a variable specifying the array and the index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;x = myArray[3];       // x now has the value 10 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arrays are often used for loops, where the counter of the loop is also used as index position for the values in the array. The following example uses an array to make an LED flicker. With a for loop and a counter starting at 0 an index position in the array is read, sent to the LED pin, paused for 200ms and then the same is done with the next index position. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 10; // LED on pin 10&lt;br /&gt;
byte flicker[] = {180, 30, 255, 200, 10, 90, 150, 60};    // array with 8 different values&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);    // Sets the OUTPUT pin&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for(int i=0; i&amp;lt;7; i++)               // loop equals the number&lt;br /&gt;
 { // of the values in the array&lt;br /&gt;
 analogWrite(ledPin, flicker[i]);     // writes the index value to the LED&lt;br /&gt;
 delay(200);                          // 200ms pause&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Digitaler Input - Output ==&lt;br /&gt;
=== pinMode(pin,mode) ===&lt;br /&gt;
Used in &#039;void setup()&#039; to configure a specific pin as either input or output. &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, OUTPUT); // sets &#039;pin&#039; as output &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arduino digital pins are inputs by default, so they don&#039;t need to be specified as inputs with &#039;pinMode()&#039;. Pins configured as inputs have a high impedance state. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: There are also comfortable 20 k &#039;pullup&#039; resistors in the ATmega chip which are accessible via software.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These built-in &#039;pullup&#039; resistors can be accessed in the following way: &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, INPUT);        // sets &#039;pin&#039; as input&lt;br /&gt;
digitalWrite(pin, HIGH);        // switches on the &#039;Pullup&#039; resistor&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pullup resistors are normally used to connect inputs like switches. In the example shown here it is noticeable that the pin is not defined as an output&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; although it is written to. It is only the method to activate the internal &#039;pullup&#039; resistor.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pins configured as output are in a low impedance state and can be loaded with a maximum of 40 mAmpere current from connected elements&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; and circuits. This is enough to make an LED light up (don&#039;t forget the serial resistor), but not enough to drive most relays, solenoids or motors.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Short circuits at the Arduino pins as well as too high current can destroy the output pin or even the whole ATmega chip. For this reason it is a good idea&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; to connect an output pin with external elements in series with a 470 or 1K resistor to&lt;br /&gt;
switch.&lt;br /&gt;
&lt;br /&gt;
=== digitalRead(pin) ===&lt;br /&gt;
digitalRead(pin)&#039; reads the value from a specified digital pin, with the result either HIGH or LOW. The pin can be set either as a variable or constant (0-13). &lt;br /&gt;
&amp;lt;pre&amp;gt;value = digitalRead(Pin);      // sets &#039;value&#039; equal to the input pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
digitalWrite(pin,value)&lt;br /&gt;
Outputs either logic level HIGH or LOW at a specified pin. The pin can be set as a variable or constant (0-13).&lt;br /&gt;
&amp;lt;pre&amp;gt;digitalWrite(pin, HIGH);       // sets &#039;pin&#039; to high&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example reads a button on a digital input and switches an LED on when the button is pressed: &lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 13;            // LED connected to pin 13&lt;br /&gt;
int pin = 7;                 // Button connected to pin 7&lt;br /&gt;
int value = 0;              // Variable to store the readout value&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(led, OUTPUT);    // defines pin 13 as output&lt;br /&gt;
 pinMode(pin, INPUT);     // sets pin 7 as input&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = digitalRead(pin);    // sets &#039;value&#039; equal to&lt;br /&gt;
 // the input pin&lt;br /&gt;
 digitalWrite(led, value);    // sets &#039;led&#039; equal to the&lt;br /&gt;
}                             // Value of the button&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Analoger Input - Output ==&lt;br /&gt;
=== analogRead(pin) ===&lt;br /&gt;
Reads the value of a specified analog pin with a 10 bit resolution. This function is only available for pins (0-5). The resulting integer values have a spectrum from 0 to 1023. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = analogRead(pin);     // sets &#039;value&#039; equal to &#039;pin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Unlike digital pins, analog pins do not have to be declared as input or output first. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analogWrite(pin, value) ===&lt;br /&gt;
Writes pseudo-analog values to an output pin using hardware-based pulse width modulation (PWM). On newer Arduino boards with the ATmega 168 chip this function is applicable to pins 3, 5, 6, 9, 10 and 11. Older Arduinos with the ATmega8 only support pins 9,10 and 11. The value can be set as a variable or constant in the range 0-255.&lt;br /&gt;
&amp;lt;pre&amp;gt;analogWrite(pin, value);     // writes &#039;value&#039; to the analog &#039;pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A value of 0 generates a uniform voltage of 0 volts at a fixed pin; a value of 255 generates a uniform voltage of 5 volts at a fixed pin. For values between 0 and 255, the pin changes very quickly between 0 and 5 volts - the higher the value, the longer the pin is HIGH (5 volts). For a value of 64, the pin is at 0 volts for three-quarters of the time and at 5 volts for one-quarter of the time. A value of 128 means that the output voltage is HIGH half of the time and LOW the other half. A value of 192 means that the voltage at the pin measures 0 volts at one quarter of the time and the full 5 volts at three quarters of the time. &lt;br /&gt;
&lt;br /&gt;
Because this is a hardware-based function, the constant wave runs independently of the program until the next change of state via analogWrite (or a call to digitalRead or digitalWrite on the same pin). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: In contrast to digital pins, analog pins do not have to be declared as input or output before. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The following example reads an analog value from &#039;pin&#039;, converts the value by dividing it by 4 and then outputs it as a PWM signal to &#039;led&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 10;    // LED with 220 resistor at pin 10&lt;br /&gt;
int pin = 0;         // Potentiometer at analog pin 0&lt;br /&gt;
int value;           // Value for readout&lt;br /&gt;
&lt;br /&gt;
void setup(){}      // no setup required&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = analogRead(pin);      // sets &#039;value&#039; equal to &#039;pin&lt;br /&gt;
 value /= 4; // converts 0-1023 into 0-255&lt;br /&gt;
 analogWrite(led, value);     // outputs the PWM signal &#039;led&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Random functions ==&lt;br /&gt;
=== randomSeed(seed) ===&lt;br /&gt;
Sets a value or &#039;Seed&#039; as starting point for the random() function.&lt;br /&gt;
&amp;lt;pre&amp;gt;randomSeed(value);       // sets &#039;value&#039; as the random seed&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Arduino itself is not able to produce a truly random value. With randomSeed() a variable can be used as &#039;seed&#039; to get better random results. For example, millis() or analogRead() can be used as a seed variable or function to use electrical noise through the analog pin as an output for random values. &lt;br /&gt;
&lt;br /&gt;
=== random(min, max) ===&lt;br /&gt;
The random function allows the generation of pseudo-random values within a defined range of minimum and maxium values. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = random(100, 200);        // sets &#039;value&#039; with a random number&lt;br /&gt;
                                     // between 100 and 200 equal &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example generates a random value between 0 and 255 and outputs it as PWM signal on a PWM pin. &lt;br /&gt;
&amp;lt;pre&amp;gt;int randNumber;     // Variable to store the random value&lt;br /&gt;
int led = 10;           // LED with 220 Ohm resistor at pin 10&lt;br /&gt;
&lt;br /&gt;
void setup() {}         // no setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 randomSeed(millis());              // uses millis() as seed&lt;br /&gt;
 randNumber = random(255);          // Random number in the range 0-255&lt;br /&gt;
 analogWrite(led, randNumber);      // PWM signal as output&lt;br /&gt;
 delay(500);                        // half second pause&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Serial communication ==&lt;br /&gt;
=== Serial.begin(rate) ===&lt;br /&gt;
Serial.begin(rate)&#039; Opens the serial port and sets the baud rate for the serial transmission. The typical baud rate with the computer is 9600 baud. Other speeds are also supported.&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);      // opens serial port&lt;br /&gt;
} // sets the data rate to 9600 bps&amp;lt;/pre&amp;gt; &lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: When using serial communication, digital pins 0 (RX) and 1 (TX) cannot be used at the same time. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Serial.println(data) ===&lt;br /&gt;
Writes data to the serial port, followed by an automatic line break as carrier return and line feed. This function has the same form as &#039;Serial.print()&#039;, but is easier to read on the serial monitor. &lt;br /&gt;
&amp;lt;pre&amp;gt;Serial.println(analogValue);         // sends the value of &#039;analogValue&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More detailed information about the numerous variants of the &#039;Serial.println()&#039; and &#039;Serial.print()&#039; functions can be found on the Arduino website. &lt;br /&gt;
&lt;br /&gt;
The following simple example reads a value from analog pin 0 and sends the data to the computer once per second. &lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);                // sets the data rate to 9600 bps&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 Serial.println(analogRead(0));   // sends the analog value&lt;br /&gt;
 delay(1000);                    // pauses for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Digital output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Output.JPG|thumb|none|300px|Arduino-Example-Digital-Output]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a simple &#039;Hello World&#039; program and turns something on and off. In this example a LED is connected to PIN 13 and flashes every second. The resistor may be superfluous at this pin because the Arduino has a built-in resistor. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;            // LED off digital pin 13&lt;br /&gt;
&lt;br /&gt;
void setup()                     // will run through once&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // sets pin 13 as output&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()                      // Running as endless loop&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);    // switches the LED on&lt;br /&gt;
 delay(1000);                   // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);    // switches the LED off&lt;br /&gt;
 delay(1000);                 // Pause for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Digital input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Input.JPG|thumb|none|300px|Arduino-Example-Digital-Input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the simplest form of an input with only two possible states: on or off.&lt;br /&gt;
This example reads out a simple switch or button at pin 2. When the switch is closed and the input pin is HIGH, the LED is turned on. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;               // Output pin for the LED&lt;br /&gt;
int inPin = 2;                     // Input pin for a switch&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);         // declares LED as output&lt;br /&gt;
 pinMode(inPin, INPUT);           // declares switch as input&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
 if (digitalRead(inPin) == HIGH)   // check if this is the HIGH input&lt;br /&gt;
 {&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches the LED on&lt;br /&gt;
 delay(1000);                  // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);   // switches the LED off&lt;br /&gt;
 delay(1000);                // Pause for 1 second&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analog PWM output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pulse width modulation (PWM) is a method of simulating analog outputs by pulsing the output voltage. This allows you to make an LED brighter or darker or check a servomotor later. The following example uses a loop to slowly make an LED brighter and darker. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 9;            // PWM Pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup(){}                  // No setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for (int i=0; i&amp;lt;=255; i++)     // ascending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);        // sets the brightness value to i&lt;br /&gt;
 delay(100);                    // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 for (int i=255; i&amp;gt;=0; i--)     // descending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);       // sets the brightness value to i&lt;br /&gt;
 delay(100);                   // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== potentiometer Input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With a potentiometer and one of the analog-digital converter (ADC) inputs of the Arduino it is possible to read analog values from 0-1024. The following example uses a potentiometer to control the blinking rate of an LED.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int potPin = 0;              // Input pin for the potentiometer&lt;br /&gt;
int ledPin = 13;                 // Output pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // declare ledPin as OUTPUT&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches on ledPin&lt;br /&gt;
 delay(analogRead(potPin));      // pauses the program by the value of potentiometers&lt;br /&gt;
 digitalWrite(ledPin, LOW);      // switches ledPin off&lt;br /&gt;
 delay(analogRead(potPin));     // pauses the program by the value of potentiometers&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR WAN 1300 LoRa]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR LoRa Gateway Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.elektronik-kompendium.de/sites/com/1810231.htm&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://myhomearchiv.synology.me/download/Anleitung_Furduino.pdf&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/arduino-uno/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/category/projekte/arduino-projekte/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.netzmafia.de/skripten/hardware/Arduino/Arduino_Programmierhandbuch.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4532</id>
		<title>Arduino Board Uno Rev3-Atmega 328: Programming Guide</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4532"/>
		<updated>2020-08-10T20:42:20Z</updated>

		<summary type="html">&lt;p&gt;CCinay: /* Struktur */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The &amp;lt;b&amp;gt;Arduino IDE&amp;lt;/b&amp;gt; is a cross-platform Java application that acts as a program code editor and compiler and is also able to send firmware serially to the board. The development environment is based on Processing, an IDE designed to program artists, who normally do not have much contact with the art world programming environments. The programming language is based on Wiring, a C similar language which has a similar scope for a more restricted board design, whose IDE is also based on processing. Make sure you have an updated version of &amp;lt;b&amp;gt;[https://www.arduino.cc/en/Main/Software Arduino IDE]&amp;lt;/b&amp;gt; installed.&lt;br /&gt;
&lt;br /&gt;
== Struktur ==&lt;br /&gt;
The basic structure of the Arduino programming language is relatively simple and is divided into at least two parts. These two required parts or functions enclose blocks of statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup() {     // put your setup code here, to run once:&lt;br /&gt;
}&lt;br /&gt;
void loop() {      // put your main code here, to run repeatedly:&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Here &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; is the preparation and &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; is the execution. Both functions are necessary to execute the program. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup function should follow the variable definition, which must be listed before. Setup must be run through as the first function in a program. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; It is executed only once and is used to set &amp;lt;b&amp;gt;PinMode&amp;lt;/b&amp;gt; or to initiate serial communication. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set PinModes or start serial communication. The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; appear in every program, even if it does not contain any instructions.  &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; After the &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function follows the &amp;lt;b&amp;gt;loop()&amp;lt;/b&amp;gt; function. It contains program code that is executed continuously in an infinite loop - read inputs, trigger &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; outputs, etc. This function is the core of all Arduino programs and does the main work. &lt;br /&gt;
&lt;br /&gt;
=== setup() ===&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function is called once when the program starts. Use this function to set &amp;lt;b&amp;gt;PinModes&amp;lt;/b&amp;gt; or start serial communication.&lt;br /&gt;
The &amp;lt;b&amp;gt;setup()&amp;lt;/b&amp;gt; function must appear in every program, even if it does not contain any instructions. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(pin, OUTPUT);     // &#039;pin&#039; define as output&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== loop() ===&lt;br /&gt;
After running through the &amp;lt;b&amp;gt;setup() function&amp;lt;/b&amp;gt;, the &amp;lt;b&amp;gt;loop() function&amp;lt;/b&amp;gt; does exactly what its name suggests and runs in an endless loop. This allows the program to interact with the Arduino board via changes, reactions and controls. &lt;br /&gt;
&amp;lt;pre&amp;gt;void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(pin, HIGH);    // switches &#039;pin&#039; on&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
 digitalWrite(pin, LOW);     // switches &#039;pin&#039; off&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
A function is a block of program code that has a name and a set of instructions that are executed when the function is called. The functions &amp;lt;b&amp;gt;void setup()&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;void loop()&amp;lt;/b&amp;gt; have already been explained. There are more built-in functions that will be discussed later. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Type FunctionName(parameter)&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following integer type function &#039;&#039;delayVal()&#039;&#039; is used to insert a delay value into a program by reading a potentiometer. First a local variable &#039;v&#039; is created. Next, &#039;v&#039; is equated with the position of the potentiometer, which can have a value between 0 and 1023. The value is then divided by 4 to get a scale from 0 to 255 and at the end the result of the function is returned to the main program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int delayVal()&lt;br /&gt;
{&lt;br /&gt;
 int v;                     // create temporary variable &#039;v&lt;br /&gt;
 v = analogRead(pot);       // read potentiometer Value&lt;br /&gt;
 v /= 4;                    // Convert from 0-1023 to 0-255&lt;br /&gt;
 return v;                  // return the calculated value&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== {} curly brackets ===&lt;br /&gt;
Curly brackets (also called &#039;curly brackets&#039;) define the start and end of function and statement blocks as in the &#039;void loop()&#039; function and also in the &#039;for&#039; and &#039;if&#039; statement. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type function()&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: An opening curved bracket &#039;{&#039; must always be followed by a closing curved bracket &#039;}&#039;. Here it is often said that the number of brackets must be balanced. Unbalanced parentheses often lead to cryptic, inscrutable errors in the compiler, which are sometimes hard to find, especially in large programs.&lt;br /&gt;
&lt;br /&gt;
The Arduino programming environment helps to check that the curved brackets are balanced. To do this, simply select a brace or click just behind it, and the logically connected counterpart is highlighted. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ;semicolon ===&lt;br /&gt;
A semicolon must be used at the end of a statement and is used to separate the elements of a program.&lt;br /&gt;
A semicolon is also used to separate the elements of a for loop. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int x = 13; // declares variable &#039;x&#039; as integer with value 13&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Forgetting a semicolon at the end of a line leads to an error in the compiler. The error description can be very clear and directly point to the missing semicolon, but this does not have to be the case. If an inscrutable or apparently illogical error is reported, the first thing to do is to add missing semicolons near the reported error. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== /*... */ block comments ===&lt;br /&gt;
Block comments or multiline comments are text areas that are ignored by the program. They are used for longer descriptions or comments and help other authors to understand program parts. They start with /* and end with */ and can cover several lines. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/* This is an inserted block comment&lt;br /&gt;
 please do not forget the closing comment -&lt;br /&gt;
 These must be balanced&lt;br /&gt;
*/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== // Single line comments ===&lt;br /&gt;
Simple single-line comments are defined with a // at the beginning of the line and end with the end of the line. They are ignored by the program and do not consume memory. &lt;br /&gt;
&amp;lt;pre&amp;gt;// this is a single line comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
A variable is the name of a numeric value with a name and memory location for later use in a program. A variable must be declared and optionally provided with a value. The following example declares a variable &#039;inputVariable&#039; and assigns the value of analog pin 2 to it: &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;          // declares a variable and&lt;br /&gt;
                                     // sets its value to 0&lt;br /&gt;
inputVariable = analogRead(2);      // sets the value of the variable equal&lt;br /&gt;
                                    // with the value of analog pin 2 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;inputVariable&#039; is the variable itself. The first line explains that its data type is &#039;int&#039;, which is the short expression for integer. The second line gives the variable the value of the analog pin 2, making the value of the pin available everywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Variables should always have descriptive names as clearly as possible to make the code easier to read.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Declaration of variables: ===&lt;br /&gt;
All variables must be declared before use. Declaring a variable means defining its type such as int, long, float, etc., giving it a name and optionally an initial value.This only needs to be done once in the program. Afterwards the value can be changed at any time by calculations or various assignments. &lt;br /&gt;
&lt;br /&gt;
The following example declares &#039;inputVariable&#039; as &#039;int&#039;, i.e. integer data type and sets the initial value to 0. This is called a &#039;simple assignment&#039;. &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A variable can be declared at many places in the program. The location of the declaration determines which program parts have access to the variable. &lt;br /&gt;
&lt;br /&gt;
== Data types ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;byte&amp;lt;/b&amp;gt;: Byte stores an 8-bit numeric, integer value without decimal point. The value can be between 0 and 255.&lt;br /&gt;
&amp;lt;pre&amp;gt;byte someVariable = 180;        // declares &#039;someVariable&lt;br /&gt;
                                    // as a &#039;byte&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;int&amp;lt;/b&amp;gt;: Integers are the most common data type for storing integer values without decimal point. Its value is 16 bits and ranges from -32,767 to 32,768.&lt;br /&gt;
&amp;lt;pre&amp;gt;int someVariable = 1500;       // declares &#039;someVariable&lt;br /&gt;
                                   // as an &#039;integer&#039; data type&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;long&amp;lt;/b&amp;gt;: Data type for long integers with extended size, without decimal point, stored in a 32-bit value in a spectrum from -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
&amp;lt;pre&amp;gt;long someVariable = 90000;    // declares &#039;someVariable&lt;br /&gt;
                                  // as a &#039;long&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;float&amp;lt;/b&amp;gt;: A data type for floating point values or numbers with decimal places. Floating point numbers have a better resolution than integers and are&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; expressed as 32-bit values with a spectrum from -3.4028235E+38 to 3.4028235E+38.&lt;br /&gt;
&amp;lt;pre&amp;gt;float someVariable = 3.14;     // declares &#039;someVariable&#039;&lt;br /&gt;
                                    // as a &#039;float&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Floating point numbers are not precise and may lead to strange results when compared. Also, floating-point calculations are much slower than with integer data types. Calculations with floating-point values should be avoided if possible. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;arrays&amp;lt;/b&amp;gt;: An array is a collection of values that are accessed with an index number.&lt;br /&gt;
Each value in the array can be accessed by retrieving the name of&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; the array and the index number of the value. The index number always starts at 0 for an array.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; An array must be declared and optionally assigned values before it can be used.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[] = {value0, value1, value2...} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the same way it is possible to declare an array first with datatype and size and later to give a value to an index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[5];        // declare datatype &#039;integer&#039; as array with 5 Positions&lt;br /&gt;
myArray[3] = 10;            // gives the 4th index the value 10  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To read the value of an array you can simply assign it to a variable specifying the array and the index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;x = myArray[3];       // x now has the value 10 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arrays are often used for loops, where the counter of the loop is also used as index position for the values in the array. The following example uses an array to make an LED flicker. With a for loop and a counter starting at 0 an index position in the array is read, sent to the LED pin, paused for 200ms and then the same is done with the next index position. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 10; // LED on pin 10&lt;br /&gt;
byte flicker[] = {180, 30, 255, 200, 10, 90, 150, 60};    // array with 8 different values&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);    // Sets the OUTPUT pin&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for(int i=0; i&amp;lt;7; i++)               // loop equals the number&lt;br /&gt;
 { // of the values in the array&lt;br /&gt;
 analogWrite(ledPin, flicker[i]);     // writes the index value to the LED&lt;br /&gt;
 delay(200);                          // 200ms pause&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Digitaler Input - Output ==&lt;br /&gt;
=== pinMode(pin,mode) ===&lt;br /&gt;
Used in &#039;void setup()&#039; to configure a specific pin as either input or output. &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, OUTPUT); // sets &#039;pin&#039; as output &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arduino digital pins are inputs by default, so they don&#039;t need to be specified as inputs with &#039;pinMode()&#039;. Pins configured as inputs have a high impedance state. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: There are also comfortable 20 k &#039;pullup&#039; resistors in the ATmega chip which are accessible via software.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These built-in &#039;pullup&#039; resistors can be accessed in the following way: &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, INPUT);        // sets &#039;pin&#039; as input&lt;br /&gt;
digitalWrite(pin, HIGH);        // switches on the &#039;Pullup&#039; resistor&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pullup resistors are normally used to connect inputs like switches. In the example shown here it is noticeable that the pin is not defined as an output&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; although it is written to. It is only the method to activate the internal &#039;pullup&#039; resistor.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pins configured as output are in a low impedance state and can be loaded with a maximum of 40 mAmpere current from connected elements&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; and circuits. This is enough to make an LED light up (don&#039;t forget the serial resistor), but not enough to drive most relays, solenoids or motors.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Short circuits at the Arduino pins as well as too high current can destroy the output pin or even the whole ATmega chip. For this reason it is a good idea&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; to connect an output pin with external elements in series with a 470 or 1K resistor to&lt;br /&gt;
switch.&lt;br /&gt;
&lt;br /&gt;
=== digitalRead(pin) ===&lt;br /&gt;
digitalRead(pin)&#039; reads the value from a specified digital pin, with the result either HIGH or LOW. The pin can be set either as a variable or constant (0-13). &lt;br /&gt;
&amp;lt;pre&amp;gt;value = digitalRead(Pin);      // sets &#039;value&#039; equal to the input pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
digitalWrite(pin,value)&lt;br /&gt;
Outputs either logic level HIGH or LOW at a specified pin. The pin can be set as a variable or constant (0-13).&lt;br /&gt;
&amp;lt;pre&amp;gt;digitalWrite(pin, HIGH);       // sets &#039;pin&#039; to high&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example reads a button on a digital input and switches an LED on when the button is pressed: &lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 13;            // LED connected to pin 13&lt;br /&gt;
int pin = 7;                 // Button connected to pin 7&lt;br /&gt;
int value = 0;              // Variable to store the readout value&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(led, OUTPUT);    // defines pin 13 as output&lt;br /&gt;
 pinMode(pin, INPUT);     // sets pin 7 as input&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = digitalRead(pin);    // sets &#039;value&#039; equal to&lt;br /&gt;
 // the input pin&lt;br /&gt;
 digitalWrite(led, value);    // sets &#039;led&#039; equal to the&lt;br /&gt;
}                             // Value of the button&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Analoger Input - Output ==&lt;br /&gt;
=== analogRead(pin) ===&lt;br /&gt;
Reads the value of a specified analog pin with a 10 bit resolution. This function is only available for pins (0-5). The resulting integer values have a spectrum from 0 to 1023. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = analogRead(pin);     // sets &#039;value&#039; equal to &#039;pin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Unlike digital pins, analog pins do not have to be declared as input or output first. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analogWrite(pin, value) ===&lt;br /&gt;
Writes pseudo-analog values to an output pin using hardware-based pulse width modulation (PWM). On newer Arduino boards with the ATmega 168 chip this function is applicable to pins 3, 5, 6, 9, 10 and 11. Older Arduinos with the ATmega8 only support pins 9,10 and 11. The value can be set as a variable or constant in the range 0-255.&lt;br /&gt;
&amp;lt;pre&amp;gt;analogWrite(pin, value);     // writes &#039;value&#039; to the analog &#039;pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A value of 0 generates a uniform voltage of 0 volts at a fixed pin; a value of 255 generates a uniform voltage of 5 volts at a fixed pin. For values between 0 and 255, the pin changes very quickly between 0 and 5 volts - the higher the value, the longer the pin is HIGH (5 volts). For a value of 64, the pin is at 0 volts for three-quarters of the time and at 5 volts for one-quarter of the time. A value of 128 means that the output voltage is HIGH half of the time and LOW the other half. A value of 192 means that the voltage at the pin measures 0 volts at one quarter of the time and the full 5 volts at three quarters of the time. &lt;br /&gt;
&lt;br /&gt;
Because this is a hardware-based function, the constant wave runs independently of the program until the next change of state via analogWrite (or a call to digitalRead or digitalWrite on the same pin). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: In contrast to digital pins, analog pins do not have to be declared as input or output before. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The following example reads an analog value from &#039;pin&#039;, converts the value by dividing it by 4 and then outputs it as a PWM signal to &#039;led&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 10;    // LED with 220 resistor at pin 10&lt;br /&gt;
int pin = 0;         // Potentiometer at analog pin 0&lt;br /&gt;
int value;           // Value for readout&lt;br /&gt;
&lt;br /&gt;
void setup(){}      // no setup required&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = analogRead(pin);      // sets &#039;value&#039; equal to &#039;pin&lt;br /&gt;
 value /= 4; // converts 0-1023 into 0-255&lt;br /&gt;
 analogWrite(led, value);     // outputs the PWM signal &#039;led&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Random functions ==&lt;br /&gt;
=== randomSeed(seed) ===&lt;br /&gt;
Sets a value or &#039;Seed&#039; as starting point for the random() function.&lt;br /&gt;
&amp;lt;pre&amp;gt;randomSeed(value);       // sets &#039;value&#039; as the random seed&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Arduino itself is not able to produce a truly random value. With randomSeed() a variable can be used as &#039;seed&#039; to get better random results. For example, millis() or analogRead() can be used as a seed variable or function to use electrical noise through the analog pin as an output for random values. &lt;br /&gt;
&lt;br /&gt;
=== random(min, max) ===&lt;br /&gt;
The random function allows the generation of pseudo-random values within a defined range of minimum and maxium values. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = random(100, 200);        // sets &#039;value&#039; with a random number&lt;br /&gt;
                                     // between 100 and 200 equal &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example generates a random value between 0 and 255 and outputs it as PWM signal on a PWM pin. &lt;br /&gt;
&amp;lt;pre&amp;gt;int randNumber;     // Variable to store the random value&lt;br /&gt;
int led = 10;           // LED with 220 Ohm resistor at pin 10&lt;br /&gt;
&lt;br /&gt;
void setup() {}         // no setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 randomSeed(millis());              // uses millis() as seed&lt;br /&gt;
 randNumber = random(255);          // Random number in the range 0-255&lt;br /&gt;
 analogWrite(led, randNumber);      // PWM signal as output&lt;br /&gt;
 delay(500);                        // half second pause&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Serial communication ==&lt;br /&gt;
=== Serial.begin(rate) ===&lt;br /&gt;
Serial.begin(rate)&#039; Opens the serial port and sets the baud rate for the serial transmission. The typical baud rate with the computer is 9600 baud. Other speeds are also supported.&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);      // opens serial port&lt;br /&gt;
} // sets the data rate to 9600 bps&amp;lt;/pre&amp;gt; &lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: When using serial communication, digital pins 0 (RX) and 1 (TX) cannot be used at the same time. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Serial.println(data) ===&lt;br /&gt;
Writes data to the serial port, followed by an automatic line break as carrier return and line feed. This function has the same form as &#039;Serial.print()&#039;, but is easier to read on the serial monitor. &lt;br /&gt;
&amp;lt;pre&amp;gt;Serial.println(analogValue);         // sends the value of &#039;analogValue&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More detailed information about the numerous variants of the &#039;Serial.println()&#039; and &#039;Serial.print()&#039; functions can be found on the Arduino website. &lt;br /&gt;
&lt;br /&gt;
The following simple example reads a value from analog pin 0 and sends the data to the computer once per second. &lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);                // sets the data rate to 9600 bps&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 Serial.println(analogRead(0));   // sends the analog value&lt;br /&gt;
 delay(1000);                    // pauses for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Digital output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Output.JPG|thumb|none|300px|Arduino-Example-Digital-Output]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a simple &#039;Hello World&#039; program and turns something on and off. In this example a LED is connected to PIN 13 and flashes every second. The resistor may be superfluous at this pin because the Arduino has a built-in resistor. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;            // LED off digital pin 13&lt;br /&gt;
&lt;br /&gt;
void setup()                     // will run through once&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // sets pin 13 as output&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()                      // Running as endless loop&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);    // switches the LED on&lt;br /&gt;
 delay(1000);                   // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);    // switches the LED off&lt;br /&gt;
 delay(1000);                 // Pause for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Digital input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Input.JPG|thumb|none|300px|Arduino-Example-Digital-Input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the simplest form of an input with only two possible states: on or off.&lt;br /&gt;
This example reads out a simple switch or button at pin 2. When the switch is closed and the input pin is HIGH, the LED is turned on. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;               // Output pin for the LED&lt;br /&gt;
int inPin = 2;                     // Input pin for a switch&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);         // declares LED as output&lt;br /&gt;
 pinMode(inPin, INPUT);           // declares switch as input&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
 if (digitalRead(inPin) == HIGH)   // check if this is the HIGH input&lt;br /&gt;
 {&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches the LED on&lt;br /&gt;
 delay(1000);                  // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);   // switches the LED off&lt;br /&gt;
 delay(1000);                // Pause for 1 second&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analog PWM output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pulse width modulation (PWM) is a method of simulating analog outputs by pulsing the output voltage. This allows you to make an LED brighter or darker or check a servomotor later. The following example uses a loop to slowly make an LED brighter and darker. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 9;            // PWM Pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup(){}                  // No setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for (int i=0; i&amp;lt;=255; i++)     // ascending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);        // sets the brightness value to i&lt;br /&gt;
 delay(100);                    // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 for (int i=255; i&amp;gt;=0; i--)     // descending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);       // sets the brightness value to i&lt;br /&gt;
 delay(100);                   // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== potentiometer Input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With a potentiometer and one of the analog-digital converter (ADC) inputs of the Arduino it is possible to read analog values from 0-1024. The following example uses a potentiometer to control the blinking rate of an LED.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int potPin = 0;              // Input pin for the potentiometer&lt;br /&gt;
int ledPin = 13;                 // Output pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // declare ledPin as OUTPUT&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches on ledPin&lt;br /&gt;
 delay(analogRead(potPin));      // pauses the program by the value of potentiometers&lt;br /&gt;
 digitalWrite(ledPin, LOW);      // switches ledPin off&lt;br /&gt;
 delay(analogRead(potPin));     // pauses the program by the value of potentiometers&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR WAN 1300 LoRa]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR LoRa Gateway Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.elektronik-kompendium.de/sites/com/1810231.htm&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://myhomearchiv.synology.me/download/Anleitung_Furduino.pdf&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/arduino-uno/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/category/projekte/arduino-projekte/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.netzmafia.de/skripten/hardware/Arduino/Arduino_Programmierhandbuch.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4531</id>
		<title>Arduino Board Uno Rev3-Atmega 328: Programming Guide</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4531"/>
		<updated>2020-08-10T20:35:43Z</updated>

		<summary type="html">&lt;p&gt;CCinay: /* Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The &amp;lt;b&amp;gt;Arduino IDE&amp;lt;/b&amp;gt; is a cross-platform Java application that acts as a program code editor and compiler and is also able to send firmware serially to the board. The development environment is based on Processing, an IDE designed to program artists, who normally do not have much contact with the art world programming environments. The programming language is based on Wiring, a C similar language which has a similar scope for a more restricted board design, whose IDE is also based on processing. Make sure you have an updated version of &amp;lt;b&amp;gt;[https://www.arduino.cc/en/Main/Software Arduino IDE]&amp;lt;/b&amp;gt; installed.&lt;br /&gt;
&lt;br /&gt;
== Struktur ==&lt;br /&gt;
The basic structure of the Arduino programming language is relatively simple and is divided into at least two parts. These two required parts or functions enclose blocks of statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; void setup() {&lt;br /&gt;
    // put your setup code here, to run once:&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
    // put your main code here, to run repeatedly:&lt;br /&gt;
&lt;br /&gt;
} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Here setup() is the preparation and loop() is the execution. Both functions are necessary to execute the program. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup function should follow the variable definition, which must be listed before. Setup must be run through as the first function in a program. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; It is executed only once and is used to set PinMode or to initiate serial communication. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup() function is called once when the program starts. Use this function to set PinModes or start serial communication. The setup() function must &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; appear in every program, even if it does not contain any instructions.  &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; After the setup() function follows the loop() function. It contains program code that is executed continuously in an infinite loop - read inputs, trigger &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; outputs, etc. This function is the core of all Arduino programs and does the main work. &lt;br /&gt;
&lt;br /&gt;
=== setup() ===&lt;br /&gt;
The setup() function is called once when the program starts. Use this function to set PinModes or start serial communication.&lt;br /&gt;
The setup() function must appear in every program, even if it does not contain any instructions. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(pin, OUTPUT);     // &#039;pin&#039; define as output&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== loop() ===&lt;br /&gt;
After running through the setup() function, the loop() function does exactly what its name suggests and runs in an endless loop. This allows the program to interact with the Arduino board via changes, reactions and controls. &lt;br /&gt;
&amp;lt;pre&amp;gt;void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(pin, HIGH);    // switches &#039;pin&#039; on&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
 digitalWrite(pin, LOW);     // switches &#039;pin&#039; off&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
A function is a block of program code that has a name and a set of instructions that are executed when the function is called. The functions void setup() and void loop() have already been explained. There are more built-in functions that will be discussed later. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Type FunctionName(parameter)&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following integer type function &#039;&#039;delayVal()&#039;&#039; is used to insert a delay value into a program by reading a potentiometer. First a local variable &#039;v&#039; is created. Next, &#039;v&#039; is equated with the position of the potentiometer, which can have a value between 0 and 1023. The value is then divided by 4 to get a scale from 0 to 255 and at the end the result of the function is returned to the main program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int delayVal()&lt;br /&gt;
{&lt;br /&gt;
 int v;                     // create temporary variable &#039;v&lt;br /&gt;
 v = analogRead(pot);       // read potentiometer Value&lt;br /&gt;
 v /= 4;                    // Convert from 0-1023 to 0-255&lt;br /&gt;
 return v;                  // return the calculated value&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== {} curly brackets ===&lt;br /&gt;
Curly brackets (also called &#039;curly brackets&#039;) define the start and end of function and statement blocks as in the &#039;void loop()&#039; function and also in the &#039;for&#039; and &#039;if&#039; statement. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type function()&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: An opening curved bracket &#039;{&#039; must always be followed by a closing curved bracket &#039;}&#039;. Here it is often said that the number of brackets must be balanced. Unbalanced parentheses often lead to cryptic, inscrutable errors in the compiler, which are sometimes hard to find, especially in large programs.&lt;br /&gt;
&lt;br /&gt;
The Arduino programming environment helps to check that the curved brackets are balanced. To do this, simply select a brace or click just behind it, and the logically connected counterpart is highlighted. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ;semicolon ===&lt;br /&gt;
A semicolon must be used at the end of a statement and is used to separate the elements of a program.&lt;br /&gt;
A semicolon is also used to separate the elements of a for loop. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int x = 13; // declares variable &#039;x&#039; as integer with value 13&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Forgetting a semicolon at the end of a line leads to an error in the compiler. The error description can be very clear and directly point to the missing semicolon, but this does not have to be the case. If an inscrutable or apparently illogical error is reported, the first thing to do is to add missing semicolons near the reported error. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== /*... */ block comments ===&lt;br /&gt;
Block comments or multiline comments are text areas that are ignored by the program. They are used for longer descriptions or comments and help other authors to understand program parts. They start with /* and end with */ and can cover several lines. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/* This is an inserted block comment&lt;br /&gt;
 please do not forget the closing comment -&lt;br /&gt;
 These must be balanced&lt;br /&gt;
*/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== // Single line comments ===&lt;br /&gt;
Simple single-line comments are defined with a // at the beginning of the line and end with the end of the line. They are ignored by the program and do not consume memory. &lt;br /&gt;
&amp;lt;pre&amp;gt;// this is a single line comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
A variable is the name of a numeric value with a name and memory location for later use in a program. A variable must be declared and optionally provided with a value. The following example declares a variable &#039;inputVariable&#039; and assigns the value of analog pin 2 to it: &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;          // declares a variable and&lt;br /&gt;
                                     // sets its value to 0&lt;br /&gt;
inputVariable = analogRead(2);      // sets the value of the variable equal&lt;br /&gt;
                                    // with the value of analog pin 2 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;inputVariable&#039; is the variable itself. The first line explains that its data type is &#039;int&#039;, which is the short expression for integer. The second line gives the variable the value of the analog pin 2, making the value of the pin available everywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Variables should always have descriptive names as clearly as possible to make the code easier to read.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Declaration of variables: ===&lt;br /&gt;
All variables must be declared before use. Declaring a variable means defining its type such as int, long, float, etc., giving it a name and optionally an initial value.This only needs to be done once in the program. Afterwards the value can be changed at any time by calculations or various assignments. &lt;br /&gt;
&lt;br /&gt;
The following example declares &#039;inputVariable&#039; as &#039;int&#039;, i.e. integer data type and sets the initial value to 0. This is called a &#039;simple assignment&#039;. &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A variable can be declared at many places in the program. The location of the declaration determines which program parts have access to the variable. &lt;br /&gt;
&lt;br /&gt;
== Data types ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;byte&amp;lt;/b&amp;gt;: Byte stores an 8-bit numeric, integer value without decimal point. The value can be between 0 and 255.&lt;br /&gt;
&amp;lt;pre&amp;gt;byte someVariable = 180;        // declares &#039;someVariable&lt;br /&gt;
                                    // as a &#039;byte&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;int&amp;lt;/b&amp;gt;: Integers are the most common data type for storing integer values without decimal point. Its value is 16 bits and ranges from -32,767 to 32,768.&lt;br /&gt;
&amp;lt;pre&amp;gt;int someVariable = 1500;       // declares &#039;someVariable&lt;br /&gt;
                                   // as an &#039;integer&#039; data type&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;long&amp;lt;/b&amp;gt;: Data type for long integers with extended size, without decimal point, stored in a 32-bit value in a spectrum from -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
&amp;lt;pre&amp;gt;long someVariable = 90000;    // declares &#039;someVariable&lt;br /&gt;
                                  // as a &#039;long&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;float&amp;lt;/b&amp;gt;: A data type for floating point values or numbers with decimal places. Floating point numbers have a better resolution than integers and are&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; expressed as 32-bit values with a spectrum from -3.4028235E+38 to 3.4028235E+38.&lt;br /&gt;
&amp;lt;pre&amp;gt;float someVariable = 3.14;     // declares &#039;someVariable&#039;&lt;br /&gt;
                                    // as a &#039;float&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Floating point numbers are not precise and may lead to strange results when compared. Also, floating-point calculations are much slower than with integer data types. Calculations with floating-point values should be avoided if possible. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;arrays&amp;lt;/b&amp;gt;: An array is a collection of values that are accessed with an index number.&lt;br /&gt;
Each value in the array can be accessed by retrieving the name of&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; the array and the index number of the value. The index number always starts at 0 for an array.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; An array must be declared and optionally assigned values before it can be used.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[] = {value0, value1, value2...} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the same way it is possible to declare an array first with datatype and size and later to give a value to an index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[5];        // declare datatype &#039;integer&#039; as array with 5 Positions&lt;br /&gt;
myArray[3] = 10;            // gives the 4th index the value 10  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To read the value of an array you can simply assign it to a variable specifying the array and the index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;x = myArray[3];       // x now has the value 10 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arrays are often used for loops, where the counter of the loop is also used as index position for the values in the array. The following example uses an array to make an LED flicker. With a for loop and a counter starting at 0 an index position in the array is read, sent to the LED pin, paused for 200ms and then the same is done with the next index position. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 10; // LED on pin 10&lt;br /&gt;
byte flicker[] = {180, 30, 255, 200, 10, 90, 150, 60};    // array with 8 different values&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);    // Sets the OUTPUT pin&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for(int i=0; i&amp;lt;7; i++)               // loop equals the number&lt;br /&gt;
 { // of the values in the array&lt;br /&gt;
 analogWrite(ledPin, flicker[i]);     // writes the index value to the LED&lt;br /&gt;
 delay(200);                          // 200ms pause&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Digitaler Input - Output ==&lt;br /&gt;
=== pinMode(pin,mode) ===&lt;br /&gt;
Used in &#039;void setup()&#039; to configure a specific pin as either input or output. &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, OUTPUT); // sets &#039;pin&#039; as output &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arduino digital pins are inputs by default, so they don&#039;t need to be specified as inputs with &#039;pinMode()&#039;. Pins configured as inputs have a high impedance state. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: There are also comfortable 20 k &#039;pullup&#039; resistors in the ATmega chip which are accessible via software.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These built-in &#039;pullup&#039; resistors can be accessed in the following way: &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, INPUT);        // sets &#039;pin&#039; as input&lt;br /&gt;
digitalWrite(pin, HIGH);        // switches on the &#039;Pullup&#039; resistor&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pullup resistors are normally used to connect inputs like switches. In the example shown here it is noticeable that the pin is not defined as an output&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; although it is written to. It is only the method to activate the internal &#039;pullup&#039; resistor.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pins configured as output are in a low impedance state and can be loaded with a maximum of 40 mAmpere current from connected elements&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; and circuits. This is enough to make an LED light up (don&#039;t forget the serial resistor), but not enough to drive most relays, solenoids or motors.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Short circuits at the Arduino pins as well as too high current can destroy the output pin or even the whole ATmega chip. For this reason it is a good idea&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; to connect an output pin with external elements in series with a 470 or 1K resistor to&lt;br /&gt;
switch.&lt;br /&gt;
&lt;br /&gt;
=== digitalRead(pin) ===&lt;br /&gt;
digitalRead(pin)&#039; reads the value from a specified digital pin, with the result either HIGH or LOW. The pin can be set either as a variable or constant (0-13). &lt;br /&gt;
&amp;lt;pre&amp;gt;value = digitalRead(Pin);      // sets &#039;value&#039; equal to the input pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
digitalWrite(pin,value)&lt;br /&gt;
Outputs either logic level HIGH or LOW at a specified pin. The pin can be set as a variable or constant (0-13).&lt;br /&gt;
&amp;lt;pre&amp;gt;digitalWrite(pin, HIGH);       // sets &#039;pin&#039; to high&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example reads a button on a digital input and switches an LED on when the button is pressed: &lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 13;            // LED connected to pin 13&lt;br /&gt;
int pin = 7;                 // Button connected to pin 7&lt;br /&gt;
int value = 0;              // Variable to store the readout value&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(led, OUTPUT);    // defines pin 13 as output&lt;br /&gt;
 pinMode(pin, INPUT);     // sets pin 7 as input&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = digitalRead(pin);    // sets &#039;value&#039; equal to&lt;br /&gt;
 // the input pin&lt;br /&gt;
 digitalWrite(led, value);    // sets &#039;led&#039; equal to the&lt;br /&gt;
}                             // Value of the button&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Analoger Input - Output ==&lt;br /&gt;
=== analogRead(pin) ===&lt;br /&gt;
Reads the value of a specified analog pin with a 10 bit resolution. This function is only available for pins (0-5). The resulting integer values have a spectrum from 0 to 1023. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = analogRead(pin);     // sets &#039;value&#039; equal to &#039;pin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Unlike digital pins, analog pins do not have to be declared as input or output first. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analogWrite(pin, value) ===&lt;br /&gt;
Writes pseudo-analog values to an output pin using hardware-based pulse width modulation (PWM). On newer Arduino boards with the ATmega 168 chip this function is applicable to pins 3, 5, 6, 9, 10 and 11. Older Arduinos with the ATmega8 only support pins 9,10 and 11. The value can be set as a variable or constant in the range 0-255.&lt;br /&gt;
&amp;lt;pre&amp;gt;analogWrite(pin, value);     // writes &#039;value&#039; to the analog &#039;pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A value of 0 generates a uniform voltage of 0 volts at a fixed pin; a value of 255 generates a uniform voltage of 5 volts at a fixed pin. For values between 0 and 255, the pin changes very quickly between 0 and 5 volts - the higher the value, the longer the pin is HIGH (5 volts). For a value of 64, the pin is at 0 volts for three-quarters of the time and at 5 volts for one-quarter of the time. A value of 128 means that the output voltage is HIGH half of the time and LOW the other half. A value of 192 means that the voltage at the pin measures 0 volts at one quarter of the time and the full 5 volts at three quarters of the time. &lt;br /&gt;
&lt;br /&gt;
Because this is a hardware-based function, the constant wave runs independently of the program until the next change of state via analogWrite (or a call to digitalRead or digitalWrite on the same pin). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: In contrast to digital pins, analog pins do not have to be declared as input or output before. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The following example reads an analog value from &#039;pin&#039;, converts the value by dividing it by 4 and then outputs it as a PWM signal to &#039;led&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 10;    // LED with 220 resistor at pin 10&lt;br /&gt;
int pin = 0;         // Potentiometer at analog pin 0&lt;br /&gt;
int value;           // Value for readout&lt;br /&gt;
&lt;br /&gt;
void setup(){}      // no setup required&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = analogRead(pin);      // sets &#039;value&#039; equal to &#039;pin&lt;br /&gt;
 value /= 4; // converts 0-1023 into 0-255&lt;br /&gt;
 analogWrite(led, value);     // outputs the PWM signal &#039;led&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Random functions ==&lt;br /&gt;
=== randomSeed(seed) ===&lt;br /&gt;
Sets a value or &#039;Seed&#039; as starting point for the random() function.&lt;br /&gt;
&amp;lt;pre&amp;gt;randomSeed(value);       // sets &#039;value&#039; as the random seed&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Arduino itself is not able to produce a truly random value. With randomSeed() a variable can be used as &#039;seed&#039; to get better random results. For example, millis() or analogRead() can be used as a seed variable or function to use electrical noise through the analog pin as an output for random values. &lt;br /&gt;
&lt;br /&gt;
=== random(min, max) ===&lt;br /&gt;
The random function allows the generation of pseudo-random values within a defined range of minimum and maxium values. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = random(100, 200);        // sets &#039;value&#039; with a random number&lt;br /&gt;
                                     // between 100 and 200 equal &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example generates a random value between 0 and 255 and outputs it as PWM signal on a PWM pin. &lt;br /&gt;
&amp;lt;pre&amp;gt;int randNumber;     // Variable to store the random value&lt;br /&gt;
int led = 10;           // LED with 220 Ohm resistor at pin 10&lt;br /&gt;
&lt;br /&gt;
void setup() {}         // no setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 randomSeed(millis());              // uses millis() as seed&lt;br /&gt;
 randNumber = random(255);          // Random number in the range 0-255&lt;br /&gt;
 analogWrite(led, randNumber);      // PWM signal as output&lt;br /&gt;
 delay(500);                        // half second pause&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Serial communication ==&lt;br /&gt;
=== Serial.begin(rate) ===&lt;br /&gt;
Serial.begin(rate)&#039; Opens the serial port and sets the baud rate for the serial transmission. The typical baud rate with the computer is 9600 baud. Other speeds are also supported.&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);      // opens serial port&lt;br /&gt;
} // sets the data rate to 9600 bps&amp;lt;/pre&amp;gt; &lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: When using serial communication, digital pins 0 (RX) and 1 (TX) cannot be used at the same time. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Serial.println(data) ===&lt;br /&gt;
Writes data to the serial port, followed by an automatic line break as carrier return and line feed. This function has the same form as &#039;Serial.print()&#039;, but is easier to read on the serial monitor. &lt;br /&gt;
&amp;lt;pre&amp;gt;Serial.println(analogValue);         // sends the value of &#039;analogValue&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More detailed information about the numerous variants of the &#039;Serial.println()&#039; and &#039;Serial.print()&#039; functions can be found on the Arduino website. &lt;br /&gt;
&lt;br /&gt;
The following simple example reads a value from analog pin 0 and sends the data to the computer once per second. &lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);                // sets the data rate to 9600 bps&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 Serial.println(analogRead(0));   // sends the analog value&lt;br /&gt;
 delay(1000);                    // pauses for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Digital output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Output.JPG|thumb|none|300px|Arduino-Example-Digital-Output]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a simple &#039;Hello World&#039; program and turns something on and off. In this example a LED is connected to PIN 13 and flashes every second. The resistor may be superfluous at this pin because the Arduino has a built-in resistor. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;            // LED off digital pin 13&lt;br /&gt;
&lt;br /&gt;
void setup()                     // will run through once&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // sets pin 13 as output&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()                      // Running as endless loop&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);    // switches the LED on&lt;br /&gt;
 delay(1000);                   // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);    // switches the LED off&lt;br /&gt;
 delay(1000);                 // Pause for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Digital input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Input.JPG|thumb|none|300px|Arduino-Example-Digital-Input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the simplest form of an input with only two possible states: on or off.&lt;br /&gt;
This example reads out a simple switch or button at pin 2. When the switch is closed and the input pin is HIGH, the LED is turned on. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;               // Output pin for the LED&lt;br /&gt;
int inPin = 2;                     // Input pin for a switch&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);         // declares LED as output&lt;br /&gt;
 pinMode(inPin, INPUT);           // declares switch as input&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
 if (digitalRead(inPin) == HIGH)   // check if this is the HIGH input&lt;br /&gt;
 {&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches the LED on&lt;br /&gt;
 delay(1000);                  // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);   // switches the LED off&lt;br /&gt;
 delay(1000);                // Pause for 1 second&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analog PWM output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pulse width modulation (PWM) is a method of simulating analog outputs by pulsing the output voltage. This allows you to make an LED brighter or darker or check a servomotor later. The following example uses a loop to slowly make an LED brighter and darker. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 9;            // PWM Pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup(){}                  // No setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for (int i=0; i&amp;lt;=255; i++)     // ascending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);        // sets the brightness value to i&lt;br /&gt;
 delay(100);                    // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 for (int i=255; i&amp;gt;=0; i--)     // descending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);       // sets the brightness value to i&lt;br /&gt;
 delay(100);                   // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== potentiometer Input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With a potentiometer and one of the analog-digital converter (ADC) inputs of the Arduino it is possible to read analog values from 0-1024. The following example uses a potentiometer to control the blinking rate of an LED.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int potPin = 0;              // Input pin for the potentiometer&lt;br /&gt;
int ledPin = 13;                 // Output pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // declare ledPin as OUTPUT&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches on ledPin&lt;br /&gt;
 delay(analogRead(potPin));      // pauses the program by the value of potentiometers&lt;br /&gt;
 digitalWrite(ledPin, LOW);      // switches ledPin off&lt;br /&gt;
 delay(analogRead(potPin));     // pauses the program by the value of potentiometers&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR WAN 1300 LoRa]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR LoRa Gateway Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.elektronik-kompendium.de/sites/com/1810231.htm&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://myhomearchiv.synology.me/download/Anleitung_Furduino.pdf&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/arduino-uno/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/category/projekte/arduino-projekte/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.netzmafia.de/skripten/hardware/Arduino/Arduino_Programmierhandbuch.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4530</id>
		<title>Arduino Board Uno Rev3-Atmega 328: Programming Guide</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4530"/>
		<updated>2020-08-10T20:34:57Z</updated>

		<summary type="html">&lt;p&gt;CCinay: /* random(min, max) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The Arduino IDE is a cross-platform Java application that acts as a program code editor and compiler and is also able to send firmware serially to the board. The development environment is based on Processing, an IDE designed to program artists, who normally do not have much contact with the art world programming environments. The programming language is based on Wiring, a C similar language which has a similar scope for a more restricted board design, whose IDE is also based on processing. Make sure you have an updated version of [https://www.arduino.cc/en/Main/Software Arduino IDE] installed.&lt;br /&gt;
&lt;br /&gt;
== Struktur ==&lt;br /&gt;
The basic structure of the Arduino programming language is relatively simple and is divided into at least two parts. These two required parts or functions enclose blocks of statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; void setup() {&lt;br /&gt;
    // put your setup code here, to run once:&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
    // put your main code here, to run repeatedly:&lt;br /&gt;
&lt;br /&gt;
} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Here setup() is the preparation and loop() is the execution. Both functions are necessary to execute the program. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup function should follow the variable definition, which must be listed before. Setup must be run through as the first function in a program. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; It is executed only once and is used to set PinMode or to initiate serial communication. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup() function is called once when the program starts. Use this function to set PinModes or start serial communication. The setup() function must &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; appear in every program, even if it does not contain any instructions.  &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; After the setup() function follows the loop() function. It contains program code that is executed continuously in an infinite loop - read inputs, trigger &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; outputs, etc. This function is the core of all Arduino programs and does the main work. &lt;br /&gt;
&lt;br /&gt;
=== setup() ===&lt;br /&gt;
The setup() function is called once when the program starts. Use this function to set PinModes or start serial communication.&lt;br /&gt;
The setup() function must appear in every program, even if it does not contain any instructions. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(pin, OUTPUT);     // &#039;pin&#039; define as output&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== loop() ===&lt;br /&gt;
After running through the setup() function, the loop() function does exactly what its name suggests and runs in an endless loop. This allows the program to interact with the Arduino board via changes, reactions and controls. &lt;br /&gt;
&amp;lt;pre&amp;gt;void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(pin, HIGH);    // switches &#039;pin&#039; on&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
 digitalWrite(pin, LOW);     // switches &#039;pin&#039; off&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
A function is a block of program code that has a name and a set of instructions that are executed when the function is called. The functions void setup() and void loop() have already been explained. There are more built-in functions that will be discussed later. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Type FunctionName(parameter)&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following integer type function &#039;&#039;delayVal()&#039;&#039; is used to insert a delay value into a program by reading a potentiometer. First a local variable &#039;v&#039; is created. Next, &#039;v&#039; is equated with the position of the potentiometer, which can have a value between 0 and 1023. The value is then divided by 4 to get a scale from 0 to 255 and at the end the result of the function is returned to the main program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int delayVal()&lt;br /&gt;
{&lt;br /&gt;
 int v;                     // create temporary variable &#039;v&lt;br /&gt;
 v = analogRead(pot);       // read potentiometer Value&lt;br /&gt;
 v /= 4;                    // Convert from 0-1023 to 0-255&lt;br /&gt;
 return v;                  // return the calculated value&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== {} curly brackets ===&lt;br /&gt;
Curly brackets (also called &#039;curly brackets&#039;) define the start and end of function and statement blocks as in the &#039;void loop()&#039; function and also in the &#039;for&#039; and &#039;if&#039; statement. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type function()&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: An opening curved bracket &#039;{&#039; must always be followed by a closing curved bracket &#039;}&#039;. Here it is often said that the number of brackets must be balanced. Unbalanced parentheses often lead to cryptic, inscrutable errors in the compiler, which are sometimes hard to find, especially in large programs.&lt;br /&gt;
&lt;br /&gt;
The Arduino programming environment helps to check that the curved brackets are balanced. To do this, simply select a brace or click just behind it, and the logically connected counterpart is highlighted. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ;semicolon ===&lt;br /&gt;
A semicolon must be used at the end of a statement and is used to separate the elements of a program.&lt;br /&gt;
A semicolon is also used to separate the elements of a for loop. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int x = 13; // declares variable &#039;x&#039; as integer with value 13&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Forgetting a semicolon at the end of a line leads to an error in the compiler. The error description can be very clear and directly point to the missing semicolon, but this does not have to be the case. If an inscrutable or apparently illogical error is reported, the first thing to do is to add missing semicolons near the reported error. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== /*... */ block comments ===&lt;br /&gt;
Block comments or multiline comments are text areas that are ignored by the program. They are used for longer descriptions or comments and help other authors to understand program parts. They start with /* and end with */ and can cover several lines. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/* This is an inserted block comment&lt;br /&gt;
 please do not forget the closing comment -&lt;br /&gt;
 These must be balanced&lt;br /&gt;
*/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== // Single line comments ===&lt;br /&gt;
Simple single-line comments are defined with a // at the beginning of the line and end with the end of the line. They are ignored by the program and do not consume memory. &lt;br /&gt;
&amp;lt;pre&amp;gt;// this is a single line comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
A variable is the name of a numeric value with a name and memory location for later use in a program. A variable must be declared and optionally provided with a value. The following example declares a variable &#039;inputVariable&#039; and assigns the value of analog pin 2 to it: &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;          // declares a variable and&lt;br /&gt;
                                     // sets its value to 0&lt;br /&gt;
inputVariable = analogRead(2);      // sets the value of the variable equal&lt;br /&gt;
                                    // with the value of analog pin 2 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;inputVariable&#039; is the variable itself. The first line explains that its data type is &#039;int&#039;, which is the short expression for integer. The second line gives the variable the value of the analog pin 2, making the value of the pin available everywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Variables should always have descriptive names as clearly as possible to make the code easier to read.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Declaration of variables: ===&lt;br /&gt;
All variables must be declared before use. Declaring a variable means defining its type such as int, long, float, etc., giving it a name and optionally an initial value.This only needs to be done once in the program. Afterwards the value can be changed at any time by calculations or various assignments. &lt;br /&gt;
&lt;br /&gt;
The following example declares &#039;inputVariable&#039; as &#039;int&#039;, i.e. integer data type and sets the initial value to 0. This is called a &#039;simple assignment&#039;. &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A variable can be declared at many places in the program. The location of the declaration determines which program parts have access to the variable. &lt;br /&gt;
&lt;br /&gt;
== Data types ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;byte&amp;lt;/b&amp;gt;: Byte stores an 8-bit numeric, integer value without decimal point. The value can be between 0 and 255.&lt;br /&gt;
&amp;lt;pre&amp;gt;byte someVariable = 180;        // declares &#039;someVariable&lt;br /&gt;
                                    // as a &#039;byte&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;int&amp;lt;/b&amp;gt;: Integers are the most common data type for storing integer values without decimal point. Its value is 16 bits and ranges from -32,767 to 32,768.&lt;br /&gt;
&amp;lt;pre&amp;gt;int someVariable = 1500;       // declares &#039;someVariable&lt;br /&gt;
                                   // as an &#039;integer&#039; data type&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;long&amp;lt;/b&amp;gt;: Data type for long integers with extended size, without decimal point, stored in a 32-bit value in a spectrum from -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
&amp;lt;pre&amp;gt;long someVariable = 90000;    // declares &#039;someVariable&lt;br /&gt;
                                  // as a &#039;long&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;float&amp;lt;/b&amp;gt;: A data type for floating point values or numbers with decimal places. Floating point numbers have a better resolution than integers and are&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; expressed as 32-bit values with a spectrum from -3.4028235E+38 to 3.4028235E+38.&lt;br /&gt;
&amp;lt;pre&amp;gt;float someVariable = 3.14;     // declares &#039;someVariable&#039;&lt;br /&gt;
                                    // as a &#039;float&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Floating point numbers are not precise and may lead to strange results when compared. Also, floating-point calculations are much slower than with integer data types. Calculations with floating-point values should be avoided if possible. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;arrays&amp;lt;/b&amp;gt;: An array is a collection of values that are accessed with an index number.&lt;br /&gt;
Each value in the array can be accessed by retrieving the name of&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; the array and the index number of the value. The index number always starts at 0 for an array.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; An array must be declared and optionally assigned values before it can be used.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[] = {value0, value1, value2...} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the same way it is possible to declare an array first with datatype and size and later to give a value to an index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[5];        // declare datatype &#039;integer&#039; as array with 5 Positions&lt;br /&gt;
myArray[3] = 10;            // gives the 4th index the value 10  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To read the value of an array you can simply assign it to a variable specifying the array and the index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;x = myArray[3];       // x now has the value 10 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arrays are often used for loops, where the counter of the loop is also used as index position for the values in the array. The following example uses an array to make an LED flicker. With a for loop and a counter starting at 0 an index position in the array is read, sent to the LED pin, paused for 200ms and then the same is done with the next index position. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 10; // LED on pin 10&lt;br /&gt;
byte flicker[] = {180, 30, 255, 200, 10, 90, 150, 60};    // array with 8 different values&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);    // Sets the OUTPUT pin&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for(int i=0; i&amp;lt;7; i++)               // loop equals the number&lt;br /&gt;
 { // of the values in the array&lt;br /&gt;
 analogWrite(ledPin, flicker[i]);     // writes the index value to the LED&lt;br /&gt;
 delay(200);                          // 200ms pause&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Digitaler Input - Output ==&lt;br /&gt;
=== pinMode(pin,mode) ===&lt;br /&gt;
Used in &#039;void setup()&#039; to configure a specific pin as either input or output. &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, OUTPUT); // sets &#039;pin&#039; as output &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arduino digital pins are inputs by default, so they don&#039;t need to be specified as inputs with &#039;pinMode()&#039;. Pins configured as inputs have a high impedance state. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: There are also comfortable 20 k &#039;pullup&#039; resistors in the ATmega chip which are accessible via software.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These built-in &#039;pullup&#039; resistors can be accessed in the following way: &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, INPUT);        // sets &#039;pin&#039; as input&lt;br /&gt;
digitalWrite(pin, HIGH);        // switches on the &#039;Pullup&#039; resistor&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pullup resistors are normally used to connect inputs like switches. In the example shown here it is noticeable that the pin is not defined as an output&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; although it is written to. It is only the method to activate the internal &#039;pullup&#039; resistor.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pins configured as output are in a low impedance state and can be loaded with a maximum of 40 mAmpere current from connected elements&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; and circuits. This is enough to make an LED light up (don&#039;t forget the serial resistor), but not enough to drive most relays, solenoids or motors.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Short circuits at the Arduino pins as well as too high current can destroy the output pin or even the whole ATmega chip. For this reason it is a good idea&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; to connect an output pin with external elements in series with a 470 or 1K resistor to&lt;br /&gt;
switch.&lt;br /&gt;
&lt;br /&gt;
=== digitalRead(pin) ===&lt;br /&gt;
digitalRead(pin)&#039; reads the value from a specified digital pin, with the result either HIGH or LOW. The pin can be set either as a variable or constant (0-13). &lt;br /&gt;
&amp;lt;pre&amp;gt;value = digitalRead(Pin);      // sets &#039;value&#039; equal to the input pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
digitalWrite(pin,value)&lt;br /&gt;
Outputs either logic level HIGH or LOW at a specified pin. The pin can be set as a variable or constant (0-13).&lt;br /&gt;
&amp;lt;pre&amp;gt;digitalWrite(pin, HIGH);       // sets &#039;pin&#039; to high&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example reads a button on a digital input and switches an LED on when the button is pressed: &lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 13;            // LED connected to pin 13&lt;br /&gt;
int pin = 7;                 // Button connected to pin 7&lt;br /&gt;
int value = 0;              // Variable to store the readout value&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(led, OUTPUT);    // defines pin 13 as output&lt;br /&gt;
 pinMode(pin, INPUT);     // sets pin 7 as input&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = digitalRead(pin);    // sets &#039;value&#039; equal to&lt;br /&gt;
 // the input pin&lt;br /&gt;
 digitalWrite(led, value);    // sets &#039;led&#039; equal to the&lt;br /&gt;
}                             // Value of the button&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Analoger Input - Output ==&lt;br /&gt;
=== analogRead(pin) ===&lt;br /&gt;
Reads the value of a specified analog pin with a 10 bit resolution. This function is only available for pins (0-5). The resulting integer values have a spectrum from 0 to 1023. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = analogRead(pin);     // sets &#039;value&#039; equal to &#039;pin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Unlike digital pins, analog pins do not have to be declared as input or output first. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analogWrite(pin, value) ===&lt;br /&gt;
Writes pseudo-analog values to an output pin using hardware-based pulse width modulation (PWM). On newer Arduino boards with the ATmega 168 chip this function is applicable to pins 3, 5, 6, 9, 10 and 11. Older Arduinos with the ATmega8 only support pins 9,10 and 11. The value can be set as a variable or constant in the range 0-255.&lt;br /&gt;
&amp;lt;pre&amp;gt;analogWrite(pin, value);     // writes &#039;value&#039; to the analog &#039;pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A value of 0 generates a uniform voltage of 0 volts at a fixed pin; a value of 255 generates a uniform voltage of 5 volts at a fixed pin. For values between 0 and 255, the pin changes very quickly between 0 and 5 volts - the higher the value, the longer the pin is HIGH (5 volts). For a value of 64, the pin is at 0 volts for three-quarters of the time and at 5 volts for one-quarter of the time. A value of 128 means that the output voltage is HIGH half of the time and LOW the other half. A value of 192 means that the voltage at the pin measures 0 volts at one quarter of the time and the full 5 volts at three quarters of the time. &lt;br /&gt;
&lt;br /&gt;
Because this is a hardware-based function, the constant wave runs independently of the program until the next change of state via analogWrite (or a call to digitalRead or digitalWrite on the same pin). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: In contrast to digital pins, analog pins do not have to be declared as input or output before. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The following example reads an analog value from &#039;pin&#039;, converts the value by dividing it by 4 and then outputs it as a PWM signal to &#039;led&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 10;    // LED with 220 resistor at pin 10&lt;br /&gt;
int pin = 0;         // Potentiometer at analog pin 0&lt;br /&gt;
int value;           // Value for readout&lt;br /&gt;
&lt;br /&gt;
void setup(){}      // no setup required&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = analogRead(pin);      // sets &#039;value&#039; equal to &#039;pin&lt;br /&gt;
 value /= 4; // converts 0-1023 into 0-255&lt;br /&gt;
 analogWrite(led, value);     // outputs the PWM signal &#039;led&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Random functions ==&lt;br /&gt;
=== randomSeed(seed) ===&lt;br /&gt;
Sets a value or &#039;Seed&#039; as starting point for the random() function.&lt;br /&gt;
&amp;lt;pre&amp;gt;randomSeed(value);       // sets &#039;value&#039; as the random seed&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Arduino itself is not able to produce a truly random value. With randomSeed() a variable can be used as &#039;seed&#039; to get better random results. For example, millis() or analogRead() can be used as a seed variable or function to use electrical noise through the analog pin as an output for random values. &lt;br /&gt;
&lt;br /&gt;
=== random(min, max) ===&lt;br /&gt;
The random function allows the generation of pseudo-random values within a defined range of minimum and maxium values. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = random(100, 200);        // sets &#039;value&#039; with a random number&lt;br /&gt;
                                     // between 100 and 200 equal &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example generates a random value between 0 and 255 and outputs it as PWM signal on a PWM pin. &lt;br /&gt;
&amp;lt;pre&amp;gt;int randNumber;     // Variable to store the random value&lt;br /&gt;
int led = 10;           // LED with 220 Ohm resistor at pin 10&lt;br /&gt;
&lt;br /&gt;
void setup() {}         // no setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 randomSeed(millis());              // uses millis() as seed&lt;br /&gt;
 randNumber = random(255);          // Random number in the range 0-255&lt;br /&gt;
 analogWrite(led, randNumber);      // PWM signal as output&lt;br /&gt;
 delay(500);                        // half second pause&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Serial communication ==&lt;br /&gt;
=== Serial.begin(rate) ===&lt;br /&gt;
Serial.begin(rate)&#039; Opens the serial port and sets the baud rate for the serial transmission. The typical baud rate with the computer is 9600 baud. Other speeds are also supported.&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);      // opens serial port&lt;br /&gt;
} // sets the data rate to 9600 bps&amp;lt;/pre&amp;gt; &lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: When using serial communication, digital pins 0 (RX) and 1 (TX) cannot be used at the same time. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Serial.println(data) ===&lt;br /&gt;
Writes data to the serial port, followed by an automatic line break as carrier return and line feed. This function has the same form as &#039;Serial.print()&#039;, but is easier to read on the serial monitor. &lt;br /&gt;
&amp;lt;pre&amp;gt;Serial.println(analogValue);         // sends the value of &#039;analogValue&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More detailed information about the numerous variants of the &#039;Serial.println()&#039; and &#039;Serial.print()&#039; functions can be found on the Arduino website. &lt;br /&gt;
&lt;br /&gt;
The following simple example reads a value from analog pin 0 and sends the data to the computer once per second. &lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);                // sets the data rate to 9600 bps&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 Serial.println(analogRead(0));   // sends the analog value&lt;br /&gt;
 delay(1000);                    // pauses for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Digital output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Output.JPG|thumb|none|300px|Arduino-Example-Digital-Output]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a simple &#039;Hello World&#039; program and turns something on and off. In this example a LED is connected to PIN 13 and flashes every second. The resistor may be superfluous at this pin because the Arduino has a built-in resistor. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;            // LED off digital pin 13&lt;br /&gt;
&lt;br /&gt;
void setup()                     // will run through once&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // sets pin 13 as output&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()                      // Running as endless loop&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);    // switches the LED on&lt;br /&gt;
 delay(1000);                   // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);    // switches the LED off&lt;br /&gt;
 delay(1000);                 // Pause for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Digital input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Input.JPG|thumb|none|300px|Arduino-Example-Digital-Input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the simplest form of an input with only two possible states: on or off.&lt;br /&gt;
This example reads out a simple switch or button at pin 2. When the switch is closed and the input pin is HIGH, the LED is turned on. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;               // Output pin for the LED&lt;br /&gt;
int inPin = 2;                     // Input pin for a switch&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);         // declares LED as output&lt;br /&gt;
 pinMode(inPin, INPUT);           // declares switch as input&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
 if (digitalRead(inPin) == HIGH)   // check if this is the HIGH input&lt;br /&gt;
 {&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches the LED on&lt;br /&gt;
 delay(1000);                  // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);   // switches the LED off&lt;br /&gt;
 delay(1000);                // Pause for 1 second&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analog PWM output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pulse width modulation (PWM) is a method of simulating analog outputs by pulsing the output voltage. This allows you to make an LED brighter or darker or check a servomotor later. The following example uses a loop to slowly make an LED brighter and darker. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 9;            // PWM Pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup(){}                  // No setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for (int i=0; i&amp;lt;=255; i++)     // ascending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);        // sets the brightness value to i&lt;br /&gt;
 delay(100);                    // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 for (int i=255; i&amp;gt;=0; i--)     // descending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);       // sets the brightness value to i&lt;br /&gt;
 delay(100);                   // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== potentiometer Input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With a potentiometer and one of the analog-digital converter (ADC) inputs of the Arduino it is possible to read analog values from 0-1024. The following example uses a potentiometer to control the blinking rate of an LED.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int potPin = 0;              // Input pin for the potentiometer&lt;br /&gt;
int ledPin = 13;                 // Output pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // declare ledPin as OUTPUT&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches on ledPin&lt;br /&gt;
 delay(analogRead(potPin));      // pauses the program by the value of potentiometers&lt;br /&gt;
 digitalWrite(ledPin, LOW);      // switches ledPin off&lt;br /&gt;
 delay(analogRead(potPin));     // pauses the program by the value of potentiometers&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR WAN 1300 LoRa]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR LoRa Gateway Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.elektronik-kompendium.de/sites/com/1810231.htm&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://myhomearchiv.synology.me/download/Anleitung_Furduino.pdf&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/arduino-uno/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/category/projekte/arduino-projekte/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.netzmafia.de/skripten/hardware/Arduino/Arduino_Programmierhandbuch.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4529</id>
		<title>Arduino Board Uno Rev3-Atmega 328: Programming Guide</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4529"/>
		<updated>2020-08-10T20:34:34Z</updated>

		<summary type="html">&lt;p&gt;CCinay: /* Serial.println(data) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The Arduino IDE is a cross-platform Java application that acts as a program code editor and compiler and is also able to send firmware serially to the board. The development environment is based on Processing, an IDE designed to program artists, who normally do not have much contact with the art world programming environments. The programming language is based on Wiring, a C similar language which has a similar scope for a more restricted board design, whose IDE is also based on processing. Make sure you have an updated version of [https://www.arduino.cc/en/Main/Software Arduino IDE] installed.&lt;br /&gt;
&lt;br /&gt;
== Struktur ==&lt;br /&gt;
The basic structure of the Arduino programming language is relatively simple and is divided into at least two parts. These two required parts or functions enclose blocks of statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; void setup() {&lt;br /&gt;
    // put your setup code here, to run once:&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
    // put your main code here, to run repeatedly:&lt;br /&gt;
&lt;br /&gt;
} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Here setup() is the preparation and loop() is the execution. Both functions are necessary to execute the program. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup function should follow the variable definition, which must be listed before. Setup must be run through as the first function in a program. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; It is executed only once and is used to set PinMode or to initiate serial communication. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup() function is called once when the program starts. Use this function to set PinModes or start serial communication. The setup() function must &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; appear in every program, even if it does not contain any instructions.  &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; After the setup() function follows the loop() function. It contains program code that is executed continuously in an infinite loop - read inputs, trigger &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; outputs, etc. This function is the core of all Arduino programs and does the main work. &lt;br /&gt;
&lt;br /&gt;
=== setup() ===&lt;br /&gt;
The setup() function is called once when the program starts. Use this function to set PinModes or start serial communication.&lt;br /&gt;
The setup() function must appear in every program, even if it does not contain any instructions. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(pin, OUTPUT);     // &#039;pin&#039; define as output&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== loop() ===&lt;br /&gt;
After running through the setup() function, the loop() function does exactly what its name suggests and runs in an endless loop. This allows the program to interact with the Arduino board via changes, reactions and controls. &lt;br /&gt;
&amp;lt;pre&amp;gt;void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(pin, HIGH);    // switches &#039;pin&#039; on&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
 digitalWrite(pin, LOW);     // switches &#039;pin&#039; off&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
A function is a block of program code that has a name and a set of instructions that are executed when the function is called. The functions void setup() and void loop() have already been explained. There are more built-in functions that will be discussed later. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Type FunctionName(parameter)&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following integer type function &#039;&#039;delayVal()&#039;&#039; is used to insert a delay value into a program by reading a potentiometer. First a local variable &#039;v&#039; is created. Next, &#039;v&#039; is equated with the position of the potentiometer, which can have a value between 0 and 1023. The value is then divided by 4 to get a scale from 0 to 255 and at the end the result of the function is returned to the main program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int delayVal()&lt;br /&gt;
{&lt;br /&gt;
 int v;                     // create temporary variable &#039;v&lt;br /&gt;
 v = analogRead(pot);       // read potentiometer Value&lt;br /&gt;
 v /= 4;                    // Convert from 0-1023 to 0-255&lt;br /&gt;
 return v;                  // return the calculated value&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== {} curly brackets ===&lt;br /&gt;
Curly brackets (also called &#039;curly brackets&#039;) define the start and end of function and statement blocks as in the &#039;void loop()&#039; function and also in the &#039;for&#039; and &#039;if&#039; statement. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type function()&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: An opening curved bracket &#039;{&#039; must always be followed by a closing curved bracket &#039;}&#039;. Here it is often said that the number of brackets must be balanced. Unbalanced parentheses often lead to cryptic, inscrutable errors in the compiler, which are sometimes hard to find, especially in large programs.&lt;br /&gt;
&lt;br /&gt;
The Arduino programming environment helps to check that the curved brackets are balanced. To do this, simply select a brace or click just behind it, and the logically connected counterpart is highlighted. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ;semicolon ===&lt;br /&gt;
A semicolon must be used at the end of a statement and is used to separate the elements of a program.&lt;br /&gt;
A semicolon is also used to separate the elements of a for loop. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int x = 13; // declares variable &#039;x&#039; as integer with value 13&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Forgetting a semicolon at the end of a line leads to an error in the compiler. The error description can be very clear and directly point to the missing semicolon, but this does not have to be the case. If an inscrutable or apparently illogical error is reported, the first thing to do is to add missing semicolons near the reported error. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== /*... */ block comments ===&lt;br /&gt;
Block comments or multiline comments are text areas that are ignored by the program. They are used for longer descriptions or comments and help other authors to understand program parts. They start with /* and end with */ and can cover several lines. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/* This is an inserted block comment&lt;br /&gt;
 please do not forget the closing comment -&lt;br /&gt;
 These must be balanced&lt;br /&gt;
*/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== // Single line comments ===&lt;br /&gt;
Simple single-line comments are defined with a // at the beginning of the line and end with the end of the line. They are ignored by the program and do not consume memory. &lt;br /&gt;
&amp;lt;pre&amp;gt;// this is a single line comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
A variable is the name of a numeric value with a name and memory location for later use in a program. A variable must be declared and optionally provided with a value. The following example declares a variable &#039;inputVariable&#039; and assigns the value of analog pin 2 to it: &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;          // declares a variable and&lt;br /&gt;
                                     // sets its value to 0&lt;br /&gt;
inputVariable = analogRead(2);      // sets the value of the variable equal&lt;br /&gt;
                                    // with the value of analog pin 2 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;inputVariable&#039; is the variable itself. The first line explains that its data type is &#039;int&#039;, which is the short expression for integer. The second line gives the variable the value of the analog pin 2, making the value of the pin available everywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Variables should always have descriptive names as clearly as possible to make the code easier to read.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Declaration of variables: ===&lt;br /&gt;
All variables must be declared before use. Declaring a variable means defining its type such as int, long, float, etc., giving it a name and optionally an initial value.This only needs to be done once in the program. Afterwards the value can be changed at any time by calculations or various assignments. &lt;br /&gt;
&lt;br /&gt;
The following example declares &#039;inputVariable&#039; as &#039;int&#039;, i.e. integer data type and sets the initial value to 0. This is called a &#039;simple assignment&#039;. &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A variable can be declared at many places in the program. The location of the declaration determines which program parts have access to the variable. &lt;br /&gt;
&lt;br /&gt;
== Data types ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;byte&amp;lt;/b&amp;gt;: Byte stores an 8-bit numeric, integer value without decimal point. The value can be between 0 and 255.&lt;br /&gt;
&amp;lt;pre&amp;gt;byte someVariable = 180;        // declares &#039;someVariable&lt;br /&gt;
                                    // as a &#039;byte&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;int&amp;lt;/b&amp;gt;: Integers are the most common data type for storing integer values without decimal point. Its value is 16 bits and ranges from -32,767 to 32,768.&lt;br /&gt;
&amp;lt;pre&amp;gt;int someVariable = 1500;       // declares &#039;someVariable&lt;br /&gt;
                                   // as an &#039;integer&#039; data type&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;long&amp;lt;/b&amp;gt;: Data type for long integers with extended size, without decimal point, stored in a 32-bit value in a spectrum from -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
&amp;lt;pre&amp;gt;long someVariable = 90000;    // declares &#039;someVariable&lt;br /&gt;
                                  // as a &#039;long&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;float&amp;lt;/b&amp;gt;: A data type for floating point values or numbers with decimal places. Floating point numbers have a better resolution than integers and are&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; expressed as 32-bit values with a spectrum from -3.4028235E+38 to 3.4028235E+38.&lt;br /&gt;
&amp;lt;pre&amp;gt;float someVariable = 3.14;     // declares &#039;someVariable&#039;&lt;br /&gt;
                                    // as a &#039;float&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Floating point numbers are not precise and may lead to strange results when compared. Also, floating-point calculations are much slower than with integer data types. Calculations with floating-point values should be avoided if possible. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;arrays&amp;lt;/b&amp;gt;: An array is a collection of values that are accessed with an index number.&lt;br /&gt;
Each value in the array can be accessed by retrieving the name of&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; the array and the index number of the value. The index number always starts at 0 for an array.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; An array must be declared and optionally assigned values before it can be used.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[] = {value0, value1, value2...} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the same way it is possible to declare an array first with datatype and size and later to give a value to an index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[5];        // declare datatype &#039;integer&#039; as array with 5 Positions&lt;br /&gt;
myArray[3] = 10;            // gives the 4th index the value 10  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To read the value of an array you can simply assign it to a variable specifying the array and the index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;x = myArray[3];       // x now has the value 10 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arrays are often used for loops, where the counter of the loop is also used as index position for the values in the array. The following example uses an array to make an LED flicker. With a for loop and a counter starting at 0 an index position in the array is read, sent to the LED pin, paused for 200ms and then the same is done with the next index position. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 10; // LED on pin 10&lt;br /&gt;
byte flicker[] = {180, 30, 255, 200, 10, 90, 150, 60};    // array with 8 different values&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);    // Sets the OUTPUT pin&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for(int i=0; i&amp;lt;7; i++)               // loop equals the number&lt;br /&gt;
 { // of the values in the array&lt;br /&gt;
 analogWrite(ledPin, flicker[i]);     // writes the index value to the LED&lt;br /&gt;
 delay(200);                          // 200ms pause&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Digitaler Input - Output ==&lt;br /&gt;
=== pinMode(pin,mode) ===&lt;br /&gt;
Used in &#039;void setup()&#039; to configure a specific pin as either input or output. &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, OUTPUT); // sets &#039;pin&#039; as output &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arduino digital pins are inputs by default, so they don&#039;t need to be specified as inputs with &#039;pinMode()&#039;. Pins configured as inputs have a high impedance state. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: There are also comfortable 20 k &#039;pullup&#039; resistors in the ATmega chip which are accessible via software.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These built-in &#039;pullup&#039; resistors can be accessed in the following way: &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, INPUT);        // sets &#039;pin&#039; as input&lt;br /&gt;
digitalWrite(pin, HIGH);        // switches on the &#039;Pullup&#039; resistor&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pullup resistors are normally used to connect inputs like switches. In the example shown here it is noticeable that the pin is not defined as an output&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; although it is written to. It is only the method to activate the internal &#039;pullup&#039; resistor.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pins configured as output are in a low impedance state and can be loaded with a maximum of 40 mAmpere current from connected elements&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; and circuits. This is enough to make an LED light up (don&#039;t forget the serial resistor), but not enough to drive most relays, solenoids or motors.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Short circuits at the Arduino pins as well as too high current can destroy the output pin or even the whole ATmega chip. For this reason it is a good idea&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; to connect an output pin with external elements in series with a 470 or 1K resistor to&lt;br /&gt;
switch.&lt;br /&gt;
&lt;br /&gt;
=== digitalRead(pin) ===&lt;br /&gt;
digitalRead(pin)&#039; reads the value from a specified digital pin, with the result either HIGH or LOW. The pin can be set either as a variable or constant (0-13). &lt;br /&gt;
&amp;lt;pre&amp;gt;value = digitalRead(Pin);      // sets &#039;value&#039; equal to the input pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
digitalWrite(pin,value)&lt;br /&gt;
Outputs either logic level HIGH or LOW at a specified pin. The pin can be set as a variable or constant (0-13).&lt;br /&gt;
&amp;lt;pre&amp;gt;digitalWrite(pin, HIGH);       // sets &#039;pin&#039; to high&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example reads a button on a digital input and switches an LED on when the button is pressed: &lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 13;            // LED connected to pin 13&lt;br /&gt;
int pin = 7;                 // Button connected to pin 7&lt;br /&gt;
int value = 0;              // Variable to store the readout value&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(led, OUTPUT);    // defines pin 13 as output&lt;br /&gt;
 pinMode(pin, INPUT);     // sets pin 7 as input&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = digitalRead(pin);    // sets &#039;value&#039; equal to&lt;br /&gt;
 // the input pin&lt;br /&gt;
 digitalWrite(led, value);    // sets &#039;led&#039; equal to the&lt;br /&gt;
}                             // Value of the button&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Analoger Input - Output ==&lt;br /&gt;
=== analogRead(pin) ===&lt;br /&gt;
Reads the value of a specified analog pin with a 10 bit resolution. This function is only available for pins (0-5). The resulting integer values have a spectrum from 0 to 1023. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = analogRead(pin);     // sets &#039;value&#039; equal to &#039;pin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Unlike digital pins, analog pins do not have to be declared as input or output first. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analogWrite(pin, value) ===&lt;br /&gt;
Writes pseudo-analog values to an output pin using hardware-based pulse width modulation (PWM). On newer Arduino boards with the ATmega 168 chip this function is applicable to pins 3, 5, 6, 9, 10 and 11. Older Arduinos with the ATmega8 only support pins 9,10 and 11. The value can be set as a variable or constant in the range 0-255.&lt;br /&gt;
&amp;lt;pre&amp;gt;analogWrite(pin, value);     // writes &#039;value&#039; to the analog &#039;pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A value of 0 generates a uniform voltage of 0 volts at a fixed pin; a value of 255 generates a uniform voltage of 5 volts at a fixed pin. For values between 0 and 255, the pin changes very quickly between 0 and 5 volts - the higher the value, the longer the pin is HIGH (5 volts). For a value of 64, the pin is at 0 volts for three-quarters of the time and at 5 volts for one-quarter of the time. A value of 128 means that the output voltage is HIGH half of the time and LOW the other half. A value of 192 means that the voltage at the pin measures 0 volts at one quarter of the time and the full 5 volts at three quarters of the time. &lt;br /&gt;
&lt;br /&gt;
Because this is a hardware-based function, the constant wave runs independently of the program until the next change of state via analogWrite (or a call to digitalRead or digitalWrite on the same pin). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: In contrast to digital pins, analog pins do not have to be declared as input or output before. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The following example reads an analog value from &#039;pin&#039;, converts the value by dividing it by 4 and then outputs it as a PWM signal to &#039;led&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 10;    // LED with 220 resistor at pin 10&lt;br /&gt;
int pin = 0;         // Potentiometer at analog pin 0&lt;br /&gt;
int value;           // Value for readout&lt;br /&gt;
&lt;br /&gt;
void setup(){}      // no setup required&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = analogRead(pin);      // sets &#039;value&#039; equal to &#039;pin&lt;br /&gt;
 value /= 4; // converts 0-1023 into 0-255&lt;br /&gt;
 analogWrite(led, value);     // outputs the PWM signal &#039;led&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Random functions ==&lt;br /&gt;
=== randomSeed(seed) ===&lt;br /&gt;
Sets a value or &#039;Seed&#039; as starting point for the random() function.&lt;br /&gt;
&amp;lt;pre&amp;gt;randomSeed(value);       // sets &#039;value&#039; as the random seed&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Arduino itself is not able to produce a truly random value. With randomSeed() a variable can be used as &#039;seed&#039; to get better random results. For example, millis() or analogRead() can be used as a seed variable or function to use electrical noise through the analog pin as an output for random values. &lt;br /&gt;
&lt;br /&gt;
=== random(min, max) ===&lt;br /&gt;
The random function allows the generation of pseudo-random values within a defined range of minimum and maxium values. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = random(100, 200);        // sets &#039;value&#039; with a random number&lt;br /&gt;
                                     // between 100 and 200 equal &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example generates a random value between 0 and 255 and outputs it as PWM signal on a PWM pin. &lt;br /&gt;
&amp;lt;pre&amp;gt;int randNumber;   // Variable to store the random value&lt;br /&gt;
int led = 10;          // LED with 220 Ohm resistor at pin 10&lt;br /&gt;
&lt;br /&gt;
void setup() {}        // no setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 randomSeed(millis());              // uses millis() as seed&lt;br /&gt;
 randNumber = random(255);          // Random number in the range 0-255&lt;br /&gt;
 analogWrite(led, randNumber);      // PWM signal as output&lt;br /&gt;
 delay(500);                        // half second pause&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Serial communication ==&lt;br /&gt;
=== Serial.begin(rate) ===&lt;br /&gt;
Serial.begin(rate)&#039; Opens the serial port and sets the baud rate for the serial transmission. The typical baud rate with the computer is 9600 baud. Other speeds are also supported.&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);      // opens serial port&lt;br /&gt;
} // sets the data rate to 9600 bps&amp;lt;/pre&amp;gt; &lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: When using serial communication, digital pins 0 (RX) and 1 (TX) cannot be used at the same time. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Serial.println(data) ===&lt;br /&gt;
Writes data to the serial port, followed by an automatic line break as carrier return and line feed. This function has the same form as &#039;Serial.print()&#039;, but is easier to read on the serial monitor. &lt;br /&gt;
&amp;lt;pre&amp;gt;Serial.println(analogValue);         // sends the value of &#039;analogValue&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More detailed information about the numerous variants of the &#039;Serial.println()&#039; and &#039;Serial.print()&#039; functions can be found on the Arduino website. &lt;br /&gt;
&lt;br /&gt;
The following simple example reads a value from analog pin 0 and sends the data to the computer once per second. &lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);                // sets the data rate to 9600 bps&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 Serial.println(analogRead(0));   // sends the analog value&lt;br /&gt;
 delay(1000);                    // pauses for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Digital output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Output.JPG|thumb|none|300px|Arduino-Example-Digital-Output]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a simple &#039;Hello World&#039; program and turns something on and off. In this example a LED is connected to PIN 13 and flashes every second. The resistor may be superfluous at this pin because the Arduino has a built-in resistor. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;            // LED off digital pin 13&lt;br /&gt;
&lt;br /&gt;
void setup()                     // will run through once&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // sets pin 13 as output&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()                      // Running as endless loop&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);    // switches the LED on&lt;br /&gt;
 delay(1000);                   // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);    // switches the LED off&lt;br /&gt;
 delay(1000);                 // Pause for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Digital input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Input.JPG|thumb|none|300px|Arduino-Example-Digital-Input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the simplest form of an input with only two possible states: on or off.&lt;br /&gt;
This example reads out a simple switch or button at pin 2. When the switch is closed and the input pin is HIGH, the LED is turned on. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;               // Output pin for the LED&lt;br /&gt;
int inPin = 2;                     // Input pin for a switch&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);         // declares LED as output&lt;br /&gt;
 pinMode(inPin, INPUT);           // declares switch as input&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
 if (digitalRead(inPin) == HIGH)   // check if this is the HIGH input&lt;br /&gt;
 {&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches the LED on&lt;br /&gt;
 delay(1000);                  // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);   // switches the LED off&lt;br /&gt;
 delay(1000);                // Pause for 1 second&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analog PWM output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pulse width modulation (PWM) is a method of simulating analog outputs by pulsing the output voltage. This allows you to make an LED brighter or darker or check a servomotor later. The following example uses a loop to slowly make an LED brighter and darker. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 9;            // PWM Pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup(){}                  // No setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for (int i=0; i&amp;lt;=255; i++)     // ascending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);        // sets the brightness value to i&lt;br /&gt;
 delay(100);                    // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 for (int i=255; i&amp;gt;=0; i--)     // descending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);       // sets the brightness value to i&lt;br /&gt;
 delay(100);                   // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== potentiometer Input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With a potentiometer and one of the analog-digital converter (ADC) inputs of the Arduino it is possible to read analog values from 0-1024. The following example uses a potentiometer to control the blinking rate of an LED.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int potPin = 0;              // Input pin for the potentiometer&lt;br /&gt;
int ledPin = 13;                 // Output pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // declare ledPin as OUTPUT&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches on ledPin&lt;br /&gt;
 delay(analogRead(potPin));      // pauses the program by the value of potentiometers&lt;br /&gt;
 digitalWrite(ledPin, LOW);      // switches ledPin off&lt;br /&gt;
 delay(analogRead(potPin));     // pauses the program by the value of potentiometers&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR WAN 1300 LoRa]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR LoRa Gateway Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.elektronik-kompendium.de/sites/com/1810231.htm&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://myhomearchiv.synology.me/download/Anleitung_Furduino.pdf&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/arduino-uno/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/category/projekte/arduino-projekte/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.netzmafia.de/skripten/hardware/Arduino/Arduino_Programmierhandbuch.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4528</id>
		<title>Arduino Board Uno Rev3-Atmega 328: Programming Guide</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_Programming_Guide&amp;diff=4528"/>
		<updated>2020-08-10T20:33:08Z</updated>

		<summary type="html">&lt;p&gt;CCinay: Created page with &amp;quot;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;  == Summary == The Arduino IDE is a cross-platform Java application that acts as a program code editor and compiler and is also able to send fir...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The Arduino IDE is a cross-platform Java application that acts as a program code editor and compiler and is also able to send firmware serially to the board. The development environment is based on Processing, an IDE designed to program artists, who normally do not have much contact with the art world programming environments. The programming language is based on Wiring, a C similar language which has a similar scope for a more restricted board design, whose IDE is also based on processing. Make sure you have an updated version of [https://www.arduino.cc/en/Main/Software Arduino IDE] installed.&lt;br /&gt;
&lt;br /&gt;
== Struktur ==&lt;br /&gt;
The basic structure of the Arduino programming language is relatively simple and is divided into at least two parts. These two required parts or functions enclose blocks of statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; void setup() {&lt;br /&gt;
    // put your setup code here, to run once:&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
    // put your main code here, to run repeatedly:&lt;br /&gt;
&lt;br /&gt;
} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Here setup() is the preparation and loop() is the execution. Both functions are necessary to execute the program. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup function should follow the variable definition, which must be listed before. Setup must be run through as the first function in a program. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; It is executed only once and is used to set PinMode or to initiate serial communication. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup() function is called once when the program starts. Use this function to set PinModes or start serial communication. The setup() function must &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; appear in every program, even if it does not contain any instructions.  &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; After the setup() function follows the loop() function. It contains program code that is executed continuously in an infinite loop - read inputs, trigger &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; outputs, etc. This function is the core of all Arduino programs and does the main work. &lt;br /&gt;
&lt;br /&gt;
=== setup() ===&lt;br /&gt;
The setup() function is called once when the program starts. Use this function to set PinModes or start serial communication.&lt;br /&gt;
The setup() function must appear in every program, even if it does not contain any instructions. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(pin, OUTPUT);     // &#039;pin&#039; define as output&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== loop() ===&lt;br /&gt;
After running through the setup() function, the loop() function does exactly what its name suggests and runs in an endless loop. This allows the program to interact with the Arduino board via changes, reactions and controls. &lt;br /&gt;
&amp;lt;pre&amp;gt;void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(pin, HIGH);    // switches &#039;pin&#039; on&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
 digitalWrite(pin, LOW);     // switches &#039;pin&#039; off&lt;br /&gt;
 delay(1000);                // Pause for one second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
A function is a block of program code that has a name and a set of instructions that are executed when the function is called. The functions void setup() and void loop() have already been explained. There are more built-in functions that will be discussed later. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Type FunctionName(parameter)&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following integer type function &#039;&#039;delayVal()&#039;&#039; is used to insert a delay value into a program by reading a potentiometer. First a local variable &#039;v&#039; is created. Next, &#039;v&#039; is equated with the position of the potentiometer, which can have a value between 0 and 1023. The value is then divided by 4 to get a scale from 0 to 255 and at the end the result of the function is returned to the main program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int delayVal()&lt;br /&gt;
{&lt;br /&gt;
 int v;                     // create temporary variable &#039;v&lt;br /&gt;
 v = analogRead(pot);       // read potentiometer Value&lt;br /&gt;
 v /= 4;                    // Convert from 0-1023 to 0-255&lt;br /&gt;
 return v;                  // return the calculated value&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== {} curly brackets ===&lt;br /&gt;
Curly brackets (also called &#039;curly brackets&#039;) define the start and end of function and statement blocks as in the &#039;void loop()&#039; function and also in the &#039;for&#039; and &#039;if&#039; statement. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type function()&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: An opening curved bracket &#039;{&#039; must always be followed by a closing curved bracket &#039;}&#039;. Here it is often said that the number of brackets must be balanced. Unbalanced parentheses often lead to cryptic, inscrutable errors in the compiler, which are sometimes hard to find, especially in large programs.&lt;br /&gt;
&lt;br /&gt;
The Arduino programming environment helps to check that the curved brackets are balanced. To do this, simply select a brace or click just behind it, and the logically connected counterpart is highlighted. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ;semicolon ===&lt;br /&gt;
A semicolon must be used at the end of a statement and is used to separate the elements of a program.&lt;br /&gt;
A semicolon is also used to separate the elements of a for loop. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int x = 13; // declares variable &#039;x&#039; as integer with value 13&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Forgetting a semicolon at the end of a line leads to an error in the compiler. The error description can be very clear and directly point to the missing semicolon, but this does not have to be the case. If an inscrutable or apparently illogical error is reported, the first thing to do is to add missing semicolons near the reported error. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== /*... */ block comments ===&lt;br /&gt;
Block comments or multiline comments are text areas that are ignored by the program. They are used for longer descriptions or comments and help other authors to understand program parts. They start with /* and end with */ and can cover several lines. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/* This is an inserted block comment&lt;br /&gt;
 please do not forget the closing comment -&lt;br /&gt;
 These must be balanced&lt;br /&gt;
*/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== // Single line comments ===&lt;br /&gt;
Simple single-line comments are defined with a // at the beginning of the line and end with the end of the line. They are ignored by the program and do not consume memory. &lt;br /&gt;
&amp;lt;pre&amp;gt;// this is a single line comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
A variable is the name of a numeric value with a name and memory location for later use in a program. A variable must be declared and optionally provided with a value. The following example declares a variable &#039;inputVariable&#039; and assigns the value of analog pin 2 to it: &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;          // declares a variable and&lt;br /&gt;
                                     // sets its value to 0&lt;br /&gt;
inputVariable = analogRead(2);      // sets the value of the variable equal&lt;br /&gt;
                                    // with the value of analog pin 2 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;inputVariable&#039; is the variable itself. The first line explains that its data type is &#039;int&#039;, which is the short expression for integer. The second line gives the variable the value of the analog pin 2, making the value of the pin available everywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Variables should always have descriptive names as clearly as possible to make the code easier to read.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Declaration of variables: ===&lt;br /&gt;
All variables must be declared before use. Declaring a variable means defining its type such as int, long, float, etc., giving it a name and optionally an initial value.This only needs to be done once in the program. Afterwards the value can be changed at any time by calculations or various assignments. &lt;br /&gt;
&lt;br /&gt;
The following example declares &#039;inputVariable&#039; as &#039;int&#039;, i.e. integer data type and sets the initial value to 0. This is called a &#039;simple assignment&#039;. &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A variable can be declared at many places in the program. The location of the declaration determines which program parts have access to the variable. &lt;br /&gt;
&lt;br /&gt;
== Data types ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;byte&amp;lt;/b&amp;gt;: Byte stores an 8-bit numeric, integer value without decimal point. The value can be between 0 and 255.&lt;br /&gt;
&amp;lt;pre&amp;gt;byte someVariable = 180;        // declares &#039;someVariable&lt;br /&gt;
                                    // as a &#039;byte&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;int&amp;lt;/b&amp;gt;: Integers are the most common data type for storing integer values without decimal point. Its value is 16 bits and ranges from -32,767 to 32,768.&lt;br /&gt;
&amp;lt;pre&amp;gt;int someVariable = 1500;       // declares &#039;someVariable&lt;br /&gt;
                                   // as an &#039;integer&#039; data type&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;long&amp;lt;/b&amp;gt;: Data type for long integers with extended size, without decimal point, stored in a 32-bit value in a spectrum from -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
&amp;lt;pre&amp;gt;long someVariable = 90000;    // declares &#039;someVariable&lt;br /&gt;
                                  // as a &#039;long&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;float&amp;lt;/b&amp;gt;: A data type for floating point values or numbers with decimal places. Floating point numbers have a better resolution than integers and are&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; expressed as 32-bit values with a spectrum from -3.4028235E+38 to 3.4028235E+38.&lt;br /&gt;
&amp;lt;pre&amp;gt;float someVariable = 3.14;     // declares &#039;someVariable&#039;&lt;br /&gt;
                                    // as a &#039;float&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Floating point numbers are not precise and may lead to strange results when compared. Also, floating-point calculations are much slower than with integer data types. Calculations with floating-point values should be avoided if possible. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;arrays&amp;lt;/b&amp;gt;: An array is a collection of values that are accessed with an index number.&lt;br /&gt;
Each value in the array can be accessed by retrieving the name of&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; the array and the index number of the value. The index number always starts at 0 for an array.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; An array must be declared and optionally assigned values before it can be used.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[] = {value0, value1, value2...} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the same way it is possible to declare an array first with datatype and size and later to give a value to an index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;int myArray[5];        // declare datatype &#039;integer&#039; as array with 5 Positions&lt;br /&gt;
myArray[3] = 10;            // gives the 4th index the value 10  &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To read the value of an array you can simply assign it to a variable specifying the array and the index position.&lt;br /&gt;
&amp;lt;pre&amp;gt;x = myArray[3];       // x now has the value 10 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arrays are often used for loops, where the counter of the loop is also used as index position for the values in the array. The following example uses an array to make an LED flicker. With a for loop and a counter starting at 0 an index position in the array is read, sent to the LED pin, paused for 200ms and then the same is done with the next index position. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 10; // LED on pin 10&lt;br /&gt;
byte flicker[] = {180, 30, 255, 200, 10, 90, 150, 60};    // array with 8 different values&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);    // Sets the OUTPUT pin&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for(int i=0; i&amp;lt;7; i++)               // loop equals the number&lt;br /&gt;
 { // of the values in the array&lt;br /&gt;
 analogWrite(ledPin, flicker[i]);     // writes the index value to the LED&lt;br /&gt;
 delay(200);                          // 200ms pause&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Digitaler Input - Output ==&lt;br /&gt;
=== pinMode(pin,mode) ===&lt;br /&gt;
Used in &#039;void setup()&#039; to configure a specific pin as either input or output. &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, OUTPUT); // sets &#039;pin&#039; as output &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arduino digital pins are inputs by default, so they don&#039;t need to be specified as inputs with &#039;pinMode()&#039;. Pins configured as inputs have a high impedance state. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: There are also comfortable 20 k &#039;pullup&#039; resistors in the ATmega chip which are accessible via software.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These built-in &#039;pullup&#039; resistors can be accessed in the following way: &lt;br /&gt;
&amp;lt;pre&amp;gt;pinMode(pin, INPUT);        // sets &#039;pin&#039; as input&lt;br /&gt;
digitalWrite(pin, HIGH);        // switches on the &#039;Pullup&#039; resistor&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pullup resistors are normally used to connect inputs like switches. In the example shown here it is noticeable that the pin is not defined as an output&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; although it is written to. It is only the method to activate the internal &#039;pullup&#039; resistor.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Pins configured as output are in a low impedance state and can be loaded with a maximum of 40 mAmpere current from connected elements&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; and circuits. This is enough to make an LED light up (don&#039;t forget the serial resistor), but not enough to drive most relays, solenoids or motors.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Short circuits at the Arduino pins as well as too high current can destroy the output pin or even the whole ATmega chip. For this reason it is a good idea&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; to connect an output pin with external elements in series with a 470 or 1K resistor to&lt;br /&gt;
switch.&lt;br /&gt;
&lt;br /&gt;
=== digitalRead(pin) ===&lt;br /&gt;
digitalRead(pin)&#039; reads the value from a specified digital pin, with the result either HIGH or LOW. The pin can be set either as a variable or constant (0-13). &lt;br /&gt;
&amp;lt;pre&amp;gt;value = digitalRead(Pin);      // sets &#039;value&#039; equal to the input pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
digitalWrite(pin,value)&lt;br /&gt;
Outputs either logic level HIGH or LOW at a specified pin. The pin can be set as a variable or constant (0-13).&lt;br /&gt;
&amp;lt;pre&amp;gt;digitalWrite(pin, HIGH);       // sets &#039;pin&#039; to high&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example reads a button on a digital input and switches an LED on when the button is pressed: &lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 13;            // LED connected to pin 13&lt;br /&gt;
int pin = 7;                 // Button connected to pin 7&lt;br /&gt;
int value = 0;              // Variable to store the readout value&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(led, OUTPUT);    // defines pin 13 as output&lt;br /&gt;
 pinMode(pin, INPUT);     // sets pin 7 as input&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = digitalRead(pin);    // sets &#039;value&#039; equal to&lt;br /&gt;
 // the input pin&lt;br /&gt;
 digitalWrite(led, value);    // sets &#039;led&#039; equal to the&lt;br /&gt;
}                             // Value of the button&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Analoger Input - Output ==&lt;br /&gt;
=== analogRead(pin) ===&lt;br /&gt;
Reads the value of a specified analog pin with a 10 bit resolution. This function is only available for pins (0-5). The resulting integer values have a spectrum from 0 to 1023. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = analogRead(pin);     // sets &#039;value&#039; equal to &#039;pin&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Unlike digital pins, analog pins do not have to be declared as input or output first. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analogWrite(pin, value) ===&lt;br /&gt;
Writes pseudo-analog values to an output pin using hardware-based pulse width modulation (PWM). On newer Arduino boards with the ATmega 168 chip this function is applicable to pins 3, 5, 6, 9, 10 and 11. Older Arduinos with the ATmega8 only support pins 9,10 and 11. The value can be set as a variable or constant in the range 0-255.&lt;br /&gt;
&amp;lt;pre&amp;gt;analogWrite(pin, value);     // writes &#039;value&#039; to the analog &#039;pin &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A value of 0 generates a uniform voltage of 0 volts at a fixed pin; a value of 255 generates a uniform voltage of 5 volts at a fixed pin. For values between 0 and 255, the pin changes very quickly between 0 and 5 volts - the higher the value, the longer the pin is HIGH (5 volts). For a value of 64, the pin is at 0 volts for three-quarters of the time and at 5 volts for one-quarter of the time. A value of 128 means that the output voltage is HIGH half of the time and LOW the other half. A value of 192 means that the voltage at the pin measures 0 volts at one quarter of the time and the full 5 volts at three quarters of the time. &lt;br /&gt;
&lt;br /&gt;
Because this is a hardware-based function, the constant wave runs independently of the program until the next change of state via analogWrite (or a call to digitalRead or digitalWrite on the same pin). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: In contrast to digital pins, analog pins do not have to be declared as input or output before. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The following example reads an analog value from &#039;pin&#039;, converts the value by dividing it by 4 and then outputs it as a PWM signal to &#039;led&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int led = 10;    // LED with 220 resistor at pin 10&lt;br /&gt;
int pin = 0;         // Potentiometer at analog pin 0&lt;br /&gt;
int value;           // Value for readout&lt;br /&gt;
&lt;br /&gt;
void setup(){}      // no setup required&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 value = analogRead(pin);      // sets &#039;value&#039; equal to &#039;pin&lt;br /&gt;
 value /= 4; // converts 0-1023 into 0-255&lt;br /&gt;
 analogWrite(led, value);     // outputs the PWM signal &#039;led&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Random functions ==&lt;br /&gt;
=== randomSeed(seed) ===&lt;br /&gt;
Sets a value or &#039;Seed&#039; as starting point for the random() function.&lt;br /&gt;
&amp;lt;pre&amp;gt;randomSeed(value);       // sets &#039;value&#039; as the random seed&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Arduino itself is not able to produce a truly random value. With randomSeed() a variable can be used as &#039;seed&#039; to get better random results. For example, millis() or analogRead() can be used as a seed variable or function to use electrical noise through the analog pin as an output for random values. &lt;br /&gt;
&lt;br /&gt;
=== random(min, max) ===&lt;br /&gt;
The random function allows the generation of pseudo-random values within a defined range of minimum and maxium values. &lt;br /&gt;
&amp;lt;pre&amp;gt;value = random(100, 200);        // sets &#039;value&#039; with a random number&lt;br /&gt;
                                     // between 100 and 200 equal &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following example generates a random value between 0 and 255 and outputs it as PWM signal on a PWM pin. &lt;br /&gt;
&amp;lt;pre&amp;gt;int randNumber;   // Variable to store the random value&lt;br /&gt;
int led = 10;          // LED with 220 Ohm resistor at pin 10&lt;br /&gt;
&lt;br /&gt;
void setup() {}        // no setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 randomSeed(millis());              // uses millis() as seed&lt;br /&gt;
 randNumber = random(255);          // Random number in the range 0-255&lt;br /&gt;
 analogWrite(led, randNumber);      // PWM signal as output&lt;br /&gt;
 delay(500);                        // half second pause&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Serial communication ==&lt;br /&gt;
=== Serial.begin(rate) ===&lt;br /&gt;
Serial.begin(rate)&#039; Opens the serial port and sets the baud rate for the serial transmission. The typical baud rate with the computer is 9600 baud. Other speeds are also supported.&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);      // opens serial port&lt;br /&gt;
} // sets the data rate to 9600 bps&amp;lt;/pre&amp;gt; &lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: When using serial communication, digital pins 0 (RX) and 1 (TX) cannot be used at the same time. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Serial.println(data) ===&lt;br /&gt;
Writes data to the serial port, followed by an automatic line break as carrier return and line feed. This function has the same form as &#039;Serial.print()&#039;, but is easier to read on the serial monitor. &lt;br /&gt;
&amp;lt;pre&amp;gt;Serial.println(analogValue);         // sends the value of&lt;br /&gt;
                                         // &#039;analogValue&#039;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More detailed information about the numerous variants of the &#039;Serial.println()&#039; and &#039;Serial.print()&#039; functions can be found on the Arduino website. &lt;br /&gt;
&lt;br /&gt;
The following simple example reads a value from analog pin 0 and sends the data to the computer once per second. &lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 Serial.begin(9600);                // sets the data rate to 9600 bps&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 Serial.println(analogRead(0));   // sends the analog value&lt;br /&gt;
 delay(1000);                    // pauses for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Digital output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Output.JPG|thumb|none|300px|Arduino-Example-Digital-Output]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a simple &#039;Hello World&#039; program and turns something on and off. In this example a LED is connected to PIN 13 and flashes every second. The resistor may be superfluous at this pin because the Arduino has a built-in resistor. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;            // LED off digital pin 13&lt;br /&gt;
&lt;br /&gt;
void setup()                     // will run through once&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // sets pin 13 as output&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()                      // Running as endless loop&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);    // switches the LED on&lt;br /&gt;
 delay(1000);                   // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);    // switches the LED off&lt;br /&gt;
 delay(1000);                 // Pause for 1 second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Digital input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Example-Digital-Input.JPG|thumb|none|300px|Arduino-Example-Digital-Input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the simplest form of an input with only two possible states: on or off.&lt;br /&gt;
This example reads out a simple switch or button at pin 2. When the switch is closed and the input pin is HIGH, the LED is turned on. &lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 13;               // Output pin for the LED&lt;br /&gt;
int inPin = 2;                     // Input pin for a switch&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);         // declares LED as output&lt;br /&gt;
 pinMode(inPin, INPUT);           // declares switch as input&lt;br /&gt;
}&lt;br /&gt;
void loop()&lt;br /&gt;
 if (digitalRead(inPin) == HIGH)   // check if this is the HIGH input&lt;br /&gt;
 {&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches the LED on&lt;br /&gt;
 delay(1000);                  // Pause for 1 second&lt;br /&gt;
 digitalWrite(ledPin, LOW);   // switches the LED off&lt;br /&gt;
 delay(1000);                // Pause for 1 second&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== analog PWM output ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pulse width modulation (PWM) is a method of simulating analog outputs by pulsing the output voltage. This allows you to make an LED brighter or darker or check a servomotor later. The following example uses a loop to slowly make an LED brighter and darker. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int ledPin = 9;            // PWM Pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup(){}                  // No setup necessary&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 for (int i=0; i&amp;lt;=255; i++)     // ascending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);        // sets the brightness value to i&lt;br /&gt;
 delay(100);                    // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 for (int i=255; i&amp;gt;=0; i--)     // descending value for i&lt;br /&gt;
 {&lt;br /&gt;
 analogWrite(ledPin, i);       // sets the brightness value to i&lt;br /&gt;
 delay(100);                   // Pause for 100ms&lt;br /&gt;
 }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== potentiometer Input ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino-Analog-PWM-input.JPG|thumb|none|300px|Arduino-Analog-PWM-input]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With a potentiometer and one of the analog-digital converter (ADC) inputs of the Arduino it is possible to read analog values from 0-1024. The following example uses a potentiometer to control the blinking rate of an LED.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int potPin = 0;              // Input pin for the potentiometer&lt;br /&gt;
int ledPin = 13;                 // Output pin for the LED&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(ledPin, OUTPUT);        // declare ledPin as OUTPUT&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(ledPin, HIGH);     // switches on ledPin&lt;br /&gt;
 delay(analogRead(potPin));      // pauses the program by the value of potentiometers&lt;br /&gt;
 digitalWrite(ledPin, LOW);      // switches ledPin off&lt;br /&gt;
 delay(analogRead(potPin));     // pauses the program by the value of potentiometers&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR WAN 1300 LoRa]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR LoRa Gateway Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.elektronik-kompendium.de/sites/com/1810231.htm&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://myhomearchiv.synology.me/download/Anleitung_Furduino.pdf&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/arduino-uno/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/category/projekte/arduino-projekte/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.netzmafia.de/skripten/hardware/Arduino/Arduino_Programmierhandbuch.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino-Analog-PWM-input.JPG&amp;diff=4527</id>
		<title>File:Arduino-Analog-PWM-input.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino-Analog-PWM-input.JPG&amp;diff=4527"/>
		<updated>2020-08-10T20:20:23Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino-Example-Digital-Input.JPG&amp;diff=4526</id>
		<title>File:Arduino-Example-Digital-Input.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino-Example-Digital-Input.JPG&amp;diff=4526"/>
		<updated>2020-08-10T19:48:15Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino-Example-Digital-Output.JPG&amp;diff=4525</id>
		<title>File:Arduino-Example-Digital-Output.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino-Example-Digital-Output.JPG&amp;diff=4525"/>
		<updated>2020-08-10T19:42:34Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_First_Steps&amp;diff=4524</id>
		<title>Arduino Board Uno Rev3-Atmega 328: First Steps</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_First_Steps&amp;diff=4524"/>
		<updated>2020-08-10T18:47:10Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The Arduino UNO R3 is the current version of the Arduino UNO. This is the standard Arduino. It is completely sufficient for most projects and is very affordable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_oard_Uno_Rev3-Atmega_328.jpg|thumb|none|350px|Arduino_oard_Uno_Rev3-Atmega_328]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arduino UNO Überblick ==&lt;br /&gt;
Main component is a microcontroller from ATMEL, the ATMEGA 328P. It contains the Arduino bootloader software. It allows to execute Arduino programs. The Arduino UNO has 14 digital I/O pins, six of which can be used as PWM channels (allow e.g. dimming of LEDs). Six analog input pins are also available. The board handles communication via UART, SPI and I2C (TWI).&lt;br /&gt;
&lt;br /&gt;
For data exchange and programming it is connected to the computer via USB. Since the microcontroller cannot communicate directly via USB, there is a second microcontroller (ATmega8U2) on the Arduino UNO which does the &amp;quot;translation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Structure of an Arduino UNO ==&lt;br /&gt;
In the following figure the most important components of an Arduino UNO are listed with short descriptions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_oard_Uno_Rev3-Atmega_328-Overview.JPG|thumb|none|750px|Arduino_oard_Uno_Rev3-Atmega_328-Overview]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pin strips on both sides of the Arduino can be used to connect the Arduino to external electronic components or a circuit board using jumper cables:&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;The analog pins A0 to A5&amp;lt;/b&amp;gt; are suitable as &amp;lt;b&amp;gt;sensor inputs for measuring voltage values between 0V and 5V;&amp;lt;/b&amp;gt; a built-in analog-to-digital converter&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; maps the measured voltage values to a numerical range from &amp;lt;b&amp;gt;0 (no voltage) to 1023 (maximum voltage, i.e. 5V)&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;The digital pins 0 to 13&amp;lt;/b&amp;gt; can also be defined as sensor inputs: An applied voltage of &amp;gt;2.5V is interpreted as &amp;lt;b&amp;gt;HIGH (numerical value 1)&amp;lt;/b&amp;gt;, &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; a lower voltage as &amp;lt;b&amp;gt;LOW (numerical value 0)&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;The digital pins 0 to 13&amp;lt;/b&amp;gt; can also be &amp;lt;b&amp;gt;defined as digital voltage outputs&amp;lt;/b&amp;gt;: They output a voltage of about &amp;lt;b&amp;gt;5V in HIGH&amp;lt;/b&amp;gt; mode and &amp;lt;b&amp;gt;0V in LOW mode&amp;lt;/b&amp;gt;. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; However, the &amp;lt;b&amp;gt;current is limited to 40mA&amp;lt;/b&amp;gt;; if necessary, the voltage of the pins is automatically reduced to reach this limit.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; A &amp;lt;b&amp;gt;special feature is the digital pin 13&amp;lt;/b&amp;gt;: There the &amp;lt;b&amp;gt;output current is limited to only 20mA&amp;lt;/b&amp;gt;, so that an &amp;lt;b&amp;gt;LED can be connected there directly&amp;lt;/b&amp;gt; &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; (without series resistor) (directly &amp;lt;b&amp;gt;next to pin 13 is a GND pin&amp;lt;/b&amp;gt;, so that not even a plug-in board is necessary for this). &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; Newer versions of the Arduino UNO even have an SMD LED permanently installed between pin 13 and GND.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;The pins (3, 5, 6, 9, 10, 11)&amp;lt;/b&amp;gt; marked with the tilde &amp;lt;b&amp;gt;character ~ &amp;lt;/b&amp;gt; can, when set as output pins, also switch back and forth &amp;lt;b&amp;gt;between 0V and 5V&amp;lt;/b&amp;gt; very&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; quickly by means of a so-called &amp;lt;b&amp;gt;pulse width modulation (PWM)&amp;lt;/b&amp;gt;.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; You can specify values between &amp;lt;b&amp;gt;0 and 255&amp;lt;/b&amp;gt;, where &amp;lt;b&amp;gt;0 stands for &amp;quot;always off&amp;quot;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;255 for &amp;quot;always on&amp;quot;&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The other connectors on the board (AREF and ICSP headers) are not important for normal use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Notes&amp;lt;/b&amp;gt;: For example, &amp;lt;b&amp;gt;PWM can be used&amp;lt;/b&amp;gt; to drive a motor or a light bulb at a value of 128 with only &amp;lt;b&amp;gt;&amp;quot;half power&amp;quot;&amp;lt;/b&amp;gt;, because it is only supplied with voltage for half of the time and the other half of the time is idle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;An LED can also be &amp;quot;dimmed&amp;quot;&amp;lt;/b&amp;gt; in this way: The LED is fast enough to blink at the same frequency, but our eye is not. As we can only perceive 25 frames per second, an LED that is only on half of the time appears darker to us than a permanently bright LED. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Typical Arduino applications ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Electronics&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Robotics&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Controls&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Sensor data acquisition&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Programming close to the hardware&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR WAN 1300 LoRa]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino MKR LoRa Gateway Pro]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://store.arduino.cc/arduino-uno-rev3&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://starthardware.org/arduino-uno/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://en.wikipedia.org/wiki/Arduino_Uno&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_First_Steps&amp;diff=4523</id>
		<title>Arduino Board Uno Rev3-Atmega 328: First Steps</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Board_Uno_Rev3-Atmega_328:_First_Steps&amp;diff=4523"/>
		<updated>2020-08-10T16:16:20Z</updated>

		<summary type="html">&lt;p&gt;CCinay: Created page with &amp;quot;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;  == Summary == The Arduino UNO R3 is the current version of the Arduino UNO. This is the standard Arduino. It is completely sufficient for most...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The Arduino UNO R3 is the current version of the Arduino UNO. This is the standard Arduino. It is completely sufficient for most projects and is very affordable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_oard_Uno_Rev3-Atmega_328.jpg|thumb|none|500px|Arduino_oard_Uno_Rev3-Atmega_328]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arduino UNO Überblick ==&lt;br /&gt;
Main component is a microcontroller from ATMEL, the ATMEGA 328P. It contains the Arduino bootloader software. It allows to execute Arduino programs. The Arduino UNO has 14 digital I/O pins, six of which can be used as PWM channels (allow e.g. dimming of LEDs). Six analog input pins are also available. The board handles communication via UART, SPI and I2C (TWI).&lt;br /&gt;
&lt;br /&gt;
For data exchange and programming it is connected to the computer via USB. Since the microcontroller cannot communicate directly via USB, there is a second microcontroller (ATmega8U2) on the Arduino UNO which does the &amp;quot;translation&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Structure of an Arduino UNO ==&lt;br /&gt;
In the following figure the most important components of an Arduino UNO are listed with short descriptions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_oard_Uno_Rev3-Atmega_328-Overview.JPG|thumb|none|750px|Arduino_oard_Uno_Rev3-Atmega_328-Overview]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The pin strips on both sides of the Arduino can be used to connect the Arduino to external electronic components or a circuit board using jumper cables:&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;The analog pins A0 to A5&amp;lt;/b&amp;gt; are suitable as &amp;lt;b&amp;gt;sensor inputs for measuring voltage values between 0V and 5V;&amp;lt;/b&amp;gt; a built-in analog-to-digital converter&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; maps the measured voltage values to a numerical range from &amp;lt;b&amp;gt;0 (no voltage) to 1023 (maximum voltage, i.e. 5V)&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;The digital pins 0 to 13&amp;lt;/b&amp;gt; can also be defined as sensor inputs: An applied voltage of &amp;gt;2.5V is interpreted as &amp;lt;b&amp;gt;HIGH (numerical value 1)&amp;lt;/b&amp;gt;, &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; a lower voltage as &amp;lt;b&amp;gt;LOW (numerical value 0)&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;The digital pins 0 to 13&amp;lt;/b&amp;gt; can also be &amp;lt;b&amp;gt;defined as digital voltage outputs&amp;lt;/b&amp;gt;: They output a voltage of about &amp;lt;b&amp;gt;5V in HIGH&amp;lt;/b&amp;gt; mode and &amp;lt;b&amp;gt;0V in LOW mode&amp;lt;/b&amp;gt;. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; However, the &amp;lt;b&amp;gt;current is limited to 40mA&amp;lt;/b&amp;gt;; if necessary, the voltage of the pins is automatically reduced to reach this limit.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; A &amp;lt;b&amp;gt;special feature is the digital pin 13&amp;lt;/b&amp;gt;: There the &amp;lt;b&amp;gt;output current is limited to only 20mA&amp;lt;/b&amp;gt;, so that an &amp;lt;b&amp;gt;LED can be connected there directly&amp;lt;/b&amp;gt; &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; (without series resistor) (directly &amp;lt;b&amp;gt;next to pin 13 is a GND pin&amp;lt;/b&amp;gt;, so that not even a plug-in board is necessary for this). &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; Newer versions of the Arduino UNO even have an SMD LED permanently installed between pin 13 and GND.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;The pins (3, 5, 6, 9, 10, 11)&amp;lt;/b&amp;gt; marked with the tilde &amp;lt;b&amp;gt;character ~ &amp;lt;/b&amp;gt; can, when set as output pins, also switch back and forth &amp;lt;b&amp;gt;between 0V and 5V&amp;lt;/b&amp;gt; very&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; quickly by means of a so-called &amp;lt;b&amp;gt;pulse width modulation (PWM)&amp;lt;/b&amp;gt;.&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; You can specify values between &amp;lt;b&amp;gt;0 and 255&amp;lt;/b&amp;gt;, where &amp;lt;b&amp;gt;0 stands for &amp;quot;always off&amp;quot;&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;255 for &amp;quot;always on&amp;quot;&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The other connectors on the board (AREF and ICSP headers) are not important for normal use.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Notes&amp;lt;/b&amp;gt;: For example, &amp;lt;b&amp;gt;PWM can be used&amp;lt;/b&amp;gt; to drive a motor or a light bulb at a value of 128 with only &amp;lt;b&amp;gt;&amp;quot;half power&amp;quot;&amp;lt;/b&amp;gt;, because it is only supplied with voltage for half of the time and the other half of the time is idle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;An LED can also be &amp;quot;dimmed&amp;quot;&amp;lt;/b&amp;gt; in this way: The LED is fast enough to blink at the same frequency, but our eye is not. As we can only perceive 25 frames per second, an LED that is only on half of the time appears darker to us than a permanently bright LED. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Typical Arduino applications ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Electronics&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Robotics&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Controls&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Sensor data acquisition&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Programming close to the hardware&lt;br /&gt;
&lt;br /&gt;
== Software ==&lt;br /&gt;
The Arduino IDE is a cross-platform Java application that acts as a program code editor and compiler and is also able to send firmware serially to the board. The development environment is based on Processing, an IDE designed to program artists, who normally do not have much contact with the art world programming environments. The programming language is based on Wiring, a C similar language which has a similar scope for a more restricted board design, whose IDE is also based on processing. Make sure you have an updated version of [https://www.arduino.cc/en/Main/Software Arduino IDE] installed.&lt;br /&gt;
&lt;br /&gt;
=== Struktur ===&lt;br /&gt;
The basic structure of the Arduino programming language is relatively simple and is divided into at least two parts. These two required parts or functions enclose blocks of statements.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; void setup() {&lt;br /&gt;
  // put your setup code here, to run once:&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
  // put your main code here, to run repeatedly:&lt;br /&gt;
&lt;br /&gt;
} &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Here setup() is the preparation and loop() is the execution. Both functions are necessary to execute the program. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup function should follow the variable definition, which must be listed before. Setup must be run through as the first function in a program. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; It is executed only once and is used to set PinMode or to initiate serial communication. &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; The setup() function is called once when the program starts. Use this function to set PinModes or start serial communication. The setup() function must &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; appear in every program, even if it does not contain any instructions.  &lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; After the setup() function follows the loop() function. It contains program code that is executed continuously in an infinite loop - read inputs, trigger &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; outputs, etc. This function is the core of all Arduino programs and does the main work. &lt;br /&gt;
&lt;br /&gt;
=== setup() ===&lt;br /&gt;
The setup() function is called once when the program starts. Use this function to set PinModes or start serial communication.&lt;br /&gt;
The setup() function must appear in every program, even if it does not contain any instructions. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;void setup()&lt;br /&gt;
{&lt;br /&gt;
 pinMode(pin, OUTPUT); // &#039;pin&#039; define as output&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== loop() ===&lt;br /&gt;
After running through the setup() function, the loop() function does exactly what its name suggests and runs in an endless loop. This allows the program to interact with the Arduino board via changes, reactions and controls. &lt;br /&gt;
&amp;lt;pre&amp;gt;void loop()&lt;br /&gt;
{&lt;br /&gt;
 digitalWrite(pin, HIGH); // switches &#039;pin&#039; on&lt;br /&gt;
 delay(1000); // Pause for one second&lt;br /&gt;
 digitalWrite(pin, LOW); // switches &#039;pin&#039; off&lt;br /&gt;
 delay(1000); // Pause for one second&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Functions ===&lt;br /&gt;
A function is a block of program code that has a name and a set of instructions that are executed when the function is called. The functions void setup() and void loop() have already been explained. There are more built-in functions that will be discussed later. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Type FunctionName(parameter)&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following integer type function &#039;&#039;delayVal()&#039;&#039; is used to insert a delay value into a program by reading a potentiometer. First a local variable &#039;v&#039; is created. Next, &#039;v&#039; is equated with the position of the potentiometer, which can have a value between 0 and 1023. The value is then divided by 4 to get a scale from 0 to 255 and at the end the result of the function is returned to the main program.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int delayVal()&lt;br /&gt;
{&lt;br /&gt;
 int v; // create temporary variable &#039;v&lt;br /&gt;
 v = analogRead(pot); // read potentiometer Value&lt;br /&gt;
 v /= 4; // Convert from 0-1023 to 0-255&lt;br /&gt;
 return v; // return the calculated value&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== {} curly brackets ===&lt;br /&gt;
Curly brackets (also called &#039;curly brackets&#039;) define the start and end of function and statement blocks as in the &#039;void loop()&#039; function and also in the &#039;for&#039; and &#039;if&#039; statement. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;type function()&lt;br /&gt;
{&lt;br /&gt;
 instructions;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: An opening curved bracket &#039;{&#039; must always be followed by a closing curved bracket &#039;}&#039;. Here it is often said that the number of brackets must be balanced. Unbalanced parentheses often lead to cryptic, inscrutable errors in the compiler, which are sometimes hard to find, especially in large programs.&lt;br /&gt;
&lt;br /&gt;
The Arduino programming environment helps to check that the curved brackets are balanced. To do this, simply select a brace or click just behind it, and the logically connected counterpart is highlighted. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ;semicolon ===&lt;br /&gt;
A semicolon must be used at the end of a statement and is used to separate the elements of a program.&lt;br /&gt;
A semicolon is also used to separate the elements of a for loop. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int x = 13; // declares variable &#039;x&#039; as integer with value 13&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Remark&amp;lt;/b&amp;gt;: Forgetting a semicolon at the end of a line leads to an error in the compiler. The error description can be very clear and directly point to the missing semicolon, but this does not have to be the case. If an inscrutable or apparently illogical error is reported, the first thing to do is to add missing semicolons near the reported error. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== /*... */ block comments ===&lt;br /&gt;
Block comments or multiline comments are text areas that are ignored by the program. They are used for longer descriptions or comments and help other authors to understand program parts. They start with /* and end with */ and can cover several lines. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/* This is an inserted block comment&lt;br /&gt;
 please do not forget the closing comment -&lt;br /&gt;
 These must be balanced&lt;br /&gt;
*/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== // Single line comments ===&lt;br /&gt;
Simple single-line comments are defined with a // at the beginning of the line and end with the end of the line. They are ignored by the program and do not consume memory. &lt;br /&gt;
&amp;lt;pre&amp;gt;// this is a single line comment&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Variablen ===&lt;br /&gt;
A variable is the name of a numeric value with a name and memory location for later use in a program. A variable must be declared and optionally provided with a value. The following example declares a variable &#039;inputVariable&#039; and assigns the value of analog pin 2 to it: &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;       // declares a variable and&lt;br /&gt;
                                 // sets its value to 0&lt;br /&gt;
inputVariable = analogRead(2);  // sets the value of the variable equal&lt;br /&gt;
                                // with the value of analog pin 2 &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;inputVariable&#039; is the variable itself. The first line explains that its data type is &#039;int&#039;, which is the short expression for integer. The second line gives the variable the value of the analog pin 2, making the value of the pin available everywhere in the code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Variables should always have descriptive names as clearly as possible to make the code easier to read.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Declaration of variables: ===&lt;br /&gt;
All variables must be declared before use. Declaring a variable means defining its type such as int, long, float, etc., giving it a name and optionally an initial value.This only needs to be done once in the program. Afterwards the value can be changed at any time by calculations or various assignments. &lt;br /&gt;
&lt;br /&gt;
The following example declares &#039;inputVariable&#039; as &#039;int&#039;, i.e. integer data type and sets the initial value to 0. This is called a &#039;simple assignment&#039;. &lt;br /&gt;
&amp;lt;pre&amp;gt;int inputVariable = 0;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A variable can be declared at many places in the program. The location of the declaration determines which program parts have access to the variable. &lt;br /&gt;
&lt;br /&gt;
=== Data types ===&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;byte&amp;lt;/b&amp;gt;: Byte stores an 8-bit numeric, integer value without decimal point. The value can be between 0 and 255.&lt;br /&gt;
&amp;lt;pre&amp;gt;byte someVariable = 180;  // declares &#039;someVariable&lt;br /&gt;
                         // as a &#039;byte&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;int&amp;lt;/b&amp;gt;: Integers are the most common data type for storing integer values without decimal point. Its value is 16 bits and ranges from -32,767 to 32,768.&lt;br /&gt;
&amp;lt;pre&amp;gt;int someVariable = 1500;  // declares &#039;someVariable&lt;br /&gt;
                         // as an &#039;integer&#039; data type&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;long&amp;lt;/b&amp;gt;: Data type for long integers with extended size, without decimal point, stored in a 32-bit value in a spectrum from -2,147,483,648 to 2,147,483,647 &lt;br /&gt;
&amp;lt;pre&amp;gt;long someVariable = 90000;  // declares &#039;someVariable&lt;br /&gt;
                           // as a &#039;long&#039; data type &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;float&amp;lt;/b&amp;gt;: A data type for floating point values or numbers with decimal places. Floating point numbers have a better resolution than integers and are expressed as 32-bit values with a spectrum from -3.4028235E+38 to 3.4028235E+38.&lt;br /&gt;
&amp;lt;pre&amp;gt;float someVariable = 3.14;  // deklariert &#039;someVariable&#039;&lt;br /&gt;
                           // als einen &#039;float&#039; Datentyp &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Floating point numbers are not precise and may lead to strange results when compared. Also, floating-point calculations are much slower than with integer data types. Calculations with floating-point values should be avoided if possible. &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; &amp;lt;b&amp;gt;arrays&amp;lt;/b&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_oard_Uno_Rev3-Atmega_328.jpg&amp;diff=4522</id>
		<title>File:Arduino oard Uno Rev3-Atmega 328.jpg</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_oard_Uno_Rev3-Atmega_328.jpg&amp;diff=4522"/>
		<updated>2020-08-10T14:13:39Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_oard_Uno_Rev3-Atmega_328-Overview.JPG&amp;diff=4521</id>
		<title>File:Arduino oard Uno Rev3-Atmega 328-Overview.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_oard_Uno_Rev3-Atmega_328-Overview.JPG&amp;diff=4521"/>
		<updated>2020-08-10T13:43:01Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Wireless_SD_Shield_Tutorial:_First_Steps&amp;diff=4520</id>
		<title>Arduino Wireless SD Shield Tutorial: First Steps</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Wireless_SD_Shield_Tutorial:_First_Steps&amp;diff=4520"/>
		<updated>2020-08-10T11:40:01Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&amp;lt;b&amp;gt;The Wireless Proto Shield for Arduino&amp;lt;/b&amp;gt; is an Arduino Shield that provides wireless communication capabilities to an Arduino board. For this purpose, a chip for wireless communication is attached to the shield. This Wireless Proto Shield is &amp;lt;b&amp;gt;based on Digi&#039;s Xbee module&amp;lt;/b&amp;gt;, but can be used by any model of the same size. The module can communicate &amp;lt;b&amp;gt;indoors at a distance of up to 30 metres&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;outdoors at a distance of up to 90 metres&amp;lt;/b&amp;gt; (without obstacle). &lt;br /&gt;
The module can be used as a replacement for a USB-to-serial adapter or configured in control mode for a wide range of networking options.&lt;br /&gt;
&lt;br /&gt;
The Wireless Proto Shield for Arduino has no SD socket.&lt;br /&gt;
&lt;br /&gt;
An integrated switch on the shield allows the wireless module (Xbee chip) to communicate with the USB to serial converter or the microcontroller.&lt;br /&gt;
To learn more about the WireLess Proto Shield, see the product data sheet on the Arduino website: [http://arduino.cc/en/Main/ArduinoWirelessProtoShield ArduinoWirelessProtoShield]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_Wireless_SD_Shield_Tutorial.jpg|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
As the name implies, the Arduino Wireless SD shield serves &amp;lt;b&amp;gt;two functions&amp;lt;/b&amp;gt;. &amp;lt;b&amp;gt;Foremost&amp;lt;/b&amp;gt;, this shield allows you to easily &amp;lt;b&amp;gt;interface with Xbee transceiver modules&amp;lt;/b&amp;gt; to create mesh networks, and &amp;lt;b&amp;gt;other wireless devices&amp;lt;/b&amp;gt;. &amp;lt;b&amp;gt;Secondly&amp;lt;/b&amp;gt;, the micro SD socket allows you to &amp;lt;b&amp;gt;store and access a large amount of data&amp;lt;/b&amp;gt;. Whether using these functions by on their own or together, this chip greatly enhances the capabilities of a standard Arduino. &lt;br /&gt;
The best part about this shield is how easy it is to use. In no time flat, you can have its various components up and running.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Plug in the Xbee ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_Wireless_SD_Shield_Tutorial-Step1.jpg|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step1]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;1. Plug in your Xbee modules in order to use the shield as a wireless transceiver.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;2. Make sure the module&#039;s pointy end is lined up with the edge of the board.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;3. If you are using the shield for wireless data transfer, you will need two or more of them.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Plug It In ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_Wireless_SD_Shield_Tutorial-Step2.jpg|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step2]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Plug your shields into your Arduinos.&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Features ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_Wireless_SD_Shield_Tutorial-Step3.JPG|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step3]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;1. The wireless SD shield supports [https://www.digi.com/products/embedded-systems/digi-xbee/rf-modules/2-4-ghz-rf-modules/xbee-zigbee#overview Xbee modules]. These modules allow for easy wireless serial communication. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp;A standard module has the range of 100 - 300 feet.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;2. It also boasts a micro SD socket. This can easily be interfaced with the [https://www.arduino.cc/en/Reference/SD Arduino SD library]. Unfortunately, this library&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; does not come bundled with the Arduino development environment, so you will have to set it up yourself.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;3. The shield also boasts a perfboard grid for prototyping your own circuit, and a micro switch for toggling between the USB port and micro SD port.&lt;br /&gt;
&lt;br /&gt;
=== Step 4: Program the Receiver ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_Wireless_SD_Shield_Tutorial-Step4.JPG|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step4]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Plug one of the Arduinos into the computer. Make certain the micro switch is toggled to the &amp;quot;USB&amp;quot; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Upload the following code:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;//Xbee receiver&lt;br /&gt;
&lt;br /&gt;
int sentDat;&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
  Serial.begin(9600);   &lt;br /&gt;
  pinMode(2, OUTPUT); &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
  if (Serial.available() &amp;gt; 0) {&lt;br /&gt;
	sentDat = Serial.read(); &lt;br /&gt;
&lt;br /&gt;
	if(sentDat == &#039;h&#039;){&lt;br /&gt;
          //activate the pumpkin for one second and then stop&lt;br /&gt;
  	  digitalWrite(2, HIGH);&lt;br /&gt;
          delay(1000);&lt;br /&gt;
          digitalWrite(2, LOW);&lt;br /&gt;
	}&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 5: Setup the Receiver ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_Wireless_SD_Shield_Tutorial-Step5.JPG|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step5]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;1. Unplug the Arduino from the computer. Toggle the micro switch from &amp;quot;USB&amp;quot; to &amp;quot;MICRO&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;2. Plug the red wire from a 9V battery connector into the Vin pin. Plug the black wire into the GND pin.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;3. Connect the positive leg of an LED to pin D2 and the other leg in series with a 220 ohm resistor to ground.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;4. Plug in your battery.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;5. It is now a standalone receiver.&lt;br /&gt;
&lt;br /&gt;
=== Step 6: Program the Transmitter ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino Wireless SD Shield Tutorial-Step6.JPG|thumb|none|500px|Arduino Wireless SD Shield Tutorial-Step6]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;1. Plug in the Arduino for the transmitter. Make certain the micro switch is toggled to the &amp;quot;USB&amp;quot; option.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;2. Before you upload any code to the Arduino, open the serial monitor. Type in &amp;quot;h&amp;quot; and hit the &amp;quot;send&amp;quot; button. &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp;The LED on your receiver should light up. You have made a wireless connection!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;amp;emsp;3. Now upload the following code:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;/*&lt;br /&gt;
  &lt;br /&gt;
  Wireless transmitter demo  &lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
  Based on Button example code&lt;br /&gt;
  http://www.arduino.cc/en/Tutorial/Button&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 The circuit:&lt;br /&gt;
 * pushbutton attached to pin 2 from +5V&lt;br /&gt;
 * 10K resistor attached to pin 2 from ground&lt;br /&gt;
 &lt;br /&gt;
 This code is in the public domain.&lt;br /&gt;
 &lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// constants won&#039;t change. They&#039;re used here to &lt;br /&gt;
// set pin numbers:&lt;br /&gt;
const int buttonPin = 2;     // the number of the pushbutton pin&lt;br /&gt;
&lt;br /&gt;
// variables will change:&lt;br /&gt;
int buttonState = 0;         // variable for reading the pushbutton status&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
  // initialize serial communication:&lt;br /&gt;
  Serial.begin(9600); &lt;br /&gt;
     &lt;br /&gt;
  // initialize the pushbutton pin as an input:&lt;br /&gt;
  pinMode(buttonPin, INPUT);     &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
  // read the state of the pushbutton value:&lt;br /&gt;
  buttonState = digitalRead(buttonPin);&lt;br /&gt;
&lt;br /&gt;
  // check if the pushbutton is pressed.&lt;br /&gt;
  // if it is, the buttonState is HIGH:&lt;br /&gt;
  if (buttonState == HIGH) {     &lt;br /&gt;
    //transmit a High command to the pumpkin and delay a second so that it does not receive more than one command&lt;br /&gt;
    //per button press&lt;br /&gt;
    Serial.println(&#039;h&#039;);&lt;br /&gt;
    delay(1000); &lt;br /&gt;
  } &lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 7: Setup the Transmitter ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_Wireless_SD_Shield_Tutorial-Step7.JPG|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step7]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;1. Unplug the Arduino from the computer. Toggle the micro switch from &amp;quot;USB&amp;quot; to &amp;quot;MICRO&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;2. Plug the red wire from a 9V battery connector into the Vin pin. Plug the black wire into the GND pin.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;3. Connect a 10K resistor between pin D2 and ground. Also connect a push button switch between pin D2 and 5v.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;4. Plug in your battery.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;5. It is now a standalone transmitter.&lt;br /&gt;
&lt;br /&gt;
=== Step 8: Prepare the SD Card ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;:&lt;br /&gt;
Before you can use the micro SD card, it needs to be formatted to either FAT16 or FAT32.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino Wireless SD Shield Tutorial-Step8.JPG|thumb|none|500px|Arduino Wireless SD Shield Tutorial-Step8]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;On Windows:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Open &amp;quot;My Computer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Right-click on the disk and select &amp;quot;Format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Select &amp;quot;FAT&amp;quot; and click &amp;quot;start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; It is now formatted to FAT16&lt;br /&gt;
&lt;br /&gt;
Once the disk is formatted, the next thing you have to do is make sure that you have the [https://github.com/adafruit/SD SD Card Library]. For instructions on how to setup the library, check out the bottom of Adafruit&#039;s extremely thorough [http://www.ladyada.net/products/microsd/ micro SD card tutorial].&lt;br /&gt;
&lt;br /&gt;
Plug the SD card into the socket on the shield.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;To test the SD card, plug the Arduino into the computer and upload the following code:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/*&lt;br /&gt;
  SD card read/write&lt;br /&gt;
 &lt;br /&gt;
 This example shows how to read and write data to and from an SD card file 	&lt;br /&gt;
 The circuit:&lt;br /&gt;
 * SD card attached to SPI bus as follows:&lt;br /&gt;
 ** MOSI - pin 11&lt;br /&gt;
 ** MISO - pin 12&lt;br /&gt;
 ** CLK - pin 13&lt;br /&gt;
 ** CS - pin 4&lt;br /&gt;
 &lt;br /&gt;
 	 &lt;br /&gt;
 */&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;SD.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
File myFile;&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  Serial.begin(9600);&lt;br /&gt;
  Serial.print(&amp;quot;Initializing SD card...&amp;quot;);&lt;br /&gt;
  // On the Ethernet Shield, CS is pin 4. It&#039;s set as an output by default.&lt;br /&gt;
  // Note that even if it&#039;s not used as the CS pin, the hardware SS pin &lt;br /&gt;
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output &lt;br /&gt;
  // or the SD library functions will not work. &lt;br /&gt;
   pinMode(10, OUTPUT);&lt;br /&gt;
   &lt;br /&gt;
  if (!SD.begin(4)) {&lt;br /&gt;
    Serial.println(&amp;quot;initialization failed!&amp;quot;);&lt;br /&gt;
    return;&lt;br /&gt;
  }&lt;br /&gt;
  Serial.println(&amp;quot;initialization done.&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  // open the file. note that only one file can be open at a time,&lt;br /&gt;
  // so you have to close this one before opening another.&lt;br /&gt;
  myFile = SD.open(&amp;quot;test.txt&amp;quot;, FILE_WRITE);&lt;br /&gt;
  &lt;br /&gt;
  // if the file opened okay, write to it:&lt;br /&gt;
  if (myFile) {&lt;br /&gt;
    Serial.print(&amp;quot;Writing to test.txt...&amp;quot;);&lt;br /&gt;
    myFile.println(&amp;quot;testing 1, 2, 3.&amp;quot;);&lt;br /&gt;
	// close the file:&lt;br /&gt;
    myFile.close();&lt;br /&gt;
    Serial.println(&amp;quot;done.&amp;quot;);&lt;br /&gt;
  } else {&lt;br /&gt;
    // if the file didn&#039;t open, print an error:&lt;br /&gt;
    Serial.println(&amp;quot;error opening test.txt&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  // re-open the file for reading:&lt;br /&gt;
  myFile = SD.open(&amp;quot;test.txt&amp;quot;);&lt;br /&gt;
  if (myFile) {&lt;br /&gt;
    Serial.println(&amp;quot;test.txt:&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    // read from the file until there&#039;s nothing else in it:&lt;br /&gt;
    while (myFile.available()) {&lt;br /&gt;
    	Serial.write(myFile.read());&lt;br /&gt;
    }&lt;br /&gt;
    // close the file:&lt;br /&gt;
    myFile.close();&lt;br /&gt;
  } else {&lt;br /&gt;
  	// if the file didn&#039;t open, print an error:&lt;br /&gt;
    Serial.println(&amp;quot;error opening test.txt&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
	// nothing happens after setup&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Arduino Board Uno Rev3 DIP Version, ATmega328, USB]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://forum.arduino.cc/index.php?board=63.0&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.arduino.cc/en/Reference/SD&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://store.arduino.cc/arduino-wireless-proto-shield&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://store.arduino.cc/arduino-wireless-proto-shield&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.ladyada.net/products/microsd/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://github.com/adafruit/SD&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Wireless_SD_Shield_Tutorial:_First_Steps&amp;diff=4519</id>
		<title>Arduino Wireless SD Shield Tutorial: First Steps</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Wireless_SD_Shield_Tutorial:_First_Steps&amp;diff=4519"/>
		<updated>2020-08-10T11:21:35Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&amp;lt;b&amp;gt;The Wireless Proto Shield for Arduino&amp;lt;/b&amp;gt; is an Arduino Shield that provides wireless communication capabilities to an Arduino board. For this purpose, a chip for wireless communication is attached to the shield. This Wireless Proto Shield is &amp;lt;b&amp;gt;based on Digi&#039;s Xbee module&amp;lt;/b&amp;gt;, but can be used by any model of the same size. The module can communicate &amp;lt;b&amp;gt;indoors at a distance of up to 30 metres&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;outdoors at a distance of up to 90 metres&amp;lt;/b&amp;gt; (without obstacle). &lt;br /&gt;
The module can be used as a replacement for a USB-to-serial adapter or configured in control mode for a wide range of networking options.&lt;br /&gt;
&lt;br /&gt;
The Wireless Proto Shield for Arduino has no SD socket.&lt;br /&gt;
&lt;br /&gt;
An integrated switch on the shield allows the wireless module (Xbee chip) to communicate with the USB to serial converter or the microcontroller.&lt;br /&gt;
To learn more about the WireLess Proto Shield, see the product data sheet on the Arduino website: [http://arduino.cc/en/Main/ArduinoWirelessProtoShield ArduinoWirelessProtoShield]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_Wireless_SD_Shield_Tutorial.jpg|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
As the name implies, the Arduino Wireless SD shield serves &amp;lt;b&amp;gt;two functions&amp;lt;/b&amp;gt;. &amp;lt;b&amp;gt;Foremost&amp;lt;/b&amp;gt;, this shield allows you to easily &amp;lt;b&amp;gt;interface with Xbee transceiver modules&amp;lt;/b&amp;gt; to create mesh networks, and &amp;lt;b&amp;gt;other wireless devices&amp;lt;/b&amp;gt;. &amp;lt;b&amp;gt;Secondly&amp;lt;/b&amp;gt;, the micro SD socket allows you to &amp;lt;b&amp;gt;store and access a large amount of data&amp;lt;/b&amp;gt;. Whether using these functions by on their own or together, this chip greatly enhances the capabilities of a standard Arduino. &lt;br /&gt;
The best part about this shield is how easy it is to use. In no time flat, you can have its various components up and running.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Plug in the Xbee ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_Wireless_SD_Shield_Tutorial-Step1.jpg|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step1]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;1. Plug in your Xbee modules in order to use the shield as a wireless transceiver.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;2. Make sure the module&#039;s pointy end is lined up with the edge of the board.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;3. If you are using the shield for wireless data transfer, you will need two or more of them.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Plug It In ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_Wireless_SD_Shield_Tutorial-Step2.jpg|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step2]]&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Plug your shields into your Arduinos.&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Features ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_Wireless_SD_Shield_Tutorial-Step3.JPG|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step3]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;1. The wireless SD shield supports [https://www.digi.com/products/embedded-systems/digi-xbee/rf-modules/2-4-ghz-rf-modules/xbee-zigbee#overview Xbee modules]. These modules allow for easy wireless serial communication. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp;A standard module has the range of 100 - 300 feet.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;2. It also boasts a micro SD socket. This can easily be interfaced with the [https://www.arduino.cc/en/Reference/SD Arduino SD library]. Unfortunately, this library&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; does not come bundled with the Arduino development environment, so you will have to set it up yourself.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;3. The shield also boasts a perfboard grid for prototyping your own circuit, and a micro switch for toggling between the USB port and micro SD port.&lt;br /&gt;
&lt;br /&gt;
=== Step 4: Program the Receiver ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_Wireless_SD_Shield_Tutorial-Step4.JPG|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step4]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Plug one of the Arduinos into the computer. Make certain the micro switch is toggled to the &amp;quot;USB&amp;quot; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Upload the following code:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;//Xbee receiver&lt;br /&gt;
&lt;br /&gt;
int sentDat;&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
  Serial.begin(9600);   &lt;br /&gt;
  pinMode(2, OUTPUT); &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
  if (Serial.available() &amp;gt; 0) {&lt;br /&gt;
	sentDat = Serial.read(); &lt;br /&gt;
&lt;br /&gt;
	if(sentDat == &#039;h&#039;){&lt;br /&gt;
          //activate the pumpkin for one second and then stop&lt;br /&gt;
  	  digitalWrite(2, HIGH);&lt;br /&gt;
          delay(1000);&lt;br /&gt;
          digitalWrite(2, LOW);&lt;br /&gt;
	}&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 5: Setup the Receiver ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_Wireless_SD_Shield_Tutorial-Step5.JPG|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step5]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;1. Unplug the Arduino from the computer. Toggle the micro switch from &amp;quot;USB&amp;quot; to &amp;quot;MICRO&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;2. Plug the red wire from a 9V battery connector into the Vin pin. Plug the black wire into the GND pin.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;3. Connect the positive leg of an LED to pin D2 and the other leg in series with a 220 ohm resistor to ground.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;4. Plug in your battery.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;5. It is now a standalone receiver.&lt;br /&gt;
&lt;br /&gt;
=== Step 6: Program the Transmitter ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino Wireless SD Shield Tutorial-Step6.JPG|thumb|none|500px|Arduino Wireless SD Shield Tutorial-Step6]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;1. Plug in the Arduino for the transmitter. Make certain the micro switch is toggled to the &amp;quot;USB&amp;quot; option.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;2. Before you upload any code to the Arduino, open the serial monitor. Type in &amp;quot;h&amp;quot; and hit the &amp;quot;send&amp;quot; button. &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp;The LED on your receiver should light up. You have made a wireless connection!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;amp;emsp;3. Now upload the following code:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;/*&lt;br /&gt;
  &lt;br /&gt;
  Wireless transmitter demo  &lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
  Based on Button example code&lt;br /&gt;
  http://www.arduino.cc/en/Tutorial/Button&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 The circuit:&lt;br /&gt;
 * pushbutton attached to pin 2 from +5V&lt;br /&gt;
 * 10K resistor attached to pin 2 from ground&lt;br /&gt;
 &lt;br /&gt;
 This code is in the public domain.&lt;br /&gt;
 &lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// constants won&#039;t change. They&#039;re used here to &lt;br /&gt;
// set pin numbers:&lt;br /&gt;
const int buttonPin = 2;     // the number of the pushbutton pin&lt;br /&gt;
&lt;br /&gt;
// variables will change:&lt;br /&gt;
int buttonState = 0;         // variable for reading the pushbutton status&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
  // initialize serial communication:&lt;br /&gt;
  Serial.begin(9600); &lt;br /&gt;
     &lt;br /&gt;
  // initialize the pushbutton pin as an input:&lt;br /&gt;
  pinMode(buttonPin, INPUT);     &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
  // read the state of the pushbutton value:&lt;br /&gt;
  buttonState = digitalRead(buttonPin);&lt;br /&gt;
&lt;br /&gt;
  // check if the pushbutton is pressed.&lt;br /&gt;
  // if it is, the buttonState is HIGH:&lt;br /&gt;
  if (buttonState == HIGH) {     &lt;br /&gt;
    //transmit a High command to the pumpkin and delay a second so that it does not receive more than one command&lt;br /&gt;
    //per button press&lt;br /&gt;
    Serial.println(&#039;h&#039;);&lt;br /&gt;
    delay(1000); &lt;br /&gt;
  } &lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 7: Setup the Transmitter ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino_Wireless_SD_Shield_Tutorial-Step7.JPG|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step7]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;1. Unplug the Arduino from the computer. Toggle the micro switch from &amp;quot;USB&amp;quot; to &amp;quot;MICRO&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;2. Plug the red wire from a 9V battery connector into the Vin pin. Plug the black wire into the GND pin.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;3. Connect a 10K resistor between pin D2 and ground. Also connect a push button switch between pin D2 and 5v.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;4. Plug in your battery.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;5. It is now a standalone transmitter.&lt;br /&gt;
&lt;br /&gt;
=== Step 8: Prepare the SD Card ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;:&lt;br /&gt;
Before you can use the micro SD card, it needs to be formatted to either FAT16 or FAT32.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Arduino Wireless SD Shield Tutorial-Step8.JPG|thumb|none|500px|Arduino Wireless SD Shield Tutorial-Step8]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;On Windows:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Open &amp;quot;My Computer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Right-click on the disk and select &amp;quot;Format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Select &amp;quot;FAT&amp;quot; and click &amp;quot;start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; It is now formatted to FAT16&lt;br /&gt;
&lt;br /&gt;
Once the disk is formatted, the next thing you have to do is make sure that you have the [https://github.com/adafruit/SD SD Card Library]. For instructions on how to setup the library, check out the bottom of Adafruit&#039;s extremely thorough [http://www.ladyada.net/products/microsd/ micro SD card tutorial].&lt;br /&gt;
&lt;br /&gt;
Plug the SD card into the socket on the shield.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;To test the SD card, plug the Arduino into the computer and upload the following code:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/*&lt;br /&gt;
  SD card read/write&lt;br /&gt;
 &lt;br /&gt;
 This example shows how to read and write data to and from an SD card file 	&lt;br /&gt;
 The circuit:&lt;br /&gt;
 * SD card attached to SPI bus as follows:&lt;br /&gt;
 ** MOSI - pin 11&lt;br /&gt;
 ** MISO - pin 12&lt;br /&gt;
 ** CLK - pin 13&lt;br /&gt;
 ** CS - pin 4&lt;br /&gt;
 &lt;br /&gt;
 	 &lt;br /&gt;
 */&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;SD.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
File myFile;&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  Serial.begin(9600);&lt;br /&gt;
  Serial.print(&amp;quot;Initializing SD card...&amp;quot;);&lt;br /&gt;
  // On the Ethernet Shield, CS is pin 4. It&#039;s set as an output by default.&lt;br /&gt;
  // Note that even if it&#039;s not used as the CS pin, the hardware SS pin &lt;br /&gt;
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output &lt;br /&gt;
  // or the SD library functions will not work. &lt;br /&gt;
   pinMode(10, OUTPUT);&lt;br /&gt;
   &lt;br /&gt;
  if (!SD.begin(4)) {&lt;br /&gt;
    Serial.println(&amp;quot;initialization failed!&amp;quot;);&lt;br /&gt;
    return;&lt;br /&gt;
  }&lt;br /&gt;
  Serial.println(&amp;quot;initialization done.&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  // open the file. note that only one file can be open at a time,&lt;br /&gt;
  // so you have to close this one before opening another.&lt;br /&gt;
  myFile = SD.open(&amp;quot;test.txt&amp;quot;, FILE_WRITE);&lt;br /&gt;
  &lt;br /&gt;
  // if the file opened okay, write to it:&lt;br /&gt;
  if (myFile) {&lt;br /&gt;
    Serial.print(&amp;quot;Writing to test.txt...&amp;quot;);&lt;br /&gt;
    myFile.println(&amp;quot;testing 1, 2, 3.&amp;quot;);&lt;br /&gt;
	// close the file:&lt;br /&gt;
    myFile.close();&lt;br /&gt;
    Serial.println(&amp;quot;done.&amp;quot;);&lt;br /&gt;
  } else {&lt;br /&gt;
    // if the file didn&#039;t open, print an error:&lt;br /&gt;
    Serial.println(&amp;quot;error opening test.txt&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  // re-open the file for reading:&lt;br /&gt;
  myFile = SD.open(&amp;quot;test.txt&amp;quot;);&lt;br /&gt;
  if (myFile) {&lt;br /&gt;
    Serial.println(&amp;quot;test.txt:&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    // read from the file until there&#039;s nothing else in it:&lt;br /&gt;
    while (myFile.available()) {&lt;br /&gt;
    	Serial.write(myFile.read());&lt;br /&gt;
    }&lt;br /&gt;
    // close the file:&lt;br /&gt;
    myFile.close();&lt;br /&gt;
  } else {&lt;br /&gt;
  	// if the file didn&#039;t open, print an error:&lt;br /&gt;
    Serial.println(&amp;quot;error opening test.txt&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
	// nothing happens after setup&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://forum.arduino.cc/index.php?board=63.0&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.arduino.cc/en/Reference/SD&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://store.arduino.cc/arduino-wireless-proto-shield&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://store.arduino.cc/arduino-wireless-proto-shield&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.ladyada.net/products/microsd/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://github.com/adafruit/SD&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Wireless_SD_Shield_Tutorial:_First_Steps&amp;diff=4518</id>
		<title>Arduino Wireless SD Shield Tutorial: First Steps</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Arduino_Wireless_SD_Shield_Tutorial:_First_Steps&amp;diff=4518"/>
		<updated>2020-08-10T00:24:39Z</updated>

		<summary type="html">&lt;p&gt;CCinay: Created page with &amp;quot;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;  == Summary == The Wireless Proto Shield for Arduino is an Arduino Shield that provides wireless communication capabilities to an Arduino board....&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
The Wireless Proto Shield for Arduino is an Arduino Shield that provides wireless communication capabilities to an Arduino board. For this purpose, a chip for wireless communication is attached to the shield. This Wireless Proto Shield is based on Digi&#039;s Xbee module, but can be used by any model of the same size. The module can communicate indoors at a distance of up to 30 metres and outdoors at a distance of up to 90 metres (without obstacle). &lt;br /&gt;
The module can be used as a replacement for a USB-to-serial adapter or configured in control mode for a wide range of networking options.&lt;br /&gt;
&lt;br /&gt;
The Wireless Proto Shield for Arduino has no SD socket.&lt;br /&gt;
&lt;br /&gt;
An integrated switch on the shield allows the wireless module (Xbee chip) to communicate with the USB to serial converter or the microcontroller.&lt;br /&gt;
To learn more about the WireLess Proto Shield, see the product data sheet on the Arduino website: [http://arduino.cc/en/Main/ArduinoWirelessProtoShield ArduinoWirelessProtoShield]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; &amp;lt;b&amp;gt;[[File:Arduino_Wireless_SD_Shield_Tutorial.jpg|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial]]&amp;lt;/b&amp;gt; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
As the name implies, the Arduino Wireless SD shield serves two functions. Foremost, this shield allows you to easily interface with Xbee transceiver modules to create mesh networks, and other wireless devices. Secondly, the micro SD socket allows you to store and access a large amount of data. Whether using these functions by on their own or together, this chip greatly enhances the capabilities of a standard Arduino. &lt;br /&gt;
The best part about this shield is how easy it is to use. In no time flat, you can have its various components up and running.&lt;br /&gt;
&lt;br /&gt;
=== Step 1: Plug in the Xbee ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; &amp;lt;b&amp;gt;[[File:Arduino_Wireless_SD_Shield_Tutorial-Step1.jpg|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step1]]&amp;lt;/b&amp;gt; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;1. Plug in your Xbee modules in order to use the shield as a wireless transceiver.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;2. Make sure the module&#039;s pointy end is lined up with the edge of the board.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;3. If you are using the shield for wireless data transfer, you will need two or more of them.&lt;br /&gt;
&lt;br /&gt;
=== Step 2: Plug in the Xbee ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; &amp;lt;b&amp;gt;[[File:Arduino_Wireless_SD_Shield_Tutorial-Step2.jpg|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step2]]&amp;lt;/b&amp;gt; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Plug your shields into your Arduinos.&lt;br /&gt;
&lt;br /&gt;
=== Step 3: Features ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; &amp;lt;b&amp;gt;[[File:Arduino_Wireless_SD_Shield_Tutorial-Step3.JPG|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step3]]&amp;lt;/b&amp;gt; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;1. The wireless SD shield supports [https://www.digi.com/products/embedded-systems/digi-xbee/rf-modules/2-4-ghz-rf-modules/xbee-zigbee#overview Xbee modules]. These modules allow for easy wireless serial communication. &amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp;A standard module has the range of 100 - 300 feet.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;2. It also boasts a micro SD socket. This can easily be interfaced with the [https://www.arduino.cc/en/Reference/SD Arduino SD library]. Unfortunately, this library&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp; does not come bundled with the Arduino development environment, so you will have to set it up yourself.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;3. The shield also boasts a perfboard grid for prototyping your own circuit, and a micro switch for toggling between the USB port and micro SD port.&lt;br /&gt;
&lt;br /&gt;
=== Step 4: Program the Receiver ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; &amp;lt;b&amp;gt;[[File:Arduino_Wireless_SD_Shield_Tutorial-Step4.JPG|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step4]]&amp;lt;/b&amp;gt; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Plug one of the Arduinos into the computer. Make certain the micro switch is toggled to the &amp;quot;USB&amp;quot; option.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Upload the following code:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;//Xbee receiver&lt;br /&gt;
&lt;br /&gt;
int sentDat;&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
  Serial.begin(9600);   &lt;br /&gt;
  pinMode(2, OUTPUT); &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
  if (Serial.available() &amp;gt; 0) {&lt;br /&gt;
	sentDat = Serial.read(); &lt;br /&gt;
&lt;br /&gt;
	if(sentDat == &#039;h&#039;){&lt;br /&gt;
          //activate the pumpkin for one second and then stop&lt;br /&gt;
  	  digitalWrite(2, HIGH);&lt;br /&gt;
          delay(1000);&lt;br /&gt;
          digitalWrite(2, LOW);&lt;br /&gt;
	}&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 5: Setup the Receiver ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; &amp;lt;b&amp;gt;[[File:Arduino_Wireless_SD_Shield_Tutorial-Step5.JPG|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step5]]&amp;lt;/b&amp;gt; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;1. Unplug the Arduino from the computer. Toggle the micro switch from &amp;quot;USB&amp;quot; to &amp;quot;MICRO&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;2. Plug the red wire from a 9V battery connector into the Vin pin. Plug the black wire into the GND pin.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;3. Connect the positive leg of an LED to pin D2 and the other leg in series with a 220 ohm resistor to ground.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;4. Plug in your battery.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;5. It is now a standalone receiver.&lt;br /&gt;
&lt;br /&gt;
=== Step 6: Program the Transmitter ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; &amp;lt;b&amp;gt;[[File:Arduino Wireless SD Shield Tutorial-Step6.JPG|thumb|none|500px|Arduino Wireless SD Shield Tutorial-Step6]]&amp;lt;/b&amp;gt; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;1. Plug in the Arduino for the transmitter. Make certain the micro switch is toggled to the &amp;quot;USB&amp;quot; option.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;2. Before you upload any code to the Arduino, open the serial monitor. Type in &amp;quot;h&amp;quot; and hit the &amp;quot;send&amp;quot; button. &lt;br /&gt;
&amp;lt;br&amp;gt;&amp;amp;emsp;&amp;amp;emsp;The LED on your receiver should light up. You have made a wireless connection!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;&amp;amp;emsp;3. Now upload the following code:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;/*&lt;br /&gt;
  &lt;br /&gt;
  Wireless transmitter demo  &lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
  Based on Button example code&lt;br /&gt;
  http://www.arduino.cc/en/Tutorial/Button&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 The circuit:&lt;br /&gt;
 * pushbutton attached to pin 2 from +5V&lt;br /&gt;
 * 10K resistor attached to pin 2 from ground&lt;br /&gt;
 &lt;br /&gt;
 This code is in the public domain.&lt;br /&gt;
 &lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// constants won&#039;t change. They&#039;re used here to &lt;br /&gt;
// set pin numbers:&lt;br /&gt;
const int buttonPin = 2;     // the number of the pushbutton pin&lt;br /&gt;
&lt;br /&gt;
// variables will change:&lt;br /&gt;
int buttonState = 0;         // variable for reading the pushbutton status&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
  // initialize serial communication:&lt;br /&gt;
  Serial.begin(9600); &lt;br /&gt;
     &lt;br /&gt;
  // initialize the pushbutton pin as an input:&lt;br /&gt;
  pinMode(buttonPin, INPUT);     &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop(){&lt;br /&gt;
  // read the state of the pushbutton value:&lt;br /&gt;
  buttonState = digitalRead(buttonPin);&lt;br /&gt;
&lt;br /&gt;
  // check if the pushbutton is pressed.&lt;br /&gt;
  // if it is, the buttonState is HIGH:&lt;br /&gt;
  if (buttonState == HIGH) {     &lt;br /&gt;
    //transmit a High command to the pumpkin and delay a second so that it does not receive more than one command&lt;br /&gt;
    //per button press&lt;br /&gt;
    Serial.println(&#039;h&#039;);&lt;br /&gt;
    delay(1000); &lt;br /&gt;
  } &lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step 7: Setup the Transmitter ===&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; &amp;lt;b&amp;gt;[[File:Arduino_Wireless_SD_Shield_Tutorial-Step7.JPG|thumb|none|500px|Arduino_Wireless_SD_Shield_Tutorial-Step7]]&amp;lt;/b&amp;gt; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;1. Unplug the Arduino from the computer. Toggle the micro switch from &amp;quot;USB&amp;quot; to &amp;quot;MICRO&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;2. Plug the red wire from a 9V battery connector into the Vin pin. Plug the black wire into the GND pin.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;3. Connect a 10K resistor between pin D2 and ground. Also connect a push button switch between pin D2 and 5v.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;4. Plug in your battery.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;5. It is now a standalone transmitter.&lt;br /&gt;
&lt;br /&gt;
=== Step 8: Prepare the SD Card ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;:&lt;br /&gt;
Before you can use the micro SD card, it needs to be formatted to either FAT16 or FAT32.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; &amp;lt;b&amp;gt;[[File:Arduino Wireless SD Shield Tutorial-Step8.JPG|thumb|none|500px|Arduino Wireless SD Shield Tutorial-Step8]]&amp;lt;/b&amp;gt; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;On Windows:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Open &amp;quot;My Computer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Right-click on the disk and select &amp;quot;Format&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Select &amp;quot;FAT&amp;quot; and click &amp;quot;start&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; It is now formatted to FAT16&lt;br /&gt;
&lt;br /&gt;
Once the disk is formatted, the next thing you have to do is make sure that you have the [https://github.com/adafruit/SD SD Card Library]. For instructions on how to setup the library, check out the bottom of Adafruit&#039;s extremely thorough [http://www.ladyada.net/products/microsd/ micro SD card tutorial].&lt;br /&gt;
&lt;br /&gt;
Plug the SD card into the socket on the shield.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;To test the SD card, plug the Arduino into the computer and upload the following code:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;/*&lt;br /&gt;
  SD card read/write&lt;br /&gt;
 &lt;br /&gt;
 This example shows how to read and write data to and from an SD card file 	&lt;br /&gt;
 The circuit:&lt;br /&gt;
 * SD card attached to SPI bus as follows:&lt;br /&gt;
 ** MOSI - pin 11&lt;br /&gt;
 ** MISO - pin 12&lt;br /&gt;
 ** CLK - pin 13&lt;br /&gt;
 ** CS - pin 4&lt;br /&gt;
 &lt;br /&gt;
 	 &lt;br /&gt;
 */&lt;br /&gt;
 &lt;br /&gt;
#include &amp;lt;SD.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
File myFile;&lt;br /&gt;
&lt;br /&gt;
void setup()&lt;br /&gt;
{&lt;br /&gt;
  Serial.begin(9600);&lt;br /&gt;
  Serial.print(&amp;quot;Initializing SD card...&amp;quot;);&lt;br /&gt;
  // On the Ethernet Shield, CS is pin 4. It&#039;s set as an output by default.&lt;br /&gt;
  // Note that even if it&#039;s not used as the CS pin, the hardware SS pin &lt;br /&gt;
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output &lt;br /&gt;
  // or the SD library functions will not work. &lt;br /&gt;
   pinMode(10, OUTPUT);&lt;br /&gt;
   &lt;br /&gt;
  if (!SD.begin(4)) {&lt;br /&gt;
    Serial.println(&amp;quot;initialization failed!&amp;quot;);&lt;br /&gt;
    return;&lt;br /&gt;
  }&lt;br /&gt;
  Serial.println(&amp;quot;initialization done.&amp;quot;);&lt;br /&gt;
  &lt;br /&gt;
  // open the file. note that only one file can be open at a time,&lt;br /&gt;
  // so you have to close this one before opening another.&lt;br /&gt;
  myFile = SD.open(&amp;quot;test.txt&amp;quot;, FILE_WRITE);&lt;br /&gt;
  &lt;br /&gt;
  // if the file opened okay, write to it:&lt;br /&gt;
  if (myFile) {&lt;br /&gt;
    Serial.print(&amp;quot;Writing to test.txt...&amp;quot;);&lt;br /&gt;
    myFile.println(&amp;quot;testing 1, 2, 3.&amp;quot;);&lt;br /&gt;
	// close the file:&lt;br /&gt;
    myFile.close();&lt;br /&gt;
    Serial.println(&amp;quot;done.&amp;quot;);&lt;br /&gt;
  } else {&lt;br /&gt;
    // if the file didn&#039;t open, print an error:&lt;br /&gt;
    Serial.println(&amp;quot;error opening test.txt&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  // re-open the file for reading:&lt;br /&gt;
  myFile = SD.open(&amp;quot;test.txt&amp;quot;);&lt;br /&gt;
  if (myFile) {&lt;br /&gt;
    Serial.println(&amp;quot;test.txt:&amp;quot;);&lt;br /&gt;
    &lt;br /&gt;
    // read from the file until there&#039;s nothing else in it:&lt;br /&gt;
    while (myFile.available()) {&lt;br /&gt;
    	Serial.write(myFile.read());&lt;br /&gt;
    }&lt;br /&gt;
    // close the file:&lt;br /&gt;
    myFile.close();&lt;br /&gt;
  } else {&lt;br /&gt;
  	// if the file didn&#039;t open, print an error:&lt;br /&gt;
    Serial.println(&amp;quot;error opening test.txt&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop()&lt;br /&gt;
{&lt;br /&gt;
	// nothing happens after setup&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[ARDUINO Wireless Proto Shield]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://forum.arduino.cc/index.php?board=63.0&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.arduino.cc/en/Reference/SD&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://store.arduino.cc/arduino-wireless-proto-shield&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://store.arduino.cc/arduino-wireless-proto-shield&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; http://www.ladyada.net/products/microsd/&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://github.com/adafruit/SD&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial-Step8.JPG&amp;diff=4517</id>
		<title>File:Arduino Wireless SD Shield Tutorial-Step8.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial-Step8.JPG&amp;diff=4517"/>
		<updated>2020-08-10T00:17:38Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial-Step7.JPG&amp;diff=4516</id>
		<title>File:Arduino Wireless SD Shield Tutorial-Step7.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial-Step7.JPG&amp;diff=4516"/>
		<updated>2020-08-10T00:16:39Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial-Step6.JPG&amp;diff=4515</id>
		<title>File:Arduino Wireless SD Shield Tutorial-Step6.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial-Step6.JPG&amp;diff=4515"/>
		<updated>2020-08-10T00:15:40Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial-Step5.JPG&amp;diff=4514</id>
		<title>File:Arduino Wireless SD Shield Tutorial-Step5.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial-Step5.JPG&amp;diff=4514"/>
		<updated>2020-08-10T00:14:53Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial-Step4.JPG&amp;diff=4513</id>
		<title>File:Arduino Wireless SD Shield Tutorial-Step4.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial-Step4.JPG&amp;diff=4513"/>
		<updated>2020-08-10T00:14:07Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial-Step3.JPG&amp;diff=4512</id>
		<title>File:Arduino Wireless SD Shield Tutorial-Step3.JPG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial-Step3.JPG&amp;diff=4512"/>
		<updated>2020-08-10T00:13:17Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial-Step2.jpg&amp;diff=4511</id>
		<title>File:Arduino Wireless SD Shield Tutorial-Step2.jpg</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial-Step2.jpg&amp;diff=4511"/>
		<updated>2020-08-10T00:12:18Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial-Step1.jpg&amp;diff=4510</id>
		<title>File:Arduino Wireless SD Shield Tutorial-Step1.jpg</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial-Step1.jpg&amp;diff=4510"/>
		<updated>2020-08-10T00:11:39Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial.jpg&amp;diff=4509</id>
		<title>File:Arduino Wireless SD Shield Tutorial.jpg</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Arduino_Wireless_SD_Shield_Tutorial.jpg&amp;diff=4509"/>
		<updated>2020-08-10T00:09:49Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=UBIQUITI_Ethernet_Surge_Protector,_ETH-SP-G2:_First_Steps&amp;diff=4508</id>
		<title>UBIQUITI Ethernet Surge Protector, ETH-SP-G2: First Steps</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=UBIQUITI_Ethernet_Surge_Protector,_ETH-SP-G2:_First_Steps&amp;diff=4508"/>
		<updated>2020-08-08T03:04:33Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&amp;lt;b&amp;gt;ESD protection for outdoor high-speed networks&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Ethernet_Surge_Protector.png|thumb|none|350px|Ethernet_Surge_Protector]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ethernet surge protection, model ETH-SP-G2 from Ubiquiti Networks:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ETH-SP is a cost-effective solution for outdoor Ethernet devices to protect them from harmful electrostatic discharges and overvoltages.&lt;br /&gt;
&lt;br /&gt;
All Ubiquiti airMAX devices already have an ESD built in, adding the ETH-SP can provide even more protection.&lt;br /&gt;
The ETH-SP is designed to protect Power over Ethernet (PoE) or non-PoE devices with connection speeds of up to 1Gbps. Two passive surge protectionRJ45 connectors ensure maximum device compatibility.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ideal für WISP-Netzwerke:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install two ETH-SPs: one near the terminal and the other at the point of entry into the building.&lt;br /&gt;
Harmful ESD discharges and overvoltages will be safely discharged by the ETH-SP and absorbed into the ground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;:&lt;br /&gt;
For best possible protection, we recommend installing two voltage protection adapters. The first surge protector within one meter of the device data port to be protected and the second surge protector at the entry point of the site where the wired network equipment is located.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Details ===&lt;br /&gt;
&amp;lt;table border frame=box&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;Type&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;&amp;amp;emsp;Overvoltage protection&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;Colour&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;&amp;amp;emsp;white&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;EAN&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;&amp;amp;emsp;0817882023900&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;Manufacturer No.&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;&amp;amp;emsp;ETH-SP-G2&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;Lightning protection&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;&amp;amp;emsp;up to 10000 Ampere&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;More information&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;&amp;amp;emsp;Temperature (operating): -30 to 65 °C; Humidity (operating): 10 to 90 % non-condensing&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt; &lt;br /&gt;
&lt;br /&gt;
== Overview about the hardware ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Ethernet_Surge_Protector_ETH-SP-G2.JPG|thumb|none|350px|Ethernet_Surge_Protector_ETH-SP-G2]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;1. ETH input/output port: &amp;lt;/b&amp;gt;&lt;br /&gt;
Passive RJ45 Ethernet ports with surge protection.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;2. Grounding point: &amp;lt;/b&amp;gt;&lt;br /&gt;
The ETH-SP-G2 must be grounded in one of the following ways:&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Use the supplied self-tapping screws to ground the ETH-SP-G2 directly to a grounded metal post or structure. Alternatively&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; use an M5 machine screw and nut (not supplied) to attach a ground wire connected to a remote ground block or other grounded object.&lt;br /&gt;
&lt;br /&gt;
== ESD Protection for Outdoor PoE Devices ==&lt;br /&gt;
Damaging electrostatic discharge attacks and surges are diverted to the ETH-SP and safely discharged into the ground, so network devices are protected.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Ethernet_Surge_Protector-Overview.jpg|thumb|none|400px|Ethernet_Surge_Protector-Overview]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Fast Installation ==&lt;br /&gt;
The ETH-SP was designed for easy, plug and play installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Ethernet_Surge_Protector-Install.jpg|thumb|none|600px|Ethernet_Surge_Protector-Install]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Ethernet Surge Protector ETH-SP-G2]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://dl.ubnt.com/qsg/ETH-SP-G2/ETH-SP-G2_DE.html&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.wlan-shop24.de/ubiquiti-ethernet-surge-protector-eth-sp-g2&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Ethernet_Surge_Protector-Overview.jpg&amp;diff=4507</id>
		<title>File:Ethernet Surge Protector-Overview.jpg</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Ethernet_Surge_Protector-Overview.jpg&amp;diff=4507"/>
		<updated>2020-08-08T03:03:30Z</updated>

		<summary type="html">&lt;p&gt;CCinay: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=UBIQUITI_Ethernet_Surge_Protector,_ETH-SP-G2:_First_Steps&amp;diff=4506</id>
		<title>UBIQUITI Ethernet Surge Protector, ETH-SP-G2: First Steps</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=UBIQUITI_Ethernet_Surge_Protector,_ETH-SP-G2:_First_Steps&amp;diff=4506"/>
		<updated>2020-08-08T02:58:50Z</updated>

		<summary type="html">&lt;p&gt;CCinay: Created page with &amp;quot;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;  == Description == &amp;lt;b&amp;gt;ESD protection for outdoor high-speed networks&amp;lt;/b&amp;gt;  &amp;lt;div&amp;gt;&amp;lt;ul&amp;gt;  &amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; File:Ethernet_Surge_P...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&amp;lt;b&amp;gt;ESD protection for outdoor high-speed networks&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Ethernet_Surge_Protector.png|thumb|none|350px|Ethernet_Surge_Protector]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ethernet surge protection, model ETH-SP-G2 from Ubiquiti Networks:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ETH-SP is a cost-effective solution for outdoor Ethernet devices to protect them from harmful electrostatic discharges and overvoltages.&lt;br /&gt;
&lt;br /&gt;
All Ubiquiti airMAX devices already have an ESD built in, adding the ETH-SP can provide even more protection.&lt;br /&gt;
The ETH-SP is designed to protect Power over Ethernet (PoE) or non-PoE devices with connection speeds of up to 1Gbps. Two passive surge protectionRJ45 connectors ensure maximum device compatibility.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Ideal für WISP-Netzwerke:&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install two ETH-SPs: one near the terminal and the other at the point of entry into the building.&lt;br /&gt;
Harmful ESD discharges and overvoltages will be safely discharged by the ETH-SP and absorbed into the ground.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;:&lt;br /&gt;
For best possible protection, we recommend installing two voltage protection adapters. The first surge protector within one meter of the device data port to be protected and the second surge protector at the entry point of the site where the wired network equipment is located.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Details ===&lt;br /&gt;
&amp;lt;table border frame=box&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;Type&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;&amp;amp;emsp;Overvoltage protection&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;Colour&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;&amp;amp;emsp;white&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;EAN&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;&amp;amp;emsp;0817882023900&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;Manufacturer No.&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;&amp;amp;emsp;ETH-SP-G2&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;Lightning protection&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;&amp;amp;emsp;up to 10000 Ampere&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
    &amp;lt;tr&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;More information&amp;lt;/td&amp;gt;&lt;br /&gt;
      &amp;lt;td align=&amp;quot;left&amp;quot;&amp;gt;&amp;amp;emsp;&amp;amp;emsp;Temperature (operating): -30 to 65 °C; Humidity (operating): 10 to 90 % non-condensing&amp;lt;/td&amp;gt;&lt;br /&gt;
    &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt; &lt;br /&gt;
&lt;br /&gt;
== Overview about the hardware ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Ethernet_Surge_Protector_ETH-SP-G2.JPG|thumb|none|350px|Ethernet_Surge_Protector_ETH-SP-G2]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;1. ETH input/output port: &amp;lt;/b&amp;gt;&lt;br /&gt;
Passive RJ45 Ethernet ports with surge protection.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;2. Grounding point: &amp;lt;/b&amp;gt;&lt;br /&gt;
The ETH-SP-G2 must be grounded in one of the following ways:&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; Use the supplied self-tapping screws to ground the ETH-SP-G2 directly to a grounded metal post or structure. Alternatively&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10149; use an M5 machine screw and nut (not supplied) to attach a ground wire connected to a remote ground block or other grounded object.&lt;br /&gt;
&lt;br /&gt;
== Fast Installation ==&lt;br /&gt;
The ETH-SP was designed for easy, plug and play installation:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Ethernet_Surge_Protector-Install.jpg|thumb|none|600px|Ethernet_Surge_Protector-Install]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Hardware ==&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; [[Ethernet Surge Protector ETH-SP-G2]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://dl.ubnt.com/qsg/ETH-SP-G2/ETH-SP-G2_DE.html&lt;br /&gt;
&lt;br /&gt;
&amp;amp;emsp;&amp;amp;#10144; https://www.wlan-shop24.de/ubiquiti-ethernet-surge-protector-eth-sp-g2&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>CCinay</name></author>
	</entry>
</feed>