robob
02.02.2008, 12:37
hey ich wollte ein programm schreiben mit dem man die leds per fernbedienung ein/auschaltet. aber es geht irgendwie nicht! schaut euch den code mal an:
#include "RP6RobotBaseLib.h"
void receiveRC5Data(RC5data_t rc5data)
{ int ii;
// Output the received data:
writeString_P("Toggle Bit:");
writeChar(rc5data.toggle_bit + '0');
writeString_P(" | Device Address:");
writeInteger(rc5data.device, DEC);
writeString_P(" | Key Code:");
writeInteger(rc5data.key_code, DEC);
writeChar('\n');
int zahl = 0;
ii = rc5data.key_code;
if (rc5data.key_code = zahl)
{
setLEDs(0b000001);
writeString("LED 1\n");
mSleep(500);
zahl = 0;
}
if (ii = 2)
{
setLEDs(0b000010);
writeString("LED 2\n");
}
if (ii = 3)
{
setLEDs(0b000100);
writeString("LED 3\n");
}
if (ii = 4)
{
setLEDs(0b001000);
writeString("LED 4\n");
}
uint8_t movement_command = false;
}
int main(void)
{
initRobotBase();
IRCOMM_setRC5DataReadyHandler(receiveRC5Data);
powerON();
while(true)
{
task_RP6System();
}
return 0;
}
#include "RP6RobotBaseLib.h"
void receiveRC5Data(RC5data_t rc5data)
{ int ii;
// Output the received data:
writeString_P("Toggle Bit:");
writeChar(rc5data.toggle_bit + '0');
writeString_P(" | Device Address:");
writeInteger(rc5data.device, DEC);
writeString_P(" | Key Code:");
writeInteger(rc5data.key_code, DEC);
writeChar('\n');
int zahl = 0;
ii = rc5data.key_code;
if (rc5data.key_code = zahl)
{
setLEDs(0b000001);
writeString("LED 1\n");
mSleep(500);
zahl = 0;
}
if (ii = 2)
{
setLEDs(0b000010);
writeString("LED 2\n");
}
if (ii = 3)
{
setLEDs(0b000100);
writeString("LED 3\n");
}
if (ii = 4)
{
setLEDs(0b001000);
writeString("LED 4\n");
}
uint8_t movement_command = false;
}
int main(void)
{
initRobotBase();
IRCOMM_setRC5DataReadyHandler(receiveRC5Data);
powerON();
while(true)
{
task_RP6System();
}
return 0;
}