BMW I-BUS

zalik001
Offline
Зарегистрирован: 10.03.2013

И ТАК КОРОТКО ВОТ КОМАНДЫ МОНИТОРА КАТОРЫЕ ГУЛЯЮТ ПО ШИНЕ I-BUS МОЕГО АВТО 

 

F0 05 FF 47 00 38 75 BMBT --> LOC : BM Status: INFO_pressed
F0 05 FF 47 00 78 35 BMBT --> LOC : BM Status: INFO_long
F0 05 FF 47 00 B8 F5 BMBT --> LOC : BM Status: INFO_released

F0 04 68 48 30 E4 BMBT --> RAD : BM Button: RADIO-BM_pressed
F0 04 68 48 70 A4 BMBT --> RAD : BM Button: RADIO-BM_long
F0 04 68 48 B0 64 BMBT --> RAD : BM Button: RADIO-BM_released

F0 04 68 48 31 E5 BMBT --> RAD : BM Button: FM_pressed
F0 04 68 48 71 A5 BMBT --> RAD : BM Button: FM_long
F0 04 68 48 B1 65 BMBT --> RAD : BM Button: FM_released

F0 04 68 48 21 F5 BMBT --> RAD : BM Button: AM_pressed
F0 04 68 48 61 B5 BMBT --> RAD : BM Button: AM_long
F0 04 68 48 A1 75 BMBT --> RAD : BM Button: AM_released

F0 04 68 48 23 F7 BMBT --> RAD : BM Button: MODE_pressed
F0 04 68 48 63 B7 BMBT --> RAD : BM Button: MODE_long
F0 04 68 48 A3 77 BMBT --> RAD : BM Button: MODE_released

F0 04 68 48 23 F7 BMBT --> RAD : BM Button: MODE_pressed
F0 04 68 48 63 B7 BMBT --> RAD : BM Button: MODE_long
F0 04 68 48 A3 77 BMBT --> RAD : BM Button: MODE_released

F0 04 68 48 11 C5 BMBT --> RAD : BM Button: Preset_1_pressed
F0 04 68 48 51 85 BMBT --> RAD : BM Button: Preset_1_long
F0 04 68 48 91 45 BMBT --> RAD : BM Button: Preset_1_released

F0 04 68 48 02 D6 BMBT --> RAD : BM Button: Preset_4_pressed
F0 04 68 48 42 96 BMBT --> RAD : BM Button: Preset_4_long
F0 04 68 48 82 56 BMBT --> RAD : BM Button: Preset_4_released

F0 04 68 48 01 D5 BMBT --> RAD : BM Button: Preset_2_pressed
F0 04 68 48 41 95 BMBT --> RAD : BM Button: Preset_2_long
F0 04 68 48 81 55 BMBT --> RAD : BM Button: Preset_2_released

F0 04 68 48 13 C7 BMBT --> RAD : BM Button: Preset_5_pressed
F0 04 68 48 53 87 BMBT --> RAD : BM Button: Preset_5_long
F0 04 68 48 93 47 BMBT --> RAD : BM Button: Preset_5_released

F0 04 68 48 12 C6 BMBT --> RAD : BM Button: Preset_3_pressed
F0 04 68 48 52 86 BMBT --> RAD : BM Button: Preset_3_long
F0 04 68 48 92 46 BMBT --> RAD : BM Button: Preset_3_released

F0 04 68 48 03 D7 BMBT --> RAD : BM Button: Preset_6_pressed
F0 04 68 48 43 97 BMBT --> RAD : BM Button: Preset_6_long
F0 04 68 48 83 57 BMBT --> RAD : BM Button: Preset_6_released

F0 04 68 32 10 BE BMBT --> RAD : Volume Control: Decrease 1 step

F0 04 68 32 11 BF BMBT --> RAD : Volume Control: Increase 1 step

F0 04 68 48 06 D2 BMBT --> RAD : BM Button: Radio_on/off_pressed
F0 04 68 48 46 92 BMBT --> RAD : BM Button: Radio_on/off_long
F0 04 68 48 86 52 BMBT --> RAD : BM Button: Radio_on/off_released

