Components and supplies
AA Batteries
Jumper wires (generic)
Buzzer
4xAA battery holder
SG90 Micro-servo motor
Breadboard mini 170p
Arduino Nano R3
IR receiver (generic)
Apps and platforms
Arduino IDE
Project description
Code
Cuckoo
arduino
1/* 2 Cuckoo was inspired in Cuckoo Clocks, but it only show the bird showing through a Window 3 and doing a "Cockoo Song" when it receives an command through IR remote. 4 Simple as that. 5 6 But the funny part: If you have a personal assistant like Alexa, Google ou Siri, linked to an 7 Universal Remote, just locate the Cuckoo in a visible direction to this IR transmitter and program 8 a scene when you said something like " Alexa, tell me de time." Alexa will tell you the time 9 and start Cuckoo. The other scene is program Alexa to say the time and star cuckoo every hour 10 or whatever you imagine. 11 12Fabio - Nerdfatherrj at Arduino Projetc Hub. 13Dec,2020. 14*/ 15 16 17 18#include <TimerFreeTone.h> //This library does not have Timers to conflict with IRremote. 19#include <IRremote.h> //Library to control IR devices 20#include <Servo.h> 21 22#define TONE_PIN 4 //digital port for Buzzer 23Servo Srv; 24int RECV_PIN = 8; //digital port for IR Led 25float armazenavalor; 26int Fora = 23; //Must calibrate to suit your needs. 27int Dentro = 100; //Must calibrate to suit your needs. 28IRrecv irrecv(RECV_PIN); 29decode_results results; 30 31void setup() 32{ 33pinMode(LED_BUILTIN, OUTPUT); 34digitalWrite(LED_BUILTIN, LOW); 35Serial.begin(9600); 36irrecv.enableIRIn(); // Inicializa o receptor IR 37Srv.attach(7); 38delay(250); 39Srv.write(Dentro); 40} //end setup 41 42void loop() 43{ 44 if (irrecv.decode(&results)) 45 { 46 Serial.print("Valor lido : "); 47 Serial.println(results.value, HEX); 48 armazenavalor = (results.value); 49 50 if (armazenavalor == 0xFF30CF) //button "1" pressed 51 { 52 53// digitalWrite(LED_BUILTIN, HIGH); this is for testing purposes. Not needed. 54 55Srv.write(Fora); 56delay(500); 57TimerFreeTone(TONE_PIN,294, 100); 58delay(100); 59TimerFreeTone(TONE_PIN,494, 300); 60delay(700); 61TimerFreeTone(TONE_PIN,294, 100); 62delay(100); 63TimerFreeTone(TONE_PIN,494, 300); 64delay(700); 65TimerFreeTone(TONE_PIN,294, 100); 66delay(100); 67TimerFreeTone(TONE_PIN,494, 300); 68delay(700); 69 70Srv.write(Dentro); 71 72 } 73 74irrecv.resume(); //Le o próximo valor 75 } 76 77 78 79} // end loop 80
Cuckoo
arduino
1/* 2 Cuckoo was inspired in Cuckoo Clocks, but it only show the bird showing through a Window 3 and doing a "Cockoo Song" when it receives an command through IR remote. 4 Simple as that. 5 6 But the funny part: If you have a personal assistant like Alexa, Google ou Siri, linked to an 7 Universal Remote, just locate the Cuckoo in a visible direction to this IR transmitter and program 8 a scene when you said something like " Alexa, tell me de time." Alexa will tell you the time 9 and start Cuckoo. The other scene is program Alexa to say the time and star cuckoo every hour 10 or whatever you imagine. 11 12Fabio - Nerdfatherrj at Arduino Projetc Hub. 13Dec,2020. 14*/ 15 16 17 18#include <TimerFreeTone.h> //This library does not have Timers to conflict with IRremote. 19#include <IRremote.h> //Library to control IR devices 20#include <Servo.h> 21 22#define TONE_PIN 4 //digital port for Buzzer 23Servo Srv; 24int RECV_PIN = 8; //digital port for IR Led 25float armazenavalor; 26int Fora = 23; //Must calibrate to suit your needs. 27int Dentro = 100; //Must calibrate to suit your needs. 28IRrecv irrecv(RECV_PIN); 29decode_results results; 30 31void setup() 32{ 33pinMode(LED_BUILTIN, OUTPUT); 34digitalWrite(LED_BUILTIN, LOW); 35Serial.begin(9600); 36irrecv.enableIRIn(); // Inicializa o receptor IR 37Srv.attach(7); 38delay(250); 39Srv.write(Dentro); 40} //end setup 41 42void loop() 43{ 44 if (irrecv.decode(&results)) 45 { 46 Serial.print("Valor lido : "); 47 Serial.println(results.value, HEX); 48 armazenavalor = (results.value); 49 50 if (armazenavalor == 0xFF30CF) //button "1" pressed 51 { 52 53// digitalWrite(LED_BUILTIN, HIGH); this is for testing purposes. Not needed. 54 55Srv.write(Fora); 56delay(500); 57TimerFreeTone(TONE_PIN,294, 100); 58delay(100); 59TimerFreeTone(TONE_PIN,494, 300); 60delay(700); 61TimerFreeTone(TONE_PIN,294, 100); 62delay(100); 63TimerFreeTone(TONE_PIN,494, 300); 64delay(700); 65TimerFreeTone(TONE_PIN,294, 100); 66delay(100); 67TimerFreeTone(TONE_PIN,494, 300); 68delay(700); 69 70Srv.write(Dentro); 71 72 } 73 74irrecv.resume(); //Le o próximo valor 75 } 76 77 78 79} // end loop 80
Downloadable files
Eletronics
THis picture is with Arduino Uno, but I did build with Nano board
Eletronics
Comments
Only logged in users can leave comments