SPI between UNO and wemos D1 mini (esp8266).

I am trying to get an SPI link between a UNO and a Wemos D1 mini which is an esp8266 with on board ftdi, etc.

I need to send floats and int to the UNO when a change to those values occurs, and the UNO needs to send float back to wemos at regular intervals.

I have tried the SPI_safe_master and SPI_slave_test examples and they run fine with UNO as master. I cannot work out how to change from string to int or float!! :confused:

I have read and tried Nick Gammons SPI_anything examples but neither the slave or master wont load onto the wemos.

Arduino: 1.6.11 (Linux), Board: "WeMos D1 R2 & mini, 80 MHz, 921600, 4M (3M SPIFFS)"

In file included from /tmp/arduino_modified_sketch_721500/spi_anything_slave.ino.ino:4:0:
/home/chris/Arduino/libraries/SPI_anything/SPI_anything.h: In function 'unsigned int SPI_readAnything_ISR(T&)':
/home/chris/Arduino/libraries/SPI_anything/SPI_anything.h:26:12: error: 'SPDR' was not declared in this scope
     *p++ = SPDR;  // get first byte
            ^
/tmp/arduino_modified_sketch_721500/spi_anything_slave.ino.ino: In function 'void setup()':
spi_anything_slave.ino:24: error: 'SPCR' was not declared in this scope
   SPCR |= _BV(SPE);
   ^
In file included from sketch/spi_anything_slave.ino.ino.cpp:1:0:
spi_anything_slave.ino:24: error: 'SPE' was not declared in this scope
   SPCR |= _BV(SPE);
               ^
/home/chris/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/Arduino.h:184:25: note: in definition of macro '_BV'
 #define _BV(b) (1UL << (b))
                         ^
Multiple libraries were found for "SPI.h"
 Used: /home/chris/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/libraries/SPI
 Not used: /home/chris/Downloads/arduino-1.6.11/libraries/SPI
exit status 1
'SPCR' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I am a newbie and I struggle to understand the formatting and punctuation for this comms stuff whether it be spi or I2c or radio, so I need a guided hand.

I cannot work out how to change from string to int or float!!

What is exchanged is an array of bytes. Whether those bytes are ints, floats, bytes, or chars does not matter.

neither the slave or master wont load onto the wemos.

Neither of them will not load. That's good.

Thanks for your response PaulS,
Using the SPIsafe_slavemaster example, how would I send a float? and then have the slave answer with an int?

PaulS:
What is exchanged is an array of bytes.

Hmmmm. Have you thought about...

...Googling arduino x to byte array

or

...Googling arduino byte array to x

where x = float or x = integer

?

DaveEvans:
Hmmmm. Have you thought about...

...Googling arduino x to byte array

or

...Googling arduino byte array to x

where x = float or x = integer

?

Not specifically no.
I have however googled the hell out of "arduino array on spi" and "int on spi" with no usable results. But thanks, I'll try "x="!!!