<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.uni-weimar.de/kunst-und-gestaltung/wiki/index.php?action=history&amp;feed=atom&amp;title=Code_for_arduino</id>
	<title>Code for arduino - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.uni-weimar.de/kunst-und-gestaltung/wiki/index.php?action=history&amp;feed=atom&amp;title=Code_for_arduino"/>
	<link rel="alternate" type="text/html" href="https://www.uni-weimar.de/kunst-und-gestaltung/wiki/index.php?title=Code_for_arduino&amp;action=history"/>
	<updated>2026-05-22T13:20:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://www.uni-weimar.de/kunst-und-gestaltung/wiki/index.php?title=Code_for_arduino&amp;diff=127688&amp;oldid=prev</id>
		<title>Capo0368: Created page with &quot;int melody[8] = {262,294,330,349,392,440,494,523};  int TRIG = 3, ECHO = 4, speaker = 7;  void setup() {  Serial.begin(9600);  pinMode(TRIG,OUTPUT);  pinMode(ECHO,INPUT);  pin...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.uni-weimar.de/kunst-und-gestaltung/wiki/index.php?title=Code_for_arduino&amp;diff=127688&amp;oldid=prev"/>
		<updated>2021-11-24T11:22:07Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;int melody[8] = {262,294,330,349,392,440,494,523};  int TRIG = 3, ECHO = 4, speaker = 7;  void setup() {  Serial.begin(9600);  pinMode(TRIG,OUTPUT);  pinMode(ECHO,INPUT);  pin...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;int melody[8] = {262,294,330,349,392,440,494,523};&lt;br /&gt;
&lt;br /&gt;
int TRIG = 3, ECHO = 4, speaker = 7;&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
&lt;br /&gt;
Serial.begin(9600);&lt;br /&gt;
&lt;br /&gt;
pinMode(TRIG,OUTPUT);&lt;br /&gt;
&lt;br /&gt;
pinMode(ECHO,INPUT);&lt;br /&gt;
&lt;br /&gt;
pinMode(speaker, OUTPUT);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
&lt;br /&gt;
float distance, duration;&lt;br /&gt;
&lt;br /&gt;
digitalWrite(TRIG, HIGH);&lt;br /&gt;
&lt;br /&gt;
delayMicroseconds(1);&lt;br /&gt;
&lt;br /&gt;
digitalWrite(TRIG,LOW);&lt;br /&gt;
&lt;br /&gt;
duration = pulseIn(ECHO,HIGH);&lt;br /&gt;
&lt;br /&gt;
distance = ((float)(duration*340)/10000)/2;&lt;br /&gt;
&lt;br /&gt;
Serial.println(distance);&lt;br /&gt;
&lt;br /&gt;
int i;&lt;br /&gt;
&lt;br /&gt;
if (distance &amp;lt;= 32) {&lt;br /&gt;
&lt;br /&gt;
i=map(distance,0,32,0,7);&lt;br /&gt;
&lt;br /&gt;
tone (speaker, melody[i], 250);&lt;br /&gt;
&lt;br /&gt;
delay (300);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
else {&lt;br /&gt;
&lt;br /&gt;
noTone(speaker);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Capo0368</name></author>
	</entry>
</feed>