-
Notifications
You must be signed in to change notification settings - Fork 2
Música en formato RTTTL
angelmicelti edited this page Aug 5, 2020
·
11 revisions
Mira este enlace.
Descarga el archivo ArduinoBlocks haciendo clic aquí
Código ArduinoBlocks
#include "ABlocks_Button.h"
#include <ABLocks_TimerFreeTone.h>
String s_my_90210;
String s_Beethoven5;
Button button_debounced_2(2,50);
String rtt_melody_2=":d=4,o=5,b=250:c6,c6,a,b,8a,b,g,p,c6,c6,a,8b,8a,8p,g.,p";
Button button_debounced_3(3,50);
String rtt_melody_9=":d=4,o=5,b=125:8a#6,8a6,8g.6,16f6,8a6,8g6,8f6,8d#6,8g6,8f6,16d#6,8d.6,f.6";
void setup()
{
pinMode(2, INPUT);
pinMode(5, OUTPUT);
pinMode(3, INPUT);
s_my_90210 = String("90210:d=4,o=5,b=140:8f,8a#,8c6,d.6,2d6,p,8f,8a#,8c6,8d6,8d#6,f6,f.6,2a#.,8f,8a#,8c6,8d6,8d#6,8f6,8g6,f6,8d#6,d#6,d6,2c.6,8a#,a,a#.,g6,8f6,8d#6,8d6,8d#6,8d6,8a#,f ");
s_Beethoven5 = String("Beethoven5:d=4,o=5,b=150:4g,g,g,1d#,f,f,f,1d");
}
void loop()
{
if (button_debounced_2.pressed()) {
TimerFreeToneRtttl(5,(const char *)rtt_melody_2.c_str());
}
if (button_debounced_3.pressed()) {
TimerFreeToneRtttl(5,(const char *)rtt_melody_9.c_str());
}
delay(100);
}
Mira este enlace.
Descarga el archivo ArduinoBlocks haciendo clic aquí
Código ArduinoBlocks
#include "IRremote.h"
#include <ABLocks_TimerFreeTone.h>
String s_my_90210;
String s_Beethoven5;
IRrecv ir_rx(6);
decode_results ir_rx_results;
String rtt_melody_5=":d=4,o=5,b=45:32p,32f#,32f#,32f#,8b.,8f#.6,32e6,32d#6,32c#6,8b.6,16f#.6,32e6,32d#6,32c#6,8b.6,16f#.6,32e6,32d#6,32e6,8c#.6";
String rtt_melody_6=":d=8,o=5,b=125:4d#6,a#,2d#6,16p,g#,4a#,4d#.,p,16g,16a#,d#6,a#,f6,2d#6,16p,c#.6,16c6,16a#,g#.,2a#";
String rtt_melody_18=":d=4,o=5,b=250:8g,8g,4b,4g,4a,4f,1p,8g,8g,8g,8g,4f,4g,2p,4p";
String rtt_melody_7=":d=16,o=6,b=95:g,8p,g,8p,a#,p,c7,p,g,8p,g,8p,f,p,f#,p,g,8p,g,8p,a#,p,c7,p,g,8p,g,8p,f,p,f#";
String rtt_melody_17=":d=4,o=5,b=140:8e6,8d#6,8e6,8d#6,8e6,8b,8d6,8c6,a,8p,8c,8e,8a,b,8p,8e,8g#,8b,c6";
unsigned long fnc_ir_rx_decode()
{
bool decoded=false;
if( ir_rx.decode(&ir_rx_results))
{
decoded=true;
ir_rx.resume();
}
if(decoded) return ir_rx_results.value; else return 0;
}
void setup()
{
ir_rx.enableIRIn();
pinMode(5, OUTPUT);
pinMode(A1, INPUT);
s_my_90210 = String("90210:d=4,o=5,b=140:8f,8a#,8c6,d.6,2d6,p,8f,8a#,8c6,8d6,8d#6,f6,f.6,2a#.,8f,8a#,8c6,8d6,8d#6,8f6,8g6,f6,8d#6,d#6,d6,2c.6,8a#,a,a#.,g6,8f6,8d#6,8d6,8d#6,8d6,8a#,f ");
s_Beethoven5 = String("Beethoven5:d=4,o=5,b=150:4g,g,g,1d#,f,f,f,1d");
}
void loop()
{
if (((unsigned long)fnc_ir_rx_decode() == (16736925))) {
TimerFreeToneRtttl(5,(const char *)rtt_melody_5.c_str());
}
if (((unsigned long)fnc_ir_rx_decode() == (16754775))) {
TimerFreeToneRtttl(5,(const char *)rtt_melody_6.c_str());
}
if (((unsigned long)fnc_ir_rx_decode() == (16720605))) {
TimerFreeToneRtttl(5,(const char *)rtt_melody_18.c_str());
}
if (((unsigned long)fnc_ir_rx_decode() == (16761405))) {
TimerFreeToneRtttl(5,(const char *)rtt_melody_7.c_str());
}
if (((unsigned long)fnc_ir_rx_decode() == (16712445))) {
TimerFreeToneRtttl(5,(const char *)s_my_90210.c_str());
}
if ((analogRead(A1) >= 750)) {
TimerFreeToneRtttl(5,(const char *)rtt_melody_17.c_str());
}
}