Created
January 9, 2016 00:20
-
-
Save p1nesap/dc8eb13e41c9b6f51843 to your computer and use it in GitHub Desktop.
Arduino Analog RF Receiver Voltage Data LCD 315 433MHz
This file contains 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
/* | |
Code by Tom Igoe with voltage/LCD sections by p1nesap. Watch on YouTube: | |
https://www.youtube.com/watch?v=MlS9Arac9jM | |
*/ | |
#include <Wire.h> | |
#include <LiquidCrystal_I2C.h> | |
const int analogInPin = A0; // RF receiver | |
const int analogOutPin = 9; // 8 ohm speaker with 100 ohm resistor | |
int sensorValue = 0; | |
int outputValue = 0; | |
int voltValue = 0; | |
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address | |
void setup() { | |
Serial.begin(9600); | |
lcd.begin(16,2); | |
} | |
void loop() { | |
// read the analog in value: | |
sensorValue = analogRead(analogInPin); | |
// convert raw data to voltage: | |
float voltValue = sensorValue * .0049; | |
outputValue = voltValue; | |
// change the analog out value: | |
analogWrite(analogOutPin, outputValue); | |
// print raw data to serial: | |
Serial.print("sensor = "); | |
Serial.print(sensorValue); | |
Serial.print("\t output = "); | |
Serial.println(outputValue); | |
//print RF voltage to LCD: | |
lcd.setCursor(0, 0); | |
lcd.print("RF voltage: "); | |
lcd.print(voltValue, 3); | |
delay(300); | |
lcd.clear(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment