ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

error in "spi_sendReceive" (Arduino side)?

Hi there,

I was having trouble receiving SPI-messages. Checked the communication with a logic sniffer (everything as expected on the SPI-side) and I think I found the problem in the Arduino-code, function "spi_sendReceive".

After changing

...

Serial.print(SPI.transfer(command[i+6])); // this sends ASCII-characters

...

to

...

Serial.write(SPI.transfer(command[i+6])); // this sends raw hex-values

...

the correct data was sent to the PC. Am I messing something up here or was there really a bug in the code? Couldn't find any anything on the web about similar problems.

I'd be glad if someone could comment.

cheers

stefan

Message 1 of 3
(3,658 Views)

I believe you are correct.  IIRC, I found this once before but was not able to test it personally.

0 Kudos
Message 2 of 3
(3,253 Views)

Thank  you!!! I did the same (Serial.write(SPI.transfer(command[i+6])); // this sends raw hex-values) & everything is all right now!!!

0 Kudos
Message 3 of 3
(3,253 Views)