Schritt 9: Weitere Informationen & Codebeispiel
Kann man eine elektrische Schaltbild, Codeauflistung und andere Informationen in www.guarnero.com.
Der Schaltplan ist unten aufgeführt.
Programm-Listing
Emitter ist der Code für den Arduino Mega, Arduino Uno und der Maestro-Servo-Controller in den folgenden Abschnitten dargestellt.
Arduino Uno R3
Arduino Uno R3 sendet eine Reihe von IR remote-Befehle, dass Willenskraft Sie den Projektor, wählen Sie die gewünschten Urlaub-Datei und die Datei abzuspielen. Wenn ein Show-Start-Trigger auf dem Arduino eingeht, erlässt es einen Projektor On/Off-Befehl, um den Projektor auszuschalten. Ich hätte den Code noch kompakter durch Zugabe von ein einzigen Befehl anhand der Schalterstellung Urlaub, aber das war ein schneller Weg um es geht ohne jede Anstrengung. Der Arduino Code ist unten aufgeführt.
John Guarnero - http://guarnero.com
Dezember 2014
IR-Steuerung des Projektors Favi mit Arduino Uno
Remote-Bibliothek von Ken Shirriff http://arcfn.com geliefert
#include
Int HOLIDAY_PIN = 8;
Int PLAYING_PIN = 11;
Int BUTTON_START_PIN = 12;
Int BUTTON_STOP_PIN = 10;
Int STATUS_PIN = 13;
IRsend Irsend;
void setup()
{
PinMode (BUTTON_START_PIN, Eingabe);
PinMode (BUTTON_STOP_PIN, Eingabe);
PinMode (STATUS_PIN, OUTPUT);
PinMode (PLAYING_PIN, OUTPUT);
PinMode (HOLIDAY_PIN, Eingabe);
}
void loop()
{
Int ButtonState_Start = digitalRead(BUTTON_START_PIN);
Int ButtonState_Stop = digitalRead(BUTTON_STOP_PIN);
Int Holiday_Switch = digitalRead(HOLIDAY_PIN);
Weihnachtsvideo abspielen
Wenn (ButtonState_Start == 1 & & Holiday_Switch == 1) //1 ist wenn Schalter in der oberen Position (Weihnachten) Urlaub - Weihnachten erfordert auf richtige Arow Push und Halloween erfordert zwei schiebt
{
DigitalWrite (PLAYING_PIN, hohe);
Delay(4000);
DigitalWrite (PLAYING_PIN, hohe);
Start-Projektion
irsend.sendNEC (0x61D600FF, 32); Senden NEC macht auf jedem Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
Verzögerung (18000); 18 Sekunden warten
irsend.sendNEC (0x61D628D7, 32); Senden Recht jedes Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
Verzögerung (1000); Warten Sie 1 Sekunde
irsend.sendNEC (0x61D628D7, 32); Senden Recht jedes Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
Verzögerung (1000); Warten Sie 1 Sekunde
irsend.sendNEC (0x61D6A857, 32); Send "OK" jede Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
Verzögerung (1000); Warten Sie 1 Sekunde
irsend.sendNEC (0x61D6A857, 32); Send "OK" jede Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
Verzögerung (1000); Warten Sie 1 Sekunde
irsend.sendNEC (0x61D628D7, 32); Senden Recht jedes Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
Verzögerung (1000); Warten Sie 1 Sekunde
irsend.sendNEC (0x61D6A857, 32); Send "OK" jede Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
Verzögerung (1000); Warten Sie 1 Sekunde
irsend.sendNEC (0x61D67887, 32); Senden spielen jede Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
DigitalWrite (PLAYING_PIN, LOW);
}
Halloween-Video abspielen
Wenn (ButtonState_Start == 1 & & Holiday_Switch == 0) //0 ist wenn der Urlaub wechseln in der unteren Position (Halloween) - Weihnachten erfordert auf richtige Arow Push und Halloween erfordert zwei schiebt
{
DigitalWrite (PLAYING_PIN, hohe);
Delay(4000);
DigitalWrite (PLAYING_PIN, hohe);
Start-Projektion
irsend.sendNEC (0x61D600FF, 32); Senden NEC macht auf jedem Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
Verzögerung (18000); 18 Sekunden warten
irsend.sendNEC (0x61D628D7, 32); Senden Recht jedes Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
Verzögerung (1000); Warten Sie 1 Sekunde
irsend.sendNEC (0x61D628D7, 32); Senden Recht jedes Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
Verzögerung (1000); Warten Sie 1 Sekunde
irsend.sendNEC (0x61D6A857, 32); Send "OK" jede Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
Verzögerung (1000); Warten Sie 1 Sekunde
irsend.sendNEC (0x61D6A857, 32); Send "OK" jede Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
Verzögerung (1000); Warten Sie 1 Sekunde
irsend.sendNEC (0x61D628D7, 32); Senden Recht jedes Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
Verzögerung (1000); Warten Sie 1 Sekunde
irsend.sendNEC (0x61D628D7, 32); Senden Recht jedes Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
Verzögerung (1000); Warten Sie 1 Sekunde
irsend.sendNEC (0x61D6A857, 32); Send "OK" jede Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
Verzögerung (1000); Warten Sie 1 Sekunde
irsend.sendNEC (0x61D67887, 32); Senden spielen jede Hex ist 4 Bits, also 32 Bits insgesamt
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
DigitalWrite (PLAYING_PIN, LOW);
}
Projektor ausschalten
Wenn (ButtonState_Stop)
{
DigitalWrite (PLAYING_PIN, hohe);
Delay(4000);
Projektion zu stoppen
DigitalWrite (PLAYING_PIN, hohe);
irsend.sendNEC (0x61D600FF, 32); Senden Sie NEC Power on/off (jede Hex ist 4 Bits, also 32 Bits insgesamt)
DigitalWrite (STATUS_PIN, hohe);
Delay(40);
DigitalWrite (STATUS_PIN, LOW);
Verzögerung (1000); Warten Sie 1 Sekunden
DigitalWrite (PLAYING_PIN, LOW);
}
}