MrYsLab / pymata-aio

This is the second generation PyMata client.
https://github.com/MrYsLab/pymata-aio/wiki
GNU Affero General Public License v3.0
155 stars 51 forks source link

Trying to read from RX #88

Closed MrYsLab closed 5 years ago

MrYsLab commented 5 years ago

@Kushal4092 reported the following error: Hi, I am using Pymata3 https://htmlpreview.github.io/?https://github.com/MrYsLab/pymata-aio/blob/master/documentation/html/pymata3.m.html#header-classes

library and I am trying to read Rx from my arduino but it says I need to upload FirmataPlusRB. when I do that I get an error. When I upload FirmataPlusRBPixy its fine, but when I am trying to use the pixy_get_block I get empty [] and when I wait but a bit longer the program crashes and says Initializing Arduino - Please wait... Write exception Write exception Write exception

Shutting down ... Write exception

I was using StandardFirmata and It was working fine but I was not able to use the this function.

this is the Code: board.pixy_init(max_blocks=1, cb=None,cb_type=Constants.CB_TYPE_ASYNCIO) print(board.pixy_get_blocks()) @MrYsLab

MrYsLab commented 5 years ago

FirmataPlusRBPixy is specifically used when attaching a PixyCam mounted on a Sparkfun Redbot Robot. FirmataPlusRB is used specifically for the Sparkfun Redbot (but no pixy support).

If you are not using either of those devices, I suggest using FirmataPlus for Uno compatibles and FirmataPlus32u4 for Leonardo compatibles.

Now, on to reading RX. You have not provided much detail about your project, but when Firmata is used with any serial device (USB/Serial, Bluetooth, WiFly, etc.), you do not have access to the RX and TX pins - they are dedicated and cannot be shared.

Does this answer your question?

MrYsLab commented 5 years ago

I am going to close this issue. If my explanation above did not answer your question, or if you think there is a problem in the code, I will be happy to reopen it. Please feel free to add any comments even though the issue is closed and I will see them.

Kushal4092 commented 5 years ago

I am trying to get the values from Rx and Tx from another device to my arduino which uses UART programmable interface. I came across Pixy Serial Protocol.

MrYsLab commented 5 years ago

I am not clear on how you have things connected or what you are trying to do. As I said above, if you are trying to access the TX/RX pins on the Arduino through Firmata, you cannot. Those pins are dedicated to providing communication between the Arduino Firmata sketch and pymata-aio.

The pixy devices use SPI to communicate with an Arduino. Firmata does not support SPI. FirmataPlusRBPixy, however, implements the SPI interface specifically to communicate with the Pixy. If you are not using a Pixy then this sketch will not help. The code that writes to the pixy is located here