i use customer message and send it broadcast over radio channel, i use example 6 (CounterSend ) from this link .
when i build this project as micAz on mote 1, after this i use Xsniffer (TOSBase) on the mote that i will use it on the serial usb board (520).
after that i open Xsniffer program to see the radio packet and they appeared as following :
on other hand, to use Xserver i use XMeshBase then type on cygwin terminal :
xserve -device=com4
i got this!! but i can't understand what it received ?
how can i parse the data received ?? and named them as i want ?? ex: i need first byte be the source ??
how to do that ?
Related
Background:
I was given a task for college to implement an elevator's source code for an Arduino UNO with a user interface shield that contains: a 7-Segment display and a total of 8 buttons, one for each floor plus two to control the doors. The floor buttons also have an LED.
The hardware is only for human user input, but the brains is made entirely within Erlang. Before we got to implement this project in hardware, we used a simulation that uses wxWidgets to display the following UI: a window that displays the elevator doors, 6 more windows for each floor, and a window for the internal button array of the elevator. This button array is what I'm trying to implement within an Arduino.
Some code:
Our teacher gave us some confusing notes about the use of erlang:open_port/2 that I can't understand yet. The testing code we're using is the following:
-module(proUSB).
-export([start/1, order/2, loop/1, exit/2]).
start(Port_alias) ->
Port = open_port(Port_alias, []),
Pid = spawn(proUSB, loop, [Port]),
port_connect(Port, Pid),
{Port,Pid}.
order(Port,Value) ->
port_command(Port,Value).
loop(P) ->
receive
{P,{data,A}} ->
io:format("Received: ~p~n", [A]),
loop(P);
{'EXIT',P,_Reason} ->
port_close(P),
io:format("Unexpected finalization~n",[]);
exit ->
io:format("Proces finalization~n",[]);
Other -> io:format("Fi ~p~n",[Other])
end.
exit(Pid, Port) ->
port_close(Port),
Pid!exit.
As I've understood and successfully tested in Windows Subsystem for Linux (WSL) with the code mentioned above, all I have to execute in the Erlang shell is
> {Port, Pid} = proUSB:start("/dev/ttyS6").
{#Port<0.7>,<0.82.0>}
This will open the port. I can now send orders to the Arduino USART in the protocol we've designed. To light up the number three in the 7-segment display, we write
> proUSB:order(Port,"D3").
true
Now, if we press the floor button 1, you can see in the terminal
Received: "B1\n"
Received: "\n"
Received: "B1\n"
Received: "\n"
My question:
If I want to use Windows Powershell to do the same connection to the serial port, my teacher told us to write "COM6" instead of "/dev/ttyS6", but as I have tested, I can't get a connection but I get this error
> {Port, Pid} = proUSB:start("COM6").
** exception exit: einval
>
What am I missing? If WSL works with "/dev/ttyS6", why shouldn't it work with Windows when I can use the serial port with "RealTerm: Serial Capture Program"?
I use a RN4020 BLE Module to communicate with the VALRT BT Button: https://vsnmobil.com/products/v-alrt/specs
Problem is, I need to send "80BEF5ACFF" within 30sec after connect to the specific private UDID "FFFFFFF5-00F7-4000-B000-000000000000" (see reference: https://github.com/HoyosIntegrity/V.ALRT-bluetooth-spec)
Problem is, I always get "ERR" back from RN4020.
Here is my Initialisation Code (which works):
sf,2 //Factory Reset
+ //echo on
sr,92000000 //configure as Master
r,1 //reboot
F //search devices
X //stop searching
E,0,001EC026C931 //connect to device with mac: 001EC026C931 which is my device
B //Bond
Get a "Connected" back and the Button quit it with a Beep.
Now I tried to Write
CUWV,FFFFFFF5-00F7-4000-B000-000000000000,80BEF5ACFF
with and without "-" but allways get a error back. At github are samples for Android and iOS but its not clear for me what I have to send...
Think I forgotten a prestep, but I dont know which one.
Strange is, when I connect and send "LC" I get this back:
180A
2A23,0012,02
2A24,0014,02
2A25,0016,02
2A26,0018,02
2A27,001A,02
2A28,001C,02
2A29,001E,02
2A2A,0020,02
1803
2A06,0025,0A
1802
2A06,0028,04
1804
2A07,002B,02
2A07,002C,10
180F
2A19,002F,02
2A19,0030,10
FFFFFFA000F74000B000000000000000
FFFFFFA100F74000B000000000000000,0034,0A
FFFFFFA200F74000B000000000000000,0037,02
FFFFFFA300F74000B000000000000000,003A,00
FFFFFFA300F74000B000000000000000,003B,10
FFFFFFA400F74000B000000000000000,003E,00
FFFFFFA400F74000B000000000000000,003F,10
FFFFFFA500F74000B000000000000000,0042,00
FFFFFFA500F74000B000000000000000,0043,10
END
That are some of the services but not all.
I am writing a simple code to find the USB to serial port in Windows platform, if the port is what I want (can be filt by VID/PID number), then the program will open the port.
I use MonkeyBread plugin, WinUSBDeviceMBS, with property of VendorID and ProductID, I can select specific USB port. sample code as following.
Dim devices() As WinUSBDeviceMBS = WinUSBDeviceMBS.devices
For Each d As WinUSBDeviceMBS in devices
msgbox d.vendor+"-" + str(Hex(d.VendorID),"0000") + " " +d.product+"-" + str(Hex(d.ProductID),"0000")+d.serialnumber
Next
'this will give you a message box with "FTDI-0403 FT232R USB UART-6001 A60251HV"
Also, with help of Serial.serialport.Name, I can get the COM port name for serial device.
dim i, count as Integer
count = System.SerialPortCount
for i = 0 to count - 1
Msgbox System.SerialPort( i ).Name
next
'this will popup msgbox with "COM1" or "COM3"... all the valid port number, but no vendor info or product info
But I can't find a method to match those two together. Any ideas?
Assuming you are only using Windows you will need to use the registry to get this information.
You can get a list of all COM ports on the system here: HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM. Values will be listed according to their type, so a real serial port will show up with a name \Device\Serialn and data COMxx, other devices might be different. If you look here you can find a name you can use to filter which type of device a COM port belongs to, then simply list these in your application.
You can do this in Xojo by using the Declare statement to hook into the API of the Windows DLLs:
https://docs.xojo.com/index.php/Declare
Here is a document on the Registry API functions, they will be used as described here, but using the Declare statement mentioned above:
http://support.microsoft.com/kb/145679
I am using Asterisk E1 card on CentOS 6.2.
When I call on my asterisk system using a simple pstn or by a mobile phone, the call perfectly run. But when the same number has called by a PABX phone, the asterisk system ignored some digits.
I am using asterisk 1.4 and dahdi 2.4.
I have also tried the dtmfmode = rfc2833 in the sip.conf file. Please some one hemp me resolve this problem.
eg: What actually Our system do, when some one call on our system, we ask for for a 14 digit registration id, and perform some operation on it and it work fine. But when some one call from their own PBX phone (or PABX or soft phone) and enter the registration id, then our system ignore some digits.
I also had this problem some times ago this some PBXs.
this help for me:
relexdtmf=yes
Example of my channel.conf:
; SPAN 1-4 = E1 (1-15,17-31,32-46,48-62,63-77,79-93,94-108,110-124)
; ------------------
switchtype = euroisdn
; Type of Number (TON) for called number
pridialplan = local
; Type of Number (TON) for calling number
prilocaldialplan = private
signalling = pri_cpe
context = incoming
group = 1
immediate = no
overlapdial = yes
channel => 1-15,17-31,32-46,48-62,63-77,79-93,94-108,110-124
; activate this option if there are problems with dtmf detection
relexdtmf=yes
I suppose you meant 'call from PBX internal extension' from 'call from their own PBX phone'.
I have faced issue like this. In my case the issue was with the phone. some old or broken IP phone failed to generate proper DTMF signals. Have you tried different phones like soft phones.
I am in a need to send data thru serial port in vxworks. I am using the following code. But
it is not working.can anyone point out what went wrong?
int f;
if(f=open("/tyCo/1",O_RDWR,0)<0)
{
printf("Error opening serial port.");
return 1;
}
write(f,"hello",5);
after running this code, no data is comming thru serial port but instead it comes thru
terminal(Tornado shell). The system has two serial devices /tyCo/1 and /tyCo/0. I tried them both, but the problem persists.
Thanks in adavnce
Likhin.
Have you set the baud rate?
if (iocl(m_fd, FIOBAUDRATE, rate )) == ERROR )
{
//throw error
}
It is possible that you are using the wrong name for the device, and that Tornado Shell is set to your default device. From vxdev.com:
If a matching device name cannot be found, then the I/O function is directed
at a default device. You can set this default device to be any device in the
system, including no device at all, in which case failure to match a device
name returns an error. You can obtain the current default path by using
ioDefPathGet( ). You can set the default path by using ioDefPathSet( ).
The 3rd parameter of "open" command is, if I am not wrong, the mode. I do not really understand what it is needed for in vxworks, except for code comparability with UNIX. In short -try to give some value like 0644 or 0666. I think this will help.