Hello,
I am currently trying to figure out how to use a 433 MHZ RF Module with the Energia IDE.
The TM4C123G is connected with the Transmitter
The MSP432 is connected to the Receiver.
I am trying to accomplish a program that sends the temperature from the TM4C123G the MSP432.
Her is the codes I have so far:
/*Transmitter (TM4C123G)*/
#include <string.h>
#include <SPI.h>
const uint8_t txaddr[] = { 0xF0,0xF0,0xF0,0xF0,0xE1 };
boolean flag = 0;
void dump_radio_status_to_serialport(uint8_t);
//initializes/defines the output pin of the LM34 temperature sensor
int outputpin= A11; // (pin # 2), use A11 analog input
//--------------------------------------------------------------------------------------
//this sets the ground pin to LOW and the input voltage pin to high
void setup()
{
Serial.begin(9600);
SPI.begin();
SPI.setDataMode(SPI_MODE0);
SPI.setBitOrder(1); // MSB-first
//----------------------------------------------------------------------------------
}
void loop() {
int rawvoltage= analogRead(outputpin);
float millivolts= (rawvoltage/4095.0) * 3300;
float fahrenheit= millivolts/10;
Serial3.write(fahrenheit); //send temperature varuable through tx3
delay(200);
}
/*Receiver*/
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#define rfReceivePin 3 //RF Receiver pin = pin 3
unsigned int data = 0; // variable used to store received data
byte address = 0x3F; // LCD I2C address
int columns = 16; // number of columns on LCD
int rows = 2; // number of rows on LCD
LiquidCrystal_I2C lcd(address, columns, rows);
//-----------------------------------------------------------------
void setup()
{
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.createChar(0, rocket); // Create Character 0
lcd.createChar(1, liftOff); // Create Character 1
}
//-----------------------------------------------------------------
void loop()
{
lcd.clear();
lcd.setCursor(0,0);
data=analogRead(rfReceivePin); //listen for data on pin 3
lcd.print("Temperature");
lcd.setCursor(0,1);
lcd.print(data);
delay(500);
}