CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Wed Jun 19, 2019 7:51 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Bluetooth device
PostPosted: Sat Dec 08, 2018 10:38 pm 
Offline

Joined: Thu Nov 29, 2018 7:04 pm
Posts: 2
Hi Guy's,

i need some help... :shock:
since several day i'd try to read the inputs from a bluetooth(wiimote)/usb(Xbox controller) device but without access...
both devices are not connected at the same time.

i used "joystick" to assign the devices

what i've tried frist:
i used the "SysFileAsync" -lib and an example from Viacheslav Mezentsev(Thanks!) to read out "dev/input/js0", i got some values but, these are crap and doesn't match with "hexdump".

then i've tried to use the "SerialCommVisu" example from the store, but without access too.
i didn't recive any input...

Code:
//set the special parameters for the port
// depending on the Port and the bandwidth the values should be adapted
IF xTwoLines THEN
   FirstSerialLine(
      slMode:= SL_READ, //reading port
      udiPort:= 1, //Port number
      udiBaudrate:= 11500, //bandwidth
      paParity:= COM.PARITY.EVEN, //the parity is optional
      sbStopBits:= COM.STOPBIT.ONESTOPBIT,
      udiByteSize := 8); //the stopbits are optional );
(*   SecondSerialLine(
      slMode:= SL_WRITE,  //writing port
      udiPort:= 2,
      udiBaudrate:=11500,
      paParity:= COM.PARITY.EVEN,
      sbStopBits:= COM.STOPBIT.ONESTOPBIT,
      udiByteSize := 8);*)
ELSE
   (*ThirdSerialLine(
      slMode:= SL_READWRITE,
      udiPort:= 6,
      udiBaudrate:= 9600,
      paParity:= COM.PARITY.EVEN,
      sbStopBits:= COM.STOPBIT.ONESTOPBIT,
      udiByteSize := 8)*);
END_IF


here my "CODESYScontrol_user.cfg" config:

Quote:
[SysCom]
;Linux.Devicefile=/dev/ttyS
Linux.Devicefile=/dev/input/js0 //<-- joystick assignment for the Xb contoller or the Wiimote
Linux.Devicefile=/dev/ttyAMA0 // <-- the wiimote is assigned to this device



maybe someone has experience with this kind of application and give me an advice or push me on the right track. :D

in the case of the implementation of BT devices via onboard BT controller of the Pi, Edwin can give some advices :3
https://forum.codesys.com/viewtopic.php?t=8361

thanks for your help! :>

BG/Mfg,

Christoph


Top
   
 Post subject: Re: Bluetooth device
PostPosted: Sat Dec 08, 2018 11:29 pm 
Offline

Joined: Mon Dec 13, 2010 3:02 pm
Posts: 53
Hi Chris!

Sounds like a cool project!
I think the way to go is to use the library CmpCharDevice to access the event interface directly.

This bypasses all buffers and gives you a similar access as you achieve with the system calls open, read, write, close and ioctl directly.

It would be great if you share your results after you got s.th. working. Preferably on https://forge.codesys.com which is still in a beta phase, to which you are heartly invited. ;)

BR,
Ingo

Gesendet von meinem LG-H870 mit Tapatalk


Top
   
 Post subject: Re: Bluetooth device
PostPosted: Mon Dec 10, 2018 11:51 am 
Offline

Joined: Thu Nov 29, 2018 7:04 pm
Posts: 2
Hi Ingo,

thank you for your response! :D
i will try it out the next days... and for sure i will share the project and my experiences :).


Top
   
 Post subject: Re: Bluetooth device
PostPosted: Thu Dec 13, 2018 7:49 am 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 3316
Hi,
for the com port settings you need to add in

/etc/CODESYSControl_User.cfg

[SysCom]
Linux.Devicefile=/dev/ttyAMA

if you need to use more and different serial coms you need to do this in UDEV rules (under Linux)
or even ( not nice) with symbolic links for exmaple /dev/ttyS-> /dev/ttyAMA1 then ttyAMA0 is Com1 and ttyAMA1 is Com2

According the CmpChardevice... to read for exmaple/dev/input/js0 see attached example.


BR
Edwin


You do not have the required permissions to view the files attached to this post.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited