Skip to content

Instantly share code, notes, and snippets.

@PhilippMeissner

PhilippMeissner/Sender.ino

Last active Mar 31, 2018
Embed
What would you like to do?
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
You can’t perform that action at this time.