Mit einer handelsüblichen Fernbedienung lässt sich der ASURO fernsteuern.
Die Codierung nennt sich RC5 und stammt von Philips / Marantz. Bei www.sprut.de gibt es eine gute Beschreibung des technischen Hintergrunds.
Wir verwenden eine Universal-Fernbdienung von www.pollin.de mit der Typbezeichnung URC22B (Bestell-Nr. 620 090).
Das Programm sieht folgendermaßen aus:
/*! /file IRDemo.c /brief Routinen fuer die Dekodierung von RC5-Fernbedienungs-Codes /author Benjamin Benz (bbe@heise.de), m.a.r.v.i.n /version V001 - 14.08.2003 - Jan Grewe initial build V002 - 22.10.2003 - Jan Grewe angepasst auf asuro.c Ver.2.10 V003 - 11.02.2007 - m.a.r.v.i.n c't-Bot RC5 Code portiert fuer den ASURO */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * any later version. * ***************************************************************************/ /* Modifiziert von Niels Nikolaisen am 29. September 2011. Verwendet wird eine Universalfernbedienung URC22B von www.pollin.de mit einstellbarer Herstellercodierung. Aktuell gewählter Code: 0027 (Marantz) Verwendet werden die Tasten Schneller Rücklauf (LINKS), Schneller Vorlauf (RECHTS), Play (STOPP), Kapitel vor (VORWAERTS), Kapitel zurück (RUECKWAERTS) Bei VORWAERTS leuchtet FrontLED Bei RUECKWAERTS leutet BackLED Bei LINKS bzw. RECHTS leuchtet die entsprechende BackLED Die RC5-Funktionen sind in in der Bibliothek rc5.c (rc5.h) enthalten */ #include "asuro.h" #include "rc5.h" #include <stdlib.h> #define LINKS 0x100b #define RECHTS 0x100a #define STOPP 0x102b #define VORWAERTS 0x102a #define RUECKWAERTS 0x102e #define MAXSPEED 200 int main(void) { static unsigned int cmd; //Lesepuffer für IR-Empfänger // unsigned char leftDir = FWD, rightDir = FWD; char text[7]; Init(); InitRC5(); SerPrint("RC5 Test\r\n"); FrontLED(OFF); BackLED(OFF, OFF); MotorDir(FWD, FWD); MotorSpeed(0, 0); Msleep(100); while (1) { cmd = ReadRC5(); if (cmd) { cmd &= RC5_MASK; itoa(cmd, text, 16); SerPrint(text); SerPrint("\r\n"); switch (cmd) { case LINKS : SerPrint("LINKS\r\n"); BackLED(ON, OFF); FrontLED(OFF); MotorDir(FWD, FWD); MotorSpeed(0, MAXSPEED); break; case RECHTS : SerPrint("RECHTS\r\n"); BackLED(OFF, ON); FrontLED(OFF); MotorDir(FWD, FWD); MotorSpeed(MAXSPEED, 0); break; case VORWAERTS : SerPrint("VORWAERTS\r\n"); BackLED(OFF, OFF); FrontLED(ON); MotorDir(FWD, FWD); MotorSpeed(MAXSPEED, MAXSPEED); break; case RUECKWAERTS : SerPrint("RUECKWAERTS\r\n"); FrontLED(OFF); BackLED(ON, ON); MotorDir(RWD, RWD); MotorSpeed(MAXSPEED, MAXSPEED); break; case STOPP : SerPrint("STOPP\r\n"); BackLED(OFF, OFF); FrontLED(OFF); MotorSpeed(0, 0); MotorDir(FWD, FWD); break; } } Msleep(100); } return 0; } |
Download des gesamten Projekts als ZIP-Datei.
.