View difference between Paste ID: ZwGAAhPm and HHaCLFHD
SHOW: | | - or go back to the newest paste.
1
#include <nRF905.h>
2
#include <SPI.h>
3
4
void setup()
5
{
6
	// Start up
7
	nRF905_init();
8
9
	// Put into receive mode
10
	nRF905_receive();
11
12
	Serial.begin(9600);
13
14
	Serial.println(F("Server started"));
15
}
16
17
void loop()
18
{
19
	Serial.println(F("Waiting for data..."));
20
21
	// Make buffer for data
22
	byte buffer[NRF905_MAX_PAYLOAD];
23
24
	// Wait for data
25
	while(!nRF905_getData(buffer, sizeof(buffer)));
26
27
	Serial.println(F("Got data"));
28
29
	int val;
30-
	memcpy(val, buffer, sizeof(val));
30+
	memcpy(&val, buffer, sizeof(val));
31
32
	Serial.println(val);
33
34
	// Put back into receive mode
35
	nRF905_receive();
36
}