Skip to content

Instantly share code, notes, and snippets.

@PhilippMeissner
Last active March 31, 2018 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PhilippMeissner/96c67162041a6098223454c26c87dcf8 to your computer and use it in GitHub Desktop.
Save PhilippMeissner/96c67162041a6098223454c26c87dcf8 to your computer and use it in GitHub Desktop.
Sender
#include <SPI.h>
#include <Wire.h>
// TMRh20 v1.3.1
#include <RF24.h>
#define POTI_PIN 3
#define CE_PIN 9
#define CSN_PIN 10
#define MAGIC_STORAGE_ADDRESS 0xE8E8F0F0E1LL
RF24 radio(CE_PIN, CSN_PIN);
const uint64_t pipe = MAGIC_STORAGE_ADDRESS;
int msg[1];
void setup() {
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipe);
radio.setPALevel(RF24_PA_MAX);
}
void loop() {
msg[0] = getPotiValue();
radio.write(msg, sizeof(int));
Serial.println(getPotiValue());
}
int getPotiValue() {
int potiValue = analogRead(POTI_PIN);
return potiValue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment