2023-06-01 15:28:39 +02:00
|
|
|
#include <SPI.h>
|
|
|
|
#include <RF24.h>
|
2023-06-01 15:52:34 +02:00
|
|
|
//TODO Sende analoge daten für joystick
|
2023-06-01 15:28:39 +02:00
|
|
|
RF24 radio(9, 10); // (CE, CSN)
|
|
|
|
const byte address[6] = "1RF24";
|
2023-06-02 14:33:20 +02:00
|
|
|
struct dataStruct {
|
|
|
|
int Xposition;
|
|
|
|
int Yposition;
|
2023-06-01 15:28:39 +02:00
|
|
|
|
2023-06-02 14:33:20 +02:00
|
|
|
} myData;
|
2023-06-27 18:07:14 +02:00
|
|
|
|
2023-06-01 15:28:39 +02:00
|
|
|
void setup() {
|
|
|
|
radio.begin();
|
|
|
|
radio.setPALevel(RF24_PA_MAX);
|
2023-07-04 18:50:52 +02:00
|
|
|
radio.setChannel(50);
|
2023-06-01 15:28:39 +02:00
|
|
|
radio.openWritingPipe(address);
|
|
|
|
radio.stopListening();
|
2023-06-27 17:42:41 +02:00
|
|
|
Serial.begin(9600);
|
2023-06-01 16:36:40 +02:00
|
|
|
|
2023-06-01 15:28:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
// Serial.println(radio.isChipConnected());
|
|
|
|
|
2023-06-01 16:36:40 +02:00
|
|
|
myData.Xposition = analogRead(0);
|
|
|
|
myData.Yposition = analogRead(1);
|
|
|
|
radio.write(&myData, sizeof(myData), 1);
|
2023-06-01 15:28:39 +02:00
|
|
|
delay(10);
|
|
|
|
}
|