When I add the code from R_Plotrawdata3_test.ino to the file receive_xbee_working_6_17_16.ino, the code stops working I believe because there's a conflict with the serial ports.
UPDATE: I got this working by keeping this in void setup
xbee.setSerial(Serial)
Upload the code while shield button is in Dline position. Once upload is complete change switch to UART.
I'd really like to have the xbee use a softwareSerial so that the hardware serial is open for debugging. But I can't figure out how to do it. In the example code in void setup they initialize the serial as
xbee.setSerial(Serial)
I tried to do initialize a softwareSerial port:
SoftwareSerial xb(2, 3); // RX, TX
then in void setup, I tried
xbee.setSerial(xb)
as well as
xbee.setSerial(SoftwareSerial)
And neither one worked.
Here's a post on using different serial ports. But the problem is I don't understand how setSerial works. From looking at the xbee.h library, it looks like it's a pointer to the serial, so maybe &xb or *xb works. I'll ask Graziano!
https://community.particle.io/t/arduino-core-softwareserial-and-serial1/9058
From what I've read, the BNO055 defaults to the hardware serial port on digital pins 0 and 1 on the arduino uno.
I'm not sure how to change them. But this link talks about reading two BNO055's on the same arduino. They change one sensor to 0x28 and the other to 0x29. I'm not sure how this works.
http://www.timothyjmeo.com/downloads/code-repository/utility-sketches/_16_Read_Two_BNO055_Sensors.ino
Here are some links to check out:
https://forums.adafruit.com/viewtopic.php?f=19&t=92598
My code didn't work and by that I mean that my debugging messages weren't sent to the serial port. Maybe this is because the BNO055 is using the serial port. Next, I will add code to correctly calculate the checksum to send a packet over xbee and see if/what I get in XCTU.
Things to consider:
1. The api packet sends bytes. How do I convert floats to bytes?
- one way is to figure out how much the values change, then multiply the change by a number to make an int. Then convert at the receiving end.
Here's one example. Working code is included in the post.
2. Is it possible to read from the BNO055, then close bno.begin() and then do everything else?
No comments:
Post a Comment