Open luigdima opened 8 years ago
Hello luigdima,
Yes you can! If you have the IBUS UART/USB adapter connected to your device (i.e. raspberry pi), you can open up the python terminal and try the following:
import serial
# ibus commands
DRIVER_WINDOW_DOWN = '3F05000C520165'
DRIVER_WINDOW_UP = '3F05000C530164'
PASSENGER_WINDOW_DOWN = '3F05000C540163'
PASSENGER_WINDOW_UP = '3F05000C550162'
# configuration
baudrate = 9600
handle = None
parity = serial.PARITY_EVEN
port = '/dev/ttyUSB0' # this may vary
timeout = 1
# initialize handle
handle = serial.Serial(port, parity=parity, timeout=timeout, stopbits=1)
# read some data
data = handle.read(1024)
print data
# write a message
handle.write(DRIVER_WINDOW_DOWN)
...
Thanks, Trent
Hello!!!
Thanks for you example!
I tested this code but it did not work.
Is there any way to see if IBUS work?
Only return this message:
root@x303:/home/luigdima/Py# python bmw.py ��" root@x303:/home/luigdima/Py# python bmw.py ��"��Nv��\����
Any idea?
Thank you and sorry :(
No problem! Can you open up a python terminal (on the connected device), and proceed step by step? (this will help identify where the issue is occurring, versus running this standalone as a script)
Regarding the strange characters, these are most likely due to the line
print data
please try
print data.encode('hex')
However, it sounds like you just want to test writing some commands -- this case you can ignore the handle.read(X), and try writing the provided messages/commands.
Thanks, Trent
Hi!!
I have tried with the console directly (serial console). It returns hexadecimal text. Also it sents hexadecimal data it works, up and down the copilot window.
But with your code it doesn't work. Maybe it doesn't sent the ibus string in hexadecimal?
If i try "print data.ecnode('hex') works perfectly (i see the code).
Other question,
The code that you see in the console... ¿how i have to interpret it? I only see hexadecimal data but i don't see the iBus codes.
Thanks, and sorry, My intention is understand the process of the IBus and how to execute it.
Greetings, Luis
2015-07-21 20:44 GMT+02:00 Trent Seed notifications@github.com:
No problem! Can you open up a python terminal (on the connected device), and proceed step by step? (this will help identify where the issue is occurring, versus running this standalone as a script)
Regarding the strange characters, these are most likely due to the line
print data
please try
print data.encode('hex')
However, it sounds like you just want to test writing some commands -- this case you can ignore the handle.read(X), and try writing the provided messages/commands.
Thanks, Trent
— Reply to this email directly or view it on GitHub https://github.com/TrentSeed/BMW_E46_Android_RPi_IBUS_Controller/issues/19#issuecomment-123435240 .
Luis Ignacio Díaz Martínez SysAdim _& _Web developer
Web Site: luigdima.name http://luigdima.name Twitter: twitter.com/luigdima http://twitter.com/luigdima Facebook: facebook.com/luigdima http://facebook.com/luigdima Linkedin: www.linkedin.com/in/luigdima Flickr: flickr.com/photos/luigdima/
Hello,
I tried to use your code for sending data but head unit doesn’t respond to it. But I can listen the line it sends something like this regularly on disabled mode: 68 05 80 41 01 01 ac
I can unlock the head unit with arduino but it doesnt work from computer.
Hello!
A question....
Can I execute directly the code fron my terminal by python? How can I do it?
My idea is create a interactive shell, and send the codes IBus by terminal.
Is posible that you send me an example please?
Thanks,