F0 04 68 48 24 F0 BMBT --> RAD : BM Button: EJECT_pressed
F0 04 68 48 64 B0 BMBT --> RAD : BM Button: EJECT_long
F0 04 68 48 A4 70 BMBT --> RAD : BM Button: EJECT_released

F0 04 FF 48 08 4B BMBT --> LOC : BM Button: TELEPHONE_pressed
F0 04 FF 48 48 0B BMBT --> LOC : BM Button: TELEPHONE_long
F0 04 FF 48 88 CB BMBT --> LOC : BM Button: TELEPHONE_released

F0 04 68 48 10 C4 BMBT --> RAD : BM Button: SEARCH_<_pressed
F0 04 68 48 50 84 BMBT --> RAD : BM Button: SEARCH_<_long
F0 04 68 48 90 44 BMBT --> RAD : BM Button: SEARCH_<_released

F0 04 68 48 00 D4 BMBT --> RAD : BM Button: SEARCH_>_pressed
F0 04 68 48 40 94 BMBT --> RAD : BM Button: SEARCH_>_long
F0 04 68 48 80 54 BMBT --> RAD : BM Button: SEARCH_>_released

F0 04 68 48 14 C0 BMBT --> RAD : BM Button: Tape_Direction_pressed
F0 04 68 48 54 80 BMBT --> RAD : BM Button: Tape_Direction_long
F0 04 68 48 94 40 BMBT --> RAD : BM Button: Tape_Direction_released

F0 04 FF 48 07 44 BMBT --> LOC : BM Button: CLOCK_pressed
F0 04 FF 48 47 04 BMBT --> LOC : BM Button: CLOCK_long
F0 04 FF 48 87 C4 BMBT --> LOC : BM Button: CLOCK_released

F0 04 68 48 04 D0 BMBT --> RAD : BM Button: TONE_pressed
F0 04 68 48 44 90 BMBT --> RAD : BM Button: TONE_long
F0 04 68 48 84 50 BMBT --> RAD : BM Button: TONE_released

F0 05 FF 47 00 0F 42 BMBT --> LOC : BM Status: SELECT_pressed
F0 05 FF 47 00 4F 02 BMBT --> LOC : BM Status: SELECT_long
F0 05 FF 47 00 8F C2 BMBT --> LOC : BM Status: SELECT_released

F0 04 FF 48 34 77 BMBT --> LOC : BM Button: MENU_pressed
F0 04 FF 48 74 37 BMBT --> LOC : BM Button: MENU_long
F0 04 FF 48 B4 F7 BMBT --> LOC : BM Button: MENU_released

F0 04 FF 48 34 77 BMBT --> LOC : BM Button: MENU_pressed
F0 04 FF 48 74 37 BMBT --> LOC : BM Button: MENU_long
F0 04 FF 48 B4 F7 BMBT --> LOC : BM Button: MENU_released

F0 04 3B 49 01 87 BMBT --> GT : BM_Knob: Left 1 step

F0 04 3B 49 81 07 BMBT --> GT : BM_Knob: Right 1 step

F0 04 3B 48 05 82 BMBT --> GT : BM Button: BM_Knob_pressed
F0 04 3B 48 45 C2 BMBT --> GT : BM Button: BM_Knob_long
F0 04 3B 48 85 02 BMBT --> GT : BM Button: BM_Knob_released

zalik001
Offline
Зарегистрирован: 10.03.2013

МНЕ НУЖНО ЧТО БЫ ЭТИ КОМАНДЫ СЧИТЫВАЛ АРУДИНО И ЭМУЛИРОВАЛ НАЖАТИЕ ПУЛЬТА МЕДИАПЛЕЕРА СООТВЕТСВЕННО ПЕРЕДАВАЛ ЧЕРЕЗ ИК ПЕРЕДАТЧИК КОМАНДЫ ПУЛЬТА 

power 36166A95
DISPLAY 3616AD5
<< 3616827D
>= 361618E7
>> 3616E817
!< 36169867
>! 3616c837
STOP 361620DF
home 361602FD
BACK 361622DD
UP 36167A85
LEFT 36161AE5
RIGHT 3616FA05
DOWN 36163AC5
SETUP 3616A25D
MODE 3616926D
MUSIC 3616A05F
REPRLEY 36165AA5
VOL- 361632CD
VOL+ 3616D827

