<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Lucida Console";
panose-1:2 11 6 9 4 5 4 2 2 4;}
@font-face
{font-family:"Segoe UI";
panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.StileMessaggioDiPostaElettronica17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 2.0cm 2.0cm 2.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=IT link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Segoe UI","sans-serif"'>Da:</span></b><span style='font-size:10.0pt;font-family:"Segoe UI","sans-serif"'> python-bounces@lists.python.it [mailto:python-bounces@lists.python.it] <b>Per conto di </b>piergiorgio pancino<br><b>Inviato:</b> martedì 22 maggio 2012 18.52<br><b>A:</b> python@lists.python.it<br><b>Oggetto:</b> [Python] Arduino<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal style='background:white'><span style='color:black'>Ciao a tutti :) è la prima volta che scrivo, anche se vi seguo da tanto, anche perché sono un amatore poco esperto, ma se posso dare il mio contributo lo do volentieri :)<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='color:black'>Veniamo a noi, io per dialogare con arduino ho usato il modulo serial.<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='color:black'>La prima difficoltà è trovare il nome giusto della porta, lo risolvi o con il programma java di arduino per compilare gli sketch che ti dice il nome della porta, oppure con questo listato artigianale:<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='color:black'><o:p> </o:p></span></p></div><div><div><p class=MsoNormal style='background:white'><span style='color:black'>import serial<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:7.5pt;font-family:"Lucida Console";color:black'>def analizza_porte():</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> lista = []</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> for x in range(16):</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> n = "com" + str(x)</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> try:</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> z = serial.Serial(n)</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> z.close()</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> lista.append(n)</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> except:</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> continue</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> for x in range(16):</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> n = "/dev/ttyACM" + str(x)</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> try:</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> z = serial.Serial(n)</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> z.close()</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> lista.append(n)</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> except:</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> continue</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> for x in range(16):</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> n = "/dev/ttyS" + str(x)</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> try:</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> z = serial.Serial(n)</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> z.close()</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> lista.append(n)</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> except:</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> continue</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> return lista</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:7.5pt;font-family:"Lucida Console";color:black'>print(analizza_porte())</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-family:"Lucida Console";color:black'>Per dialogare con arduino ho fatto qualcosa del genere, in pratica mi invia del testo "DO", "RE", eccetera e arduino quando lo legge suona una nota</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='color:black'><o:p> </o:p></span></p></div><div><div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'>from tkinter import *</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'>import serial</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'>try:</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> arduino=serial.Serial("/dev/ttyACM0",9600)</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'>except:</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> exit</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> </span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'>def suona(nota):</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> arduino.write(nota.encode("utf-8"))</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'>root=Tk()</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'> </span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'>do=Button(root,text="DO",command=lambda: suona("C")).pack()</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'>re=Button(root,text="RE",command=lambda: suona("D")).pack()</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'>mi=Button(root,text="MI",command=lambda: suona("E")).pack()</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'>fa=Button(root,text="FA",command=lambda: suona("F")).pack()</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'>sol=Button(root,text="SOL",command=lambda: suona("G")).pack()</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'>la=Button(root,text="LA",command=lambda: suona("A")).pack()</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:"Lucida Console";color:black'>si=Button(root,text="SI",command=lambda: suona("B")).pack()</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:7.5pt;font-family:"Lucida Console";color:black'>root.mainloop()</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-family:"Lucida Console";color:black'>E infine lo sketch su arduino, ciao e scusate la lunghezza:</span><span style='color:black'><o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='color:black'><o:p> </o:p></span></p></div><div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_B0 31<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_C1 33<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_CS1 35<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_D1 37<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_DS1 39<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_E1 41<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_F1 44<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_FS1 46<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_G1 49<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_GS1 52<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_A1 55<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_AS1 58<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_B1 62<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_C2 65<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_CS2 69<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_D2 73<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_DS2 78<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_E2 82<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_F2 87<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_FS2 93<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_G2 98<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_GS2 104<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_A2 110<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_AS2 117<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_B2 123<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_C3 131<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_CS3 139<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_D3 147<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_DS3 156<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_E3 165<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_F3 175<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_FS3 185<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_G3 196<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_GS3 208<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_A3 220<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_AS3 233<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_B3 247<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_C4 262<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_CS4 277<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_D4 294<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_DS4 311<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_E4 330<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_F4 349<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_FS4 370<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_G4 392<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_GS4 415<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_A4 440<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_AS4 466<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_B4 494<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_C5 523<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_CS5 554<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_D5 587<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_DS5 622<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_E5 659<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_F5 698<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_FS5 740<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_G5 784<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_GS5 831<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_A5 880<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_AS5 932<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_B5 988<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_C6 1047<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_CS6 1109<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_D6 1175<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_DS6 1245<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_E6 1319<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_F6 1397<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_FS6 1480<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_G6 1568<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_GS6 1661<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_A6 1760<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_AS6 1865<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_B6 1976<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_C7 2093<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_CS7 2217<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_D7 2349<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_DS7 2489<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_E7 2637<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_F7 2794<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_FS7 2960<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_G7 3136<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_GS7 3322<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_A7 3520<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_AS7 3729<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_B7 3951<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_C8 4186<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_CS8 4435<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_D8 4699<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>#define NOTE_DS8 4978<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>int ledPin=2;<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>char msg;<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>void setup() {<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> pinMode(ledPin,OUTPUT);<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> Serial.begin(9600);<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>}<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>void loop () { <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>if (Serial.available()>0)<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> { <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> msg=Serial.read();<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> } <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>else<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>{ <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> if (msg=='C') { <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> tone(3, NOTE_C3,1000);<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> Serial.print("Note C");<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> msg=' ';<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> } <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> else if (msg=='D') { <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> tone(3, NOTE_D3,1000);<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> Serial.print("Note D");<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> msg=' ';<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> } <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> else if (msg=='E') { <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> tone(3, NOTE_E3,1000);<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> Serial.print("Note D");<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> msg=' ';<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> } <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> else if (msg=='F') { <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> tone(3, NOTE_F3,1000);<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> Serial.print("Note D");<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> msg=' ';<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> } <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> else if (msg=='G') { <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> tone(3, NOTE_G3,1000);<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> Serial.print("Note D");<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> msg=' ';<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> } <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> else if (msg=='A') { <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> tone(3, NOTE_A3,1000);<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> Serial.print("Note D");<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> msg=' ';<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> } <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> else if (msg=='B') { <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> tone(3, NOTE_B3,1000);<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> Serial.print("Note D");<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> msg=' ';<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'> } <o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>}<o:p></o:p></span></p></div><div><p class=MsoNormal style='background:white'><span style='font-size:8.5pt;font-family:"Lucida Console";color:black'>}<o:p></o:p></span></p></div></div></div></div></div></div></div></body></html>