Last active
March 31, 2018 15:04
-
-
Save PhilippMeissner/96c67162041a6098223454c26c87dcf8 to your computer and use it in GitHub Desktop.
Sender
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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