ENTER 3616BA45

ШИНУ ЧИТАЕТ КОНТРОЛЛЕР MC33290

zalik001
Offline
Зарегистрирован: 10.03.2013

КОНТРОЛЛЕР MC33290 ПОДКЛЮЧЕН КОНТАКТАМ АРДУИНО UNO 0 И 1 

zalik001
Offline
Зарегистрирован: 10.03.2013

 

#include <IRremote.h>

IRsend irsend;
int PIN_A0 = 2;
int PIN_A1 = 4;
int PIN_AV = 5;
int PIN_PWR = 7;
int TM_PWR = 0;
int ST_CAM = 0;
unsigned long RF_Time;
unsigned long OFF_Time;
byte IBUSbyte[8] = {0,0,0,0,0,0,0,0};
byte AUX[8] = {0x68,0x12,0x3B,0x23,0x62,0x10,0x41, 0x55};//команда вывода AUX
int ST_READ = 0; //статус чтения шины
byte AUX_DIS_OFF[8] = {0x00,0x00,0x68,0x04,0x3B,0x46,0x02,0x13}; // команда Radio Display Off, выкл. меню плеера
byte SMO_TMO[8] = {0x00,0x00,0x68,0x04,0x3B,0x46,0x0C,0x1D};// команда Tone menu off. Select menu off
byte TMO[8] = {0x00,0x00,0x68,0x04,0x3B,0x46,0x08,0x19}; //команда Tone menu off
int ST_DIS = 0; // статус дисплея
int ST_DIS_O = 0;
byte INFO_P[8] = {0x00, 0xF0,0x05,0xFF,0x47,0x00,0x38,0x75}; //нажатие кнопки INFO
byte ON[8] = {0x00,0x00,0x68,0x04,0xF0,0x4A,0xFF,0x29}; // включение оранжевого диода
byte OFF[8] = {0x00,0x00,0x68,0x04,0xF0,0x4A,0x00,0xD6}; // выкл. оранж. диода
int DUB = 0; //счетчик перемотки
byte FF_L[8] = {0x00, 0x00, 0xF0,0x04,0x68,0x48,0x40,0x94};
byte FF_R[8] = {0x00, 0x00, 0xF0,0x04,0x68,0x48,0x80,0x54};
int FF_F = 0;
byte REV_L[8] = {0x00, 0x00, 0xF0,0x04,0x68,0x48,0x50,0x84};
byte REV_R[8] = {0x00, 0x00, 0xF0,0x04,0x68,0x48,0x90,0x44};
int REV_F = 0;
byte FR_L[8] = {0x00, 0x00, 0xF0,0x04,0x68,0x48,0x54,0x80}; // вправо - влево
byte FR_R[8] = {0x00, 0x00, 0xF0,0x04,0x68,0x48,0x94,0x40};
int FR_F = 0;
byte CLOCK_L[8] = {0x00, 0x00, 0xF0,0x04,0xFF,0x48,0x47,0x04};
byte CLOCK_R[8] = {0x00, 0x00, 0xF0,0x04,0xFF,0x48,0x87,0xC4};
int CLOCK_F = 0;
byte TONE_P[8] = {0x00, 0x00, 0xF0,0x04,0x68,0x48,0x04,0xD0};
byte SEL_L[8] = {0x00, 0xF0,0x05,0xFF,0x47,0x00,0x4F,0x02};
byte SEL_R[8] = {0x00, 0xF0, 0x05, 0xFF, 0x47,0x00,0x8F,0xC2};
int SEL_F = 0;
byte MENU_P[8] = {0x00, 0x00,0xF0,0x04,0xFF,0x48,0x34,0x77};
byte OK_L[8] = {0x00, 0x00, 0xF0,0x04,0x3B,0x48,0x45,0xC2};
byte OK_R[8] = {0x00,0x00,0xF0,0x04,0x3B,0x48,0x85,0x02};
int OK_F = 0;
byte R_REV_L[8] = {0x00,0x00,0x50,0x04,0x68,0x3B,0x18,0x1F};
byte R_REV_R[8] = {0x00,0x00,0x50,0x04,0x68,0x3B,0x28,0x2F};
int R_REV_F = 0;
byte R_FF_L[8] = {0x00,0x00,0x50,0x04,0x68,0x3B,0x11,0x16};
byte R_FF_R[8] = {0x00,0x00,0x50,0x04,0x68,0x3B,0x21,0x26};
int R_FF_F = 0;
byte GEAR_R[8]= {0x00,0x00,0x80,0x0A,0xBF,0x13,0x00,0x11};
byte GEAR_U[8] = {0x00,0x00,0x80,0x0A,0xBF,0x13,0x00,0x01};

