Whandall:
So you probaby still have the & in the send part. Try this or something like this
#include <JoystickShield.h>
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10);
JoystickShield joystickShield;
const uint64_t rxAddr = 0xE8E8F0F0E1LL;
void setup()
{
Serial.begin(9600);
joystickShield.calibrateJoystick();
radio.begin();
radio.setRetries(15, 15);
radio.openWritingPipe(rxAddr);
radio.powerUp();
radio.setDataRate(RF24_250KBPS);
radio.enableDynamicPayloads();
}
void loop()
{
joystickShield.processEvents();
byte joystick[2];
joystick[0] = map(joystickShield.xAmplitude(), -100, 100, 0, 200);
joystick[1] = map(joystickShield.yAmplitude(), -100, 100, 0, 200);
radio.write(joystick, sizeof(joystick));
Serial.print(F("x "));
Serial.print(joystick[0]);
Serial.print(F(" y "));
Serial.println(joystick[1]);
if (joystickShield.isUp()) {
Serial.println(F("Up"));
}
if (joystickShield.isRightUp()) {
Serial.println(F("RightUp"));
}
if (joystickShield.isRight()) {
Serial.println(F("Right"));
}
if (joystickShield.isRightDown()) {
Serial.println(F("RightDown"));
}
if (joystickShield.isDown()) {
Serial.println(F("Down"));
}
if (joystickShield.isLeftDown()) {
Serial.println(F("LeftDown"));
}
if (joystickShield.isLeft()) {
Serial.println(F("Left"));
}
if (joystickShield.isLeftUp()) {
Serial.println(F("LeftUp"));
}
if (joystickShield.isJoystickButton()) {
Serial.println(F("Joystick Clicked"));
}
if (joystickShield.isUpButton()) {
Serial.println(F("Up Button Clicked"));
}
if (joystickShield.isRightButton()) {
Serial.println(F("Right Button Clicked"));
}
if (joystickShield.isDownButton()) {
Serial.println(F("Down Button Clicked"));
}
if (joystickShield.isLeftButton()) {
Serial.println(F("Left Button Clicked"));
}
// new eventfunctions
if (joystickShield.isEButton()) {
Serial.println(F("E Button Clicked"));
}
if (joystickShield.isFButton()) {
Serial.println(F("F Button Clicked"));
}
if (joystickShield.isNotCenter()) {
Serial.println(F("NotCenter"));
}
delay(500);
}
PaulS:
If you are going to compare apples to apples, you should print what you send, not what you think you are sending:
Serial.print("joystick[0]: "); Serial.println(joystick[0]);
Serial.print("joystick[1]: "); Serial.println(joystick[1]);
radio.read(&movement, 2);
Why is the & there?
Thank you both for your helps! It finally worked. Whandall last code you sent worked actually. I was so mad I forgot to check the cable connections.
thanks a lot again. I'm uploading the working versions of my codes so that someone could have the same problem. I hope this helps.
Verici_v2.4.ino (2.06 KB)
Receiver_v2.3.ino (734 Bytes)