- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I have a question about mraa.
There are uart methods of writeStr and readStr in java.
I would like to use uart methods of byte read and write.
Do I have to modify the mraa source (uart.java?) file?
Where Is the source file in java?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi hajime_s,
Thank you for your interest in the Intel Edison Platform.
You shouldn't have to change the mraa library, please try to update it by using the following commands:
1. root@edison:~# ifconfig wlan0 up
2. root@edison:~# echo "src mraa-upm http://iotdk.intel.com/repos/1.1/intelgalactic" > /etc/opkg/mraa-upm.conf
3. root@edison:~# opkg update
4. root@edison:~# opkg install libmraa0
Also please check this link were they use the mraa library to access the UART functionality: http://www.tektyte.com/docs/docpages/edison-reference/UART.html UART on the Intel Edison — Tektyte 1.0 documentation.
I will be waiting for your reply, have a nice day.
Best Regards,
-Jose
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I tried the commands on my edison.
But I can not compile my java program,
The method write(String, int) is undefined for the type Uart
I am using the iss-iot-launcher.bat.
I can use mraa_uart_write() function in C language, but I can not find the same function in Java language.
Best regards,
Hajime.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Hajime,
Can you please try this code https://github.com/intel-iot-devkit/mraa/blob/master/examples/java/UartExample.java mraa/UartExample.java at master · intel-iot-devkit/mraa · GitHub, I already try it in the Intel System Studio and it compile with no errors. Please let me know your results.
I will be waiting for your reply, have a nice day.
Best Regards,
-Jose
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Jose,
Thank you for your quick reply.
The had tried the code. It worked well.
I would like to use 'write bytes' instead of 'write string'.
I would like to use 'read bytes' instead of 'read string'.
Best regards,
Hajime.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Hajime,
Could you please hand me your code that you mention in one of your previous reply. This in order to replicate your issue. I will be waiting for your reply.
We hope you have a nice day!
Best Regards,
-Jose
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Jose,
Thank you for your quick reply.
I would like to use the function for C languages in Java.
int mraa_uart_write( mraa_uart_context dev,const char * buf,size_t length )There is not the same function in Java.
Best regards,
Hajime
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Hajime,
I'm sorry, I understood that you had written code and had some compilation problems. I investigated for a function equivalent to int mraa_uart_write ( mraa_uart_context dev,const char * buf,size_t length ) in java. I found this link http://iotdk.intel.com/docs/master/mraa/java/classmraa_1_1_uart.html# ac9a4bea13d1bbc3c6821cc0c208c7e84 mraa: Uart Class Reference were it shows all the available functions in java, as you can see there is no equivalent function in java. I would suggest to use the uart.writeStr() and use a decoder in order to obtain the bytes you are looking to transmit. I hope you find this information useful.
I will be waiting for your reply, we hope you have a nice day.
Best Regards,
-Jose
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Jose,
I would like to write binary data (0xFF, 0xFF, 0xFA, 0xAF...) via uart.
Best regards,
Hajime.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Hajime,
As you know char functions consist of 2 bytes, so if you want to send a byte you can use this function stringBytes[i] = (byte) stringChars[i] & 0x00FF. Refer to this link for more information (http://stackoverflow.com/questions/9139453/how-to-convert-char-to-byte java - How to convert char to byte? - Stack Overflow ). I hope you find this information useful.
I will be waiting for your reply, I hope you have a nice day.
Best Regards,
-Jose.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Hajime,
Always happy to help, if you have any more questions please don't hesitate to contact us.
Have a nice day!
Best Regards,
-Jose.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page