void setup() {
pinMode(PIN_A0, OUTPUT);
pinMode(PIN_A1, OUTPUT);
pinMode(PIN_PWR, OUTPUT);
pinMode(PIN_AV, OUTPUT);
digitalWrite (PIN_A0, LOW);
digitalWrite (PIN_A1, LOW);
digitalWrite (PIN_PWR, HIGH);
Serial.begin(9600);
}

void loop()
{
if ((ST_DIS != ST_DIS_O) && ST_CAM == 0){
if (ST_DIS == 0) {
ST_DIS_O = 0;
PORTD&=~(1<<5);
// digitalWrite (PIN_AV, LOW);
}
else {
ST_DIS_O = 1;
PORTD&=~(1<<2);
PORTD&=~(1<<4);
PORTD|=(1<<5);
//digitalWrite (PIN_A0, LOW);
//digitalWrite (PIN_A1, LOW);
//digitalWrite (PIN_AV, HIGH);
}
}
if (TM_PWR > 1 && ((millis() - OFF_Time) > 10800000 || (millis() - OFF_Time) < 0)){
PORTD|=(1<<7);
//digitalWrite (PIN_PWR, HIGH);
TM_PWR = 0;
}
if ((REV_F > 0 || R_REV_F > 0) && (DUB < 3) &&(ST_READ == 1 || ST_READ == 2) && (millis() - RF_Time) > 3000) {
DUB ++;
irsend.sendNEC(0x219EF807, 32);
RF_Time = millis();
}
if ((FF_F > 0 || R_FF_F > 0) && (DUB < 3) && (ST_READ == 1 || ST_READ == 2) && (millis() - RF_Time) > 3000) {
DUB ++;
irsend.sendNEC(0x219E7887, 32);
RF_Time = millis();
}
if (Serial.available() > 0) {
IBUSbyte [0] = Serial.read();
delay (2);
switch (IBUSbyte [0]) {
case 0x68:
IBUSbyte [1] = Serial.read();
delay (2);
switch (IBUSbyte [1]) {
case 0x12:
IBUSbyte [0] = 0x68;
IBUSbyte [1] = 0x12;
for (int i=2; i<8; i++) {
IBUSbyte [i] = Serial.read();
delay (2);
}
if (ST_READ < 3 && memcmp (IBUSbyte,AUX,8) == 0){ //если ловим команду AUX
if (ST_READ == 0) {
irsend.sendNEC(0x219E50AF, 32);
}
ST_DIS = 1;
ST_READ = 2;
break;
}
else {
if (IBUSbyte [5] == 0x10 && (ST_READ == 1 || ST_READ == 2)) {
ST_DIS = 0;
irsend.sendNEC(0x219E50AF, 32); // жмем на паузу
ST_READ = 0;
}
}
break;
case 0x04:
IBUSbyte [0] = 0x00;
IBUSbyte [1] = 0x00;
IBUSbyte [2] = 0x68;
IBUSbyte [3] = 0x04;
for (int i=4; i<8; i++) {
IBUSbyte [i] = Serial.read();
delay (2);
}
if (memcmp (IBUSbyte, AUX_DIS_OFF, 8) == 0) {
if (ST_READ ==2) {
ST_DIS = 0;
ST_READ = 1;
break;
}
if (ST_READ == 3) {
ST_READ = 1;
break;
}
}
if (ST_READ == 3 && (memcmp (IBUSbyte, SMO_TMO,8) == 0 )) {
ST_DIS = 1;
ST_READ = 2;
break;
}
if (ST_READ == 3 && memcmp (IBUSbyte,TMO,8) == 0) {
ST_READ = 1;
break;
}
if (TM_PWR != 1 && memcmp(IBUSbyte,ON,8) == 0) {
TM_PWR = 1;
PORTD&=~(1<<7);
//digitalWrite (PIN_PWR, LOW);
if (ST_READ > 0) {
irsend.sendNEC(0x219E50AF, 32);
}
break;
}
if (TM_PWR != 2 && memcmp(IBUSbyte,OFF,8) == 0) {
TM_PWR = 2;
OFF_Time = millis();
if (ST_READ > 0) {
irsend.sendNEC(0x219E50AF, 32);
}
break;
}
break;
}
break;
case 0xF0:
IBUSbyte [1] = Serial.read();
delay (2);
switch (IBUSbyte [1]) {
case 0x05:
IBUSbyte [0] = 0x00;
IBUSbyte [1] = 0xF0;
IBUSbyte [2] = 0x05;
for (int i=3; i<8; i++) {
IBUSbyte [i] = Serial.read();
delay (2);
}
if (memcmp (IBUSbyte, INFO_P,8)==0){
if (ST_READ == 1) {
ST_READ = 3;
break;
}
if (ST_READ == 2) {
ST_DIS = 0;
ST_READ = 3;
break;
}
}
if (ST_READ == 1 || ST_READ == 2) {
if (memcmp (IBUSbyte, SEL_L,8) == 0) {
irsend.sendNEC(0x219E20DF, 32); // жмем на стоп
SEL_F = 1;
break;
}
if (memcmp (IBUSbyte,SEL_R,8) == 0) {
if (SEL_F == 0) {
irsend.sendNEC(0x219E50AF, 32); // жмем на паузу
break;
}
else {
SEL_F = 0;
break;
}
}
}
break;
case 0x04:
IBUSbyte [0] = 0x00;
IBUSbyte [1] = 0x00;
IBUSbyte [2] = 0xF0;
IBUSbyte [3] = 0x04;
for (int i=4; i<8; i++) {
IBUSbyte [i] = Serial.read();
delay (2);
}
if (memcmp (IBUSbyte,TONE_P,8) == 0) {
if (ST_READ == 1) {
ST_READ = 3;
break;
}
if (ST_READ == 2) {
ST_DIS = 0;
ST_READ = 3;
break;
}
}
if (ST_READ == 1 || ST_READ == 2) {
if (memcmp (IBUSbyte, REV_L,8) == 0) {
RF_Time = millis();
irsend.sendNEC(0x219EF807, 32); // жмем на перемотку назад
REV_F = 1;
break;
}
if (memcmp (IBUSbyte,REV_R,8) == 0) {
if (REV_F == 0) {
irsend.sendNEC(0x219E40BF, 32); // жмем на PREV
break;
}
else {
irsend.sendNEC(0x219E50AF, 32); // жмем на PLAY
REV_F = 0;
DUB = 0;
break;
}
}
if (memcmp (IBUSbyte, FF_L,8) == 0) {
RF_Time = millis();
irsend.sendNEC(0x219E7887, 32); // жмем на перемотку вперед
FF_F = 1;
break;
}
if (memcmp (IBUSbyte,FF_R,8) == 0) {
if (FF_F == 0) {
irsend.sendNEC(0x219E807F, 32); // жмем на NEXT
break;
}
else {
irsend.sendNEC(0x219E50AF, 32); // жмем на PLAY
FF_F = 0;
DUB = 0;
break;
}
}
}
if (ST_READ == 2) {
if (memcmp (IBUSbyte, OK_L,8) == 0) {
irsend.sendNEC(0x219ED827, 32); // жмем на BACK
OK_F = 1;
break;
}
if (memcmp (IBUSbyte,OK_R,8) == 0) {
if (OK_F == 0) {
irsend.sendNEC(0x219E10EF, 32); // жмем на ENTER
break;
}
else {
OK_F = 0;
break;
}
}
if (IBUSbyte[4] ==0x3B && IBUSbyte[5] ==0x49){
if(IBUSbyte[6] > 0x80) {
irsend.sendNEC(0x219EA05F, 32); //жмем UP
break;
}
else {
irsend.sendNEC(0x219E00FF, 32); //жмем DOWN
break;
}
}
if (memcmp (IBUSbyte, FR_L,8) == 0) {
irsend.sendNEC(0x219E906F, 32); // жмем на RIGHT
FR_F = 1;
break;
}
if (memcmp (IBUSbyte,FR_R,8) == 0) {
if (FR_F == 0) {
irsend.sendNEC(0x219EE01F, 32); // жмем на LEFT
break;
}
else {
FR_F = 0;
break;
}
}
if (memcmp (IBUSbyte,MENU_P,8) == 0) {
ST_DIS = 0;
break;
}
if (memcmp (IBUSbyte, CLOCK_L,8) == 0) {
irsend.sendNEC(0x219E08F7 , 32); // жмем на EJECT
CLOCK_F = 1;
break;
}
if (memcmp (IBUSbyte,CLOCK_R,8) == 0) {
if (CLOCK_F == 0) {
irsend.sendNEC(0x219E58A7, 32); // жмем на OPTION
break;
}
else {
CLOCK_F = 0;
break;
}
}
}
break;
}
break;
case 0x50:
IBUSbyte [1] = Serial.read();
delay (2);
switch (IBUSbyte [1]) {
case 0x04:
IBUSbyte [0] = 0x00;
IBUSbyte [1] = 0x00;
IBUSbyte [2] = 0x50;
IBUSbyte [3] = 0x04;
for (int i=4; i<8; i++) {
IBUSbyte [i] = Serial.read();
delay (2);
}
if (memcmp (IBUSbyte, R_FF_L,8) == 0) {
RF_Time = millis();
irsend.sendNEC(0x219E7887, 32); // жмем на перемотку вперед
R_FF_F = 1;
break;
}
if (memcmp (IBUSbyte,R_FF_R,8) == 0) {
if (R_FF_F == 0) {
irsend.sendNEC(0x219E807F, 32); // жмем на NEXT
break;
}
else {
irsend.sendNEC(0x219E50AF, 32); // жмем на PLAY
R_FF_F = 0;
DUB = 0;
break;
}
}
if (memcmp (IBUSbyte, R_REV_L,8) == 0) {
RF_Time = millis();
irsend.sendNEC(0x219EF807, 32); // жмем на перемотку назад
R_REV_F = 1;
break;
}
if (memcmp (IBUSbyte,R_REV_R,8) == 0) {
if (R_REV_F == 0) {
irsend.sendNEC(0x219E40BF, 32); // жмем на PREV
break;
}
else {
irsend.sendNEC(0x219E50AF, 32); // жмем на PLAY
R_REV_F = 0;
DUB = 0;
break;
}
}
break;
}
break;
case 0x80:
IBUSbyte [1] = Serial.read();
delay (2);
switch (IBUSbyte [1]) {
case 0x0A:
IBUSbyte [0] = 0x00;
IBUSbyte [1] = 0x00;
IBUSbyte [2] = 0x80;
IBUSbyte [3] = 0x0A;
for (int i=4; i<8; i++) {
IBUSbyte [i] = Serial.read();
delay (2);
}
if (ST_CAM == 0 && memcmp (IBUSbyte,GEAR_R,8) == 0) {
ST_CAM = 1;
PORTD|=(1<<2);
PORTD&=~(1<<4);
PORTD|=(1<<5);
//digitalWrite (PIN_A0, HIGH);
//digitalWrite (PIN_A1, LOW);
//digitalWrite (PIN_AV, HIGH);
break;
}
if (ST_CAM == 1 && memcmp (IBUSbyte,GEAR_U,8) == 0) {
ST_CAM = 0;
if (ST_DIS == 0) {
PORTD&=~(1<<5);
//digitalWrite (PIN_AV, LOW);
}
else {
PORTD&=~(1<<2);
PORTD&=~(1<<4);
PORTD|=(1<<5);
//digitalWrite (PIN_A0, LOW);
//digitalWrite (PIN_A1, LOW);
//digitalWrite (PIN_AV, HIGH);
}
break;
}
break;
}
break;
}
}

}

ИЛИ МОЖНО ВОТ ЕЕ ПОД ПРАВИТЬ, 

ОНА НЕ РАБОТАЕТ ПОКА НЕ УВИДИТ В ШИНЕ I-BUS ЧТО AUX ВКЛЮЧЕН 

JollyBiber
JollyBiber аватар
Offline
Зарегистрирован: 08.05.2012

Выключите капс и научитесь вставлять код.