I am making a project for school and need to be able to send values from one arduino to another using 433 mhz transmitter and receiver. I need help on sending the values that I get from my sensor to the other arduino using the transmitter and receiver. I used an example code for the sensor to get the value and I found another code that I kinda used to mess with. I will put my code in and any help is appreciated.
/*!
* @file mprls_simpletest.ino
*
* A basic test of the sensor with default settings
*
* Designed specifically to work with the MPRLS sensor from Adafruit
* ----> https://www.adafruit.com/products/3965
*
* These sensors use I2C to communicate, 2 pins (SCL+SDA) are required
* to interface with the breakout.
*
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Written by Limor Fried/Ladyada for Adafruit Industries.
*
* MIT license, all text here must be included in any redistribution.
*
*/
#include <Wire.h>
#include "Adafruit_MPRLS.h"
#include <RH_ASK.h>
#include <SPI.h>
// You dont *need* a reset and EOC pin for most uses, so we set to -1 and don't connect
#define RESET_PIN -1 // set to any GPIO pin # to hard-reset on begin()
#define EOC_PIN -1 // set to any GPIO pin to read end-of-conversion by pin
Adafruit_MPRLS mpr = Adafruit_MPRLS(RESET_PIN, EOC_PIN);
RH_ASK rf_driver;
void setup() {
Serial.begin(115200);
Serial.println("MPRLS Simple Test");
if (! mpr.begin()) {
Serial.println("Failed to communicate with MPRLS sensor, check wiring?");
while (1) {
delay(10);
}
}
Serial.println("Found MPRLS sensor");
rf_driver.init();
}
void loop() {
float pressure_hPa = mpr.readPressure();
rf_driver.send();
rf_driver.waitPacketSent();
Serial.print("Pressure: ");
Serial.print(pressure_hPa / 68.947572932);
delay(1000);
}
with the code i have posted I havent been able to get the value from the sensor to send to the other arduino. I don't have a lot of experience with coding and don't know exactly how all of this stuff works. I have just found example codes and am trying to piece them together.
I have just created this code and i end up getting an exit status 1 error with a bunch of red words. I think its because I have libraries that don't work with each other. Im not sure if there is a way to fix this but i would appreciate any help. I will put my code in here. We are trying to read values then send them with a rf transmitter and receiver.
#include <Wire.h>
#include "Adafruit_MPRLS.h"
#include <RH_ASK.h>
#include <SPI.h>
// You dont *need* a reset and EOC pin for most uses, so we set to -1 and don't connect
#define RESET_PIN -1 // set to any GPIO pin # to hard-reset on begin()
#define EOC_PIN -1 // set to any GPIO pin to read end-of-conversion by pin
Adafruit_MPRLS mpr = Adafruit_MPRLS(RESET_PIN, EOC_PIN);
RH_ASK driver;
String str_pressure;
void setup() {
Serial.begin(115200);
Serial.println("MPRLS Simple Test");
if (! mpr.begin()) {
Serial.println("Failed to communicate with MPRLS sensor, check wiring?");
while (1) {
delay(10);
}
}
Serial.println("Found MPRLS sensor");
if (!driver.init())
Serial.println("init failed");
}
void loop() {
float pressure_hPa = mpr.readPressure();
float pressure_psi = pressure_hPa/68.947572932;
str_pressure = String(pressure_psi);
static char *msg = str_pressure.c_str();
driver.send((uint8_t*)msg, strlen(msg));
driver.waitPacketSent();
delay(1000);
Serial.print("Pressure (PSI): "); Serial.println(pressure_psi);
delay(1000);
}
Look man if you're not going to give any helpful advice please don't comment on here anymore we have been working really hard and have made progress and are looking for some advice. All you have done is tell us that we need to go to the other thing and that is obviously not helping that's why I made another post. I don't understand why you feel the need to keep telling us this. I have been trying to ignore you because you are not being helpful but you won't leave me alone so please just let us be.
I didn't post the "red words" at first because it was a lot of stuff and didn't want to put a ton of stuff on here and it be overwhelming but I will now even though you were very rude in your wording
Hi, @brycemcnuggets
Did you readied a forum guidelines before you start posting here?
Using the screenshot instead of the code and error messages is a violation of the forum rules.
As about the code, it seems that it is combined from several examples without any adjustments of the parts to each others. Variables are not declared, the number of right and left brackets does not match, libraries are not included.
If this is your school assignment, then you were taught how to draw up a sketch correctly. Start from the beginning.
I have merged your topics due to them having too much overlap on the same subject matter @brycemcnuggets.
In the future, please only create one topic for each distinct subject matter and be careful not to cause them to converge into parallel discussions.
The reason is that generating multiple threads on the same subject matter can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.
Please also tell me whether you are working together on the project with @cade7070. If so, I would merge this topic with Code. Help. Please so that the helpers can have access to all the relevant information in one place and concentrate their efforts.