Yes, although the range will probably be only a few tens of metres, assuming line-of-site. Less of blocked by walls or trees. Zero if blocked by metal.
Your transmitter code is not transmitting the temp! All it is doing is printing the temp to serial monitor, waiting a second and repeating. The send() function is not being called. The send() function needs a parameter which is a reference to a character array containing the text to be transmitted. I suggest you use sptrintf() function to write the temp to the character array then you can send the character array and print it to serial monitor.
Thank you for the respond!
Apparently this is my 1st time using that function..
How can I use the sprintf() function? As in how to write the code using that?
I want to transmit 2 data to other arduino with the LCD..
which are celcius and fahrenheit reading
Update*
I already figure out how to use the sprintf() function and I found out that it only work well with positive integers.
So based from How to sprintf a float with Arduino - Yet Another Arduino Blog
I'll use dtostrf function instead as it support negative integers too.
I already manage to transmit the temperature over RF433 Mhz via this coding
Transmitter
#include <VirtualWire.h>
#include <SPI.h>
#include <max6675.h>
#include <SoftwareSerial.h>
#undef int
#undef abs
#undef double
#undef float
#undef round
int SO = 8;
int CS = 9;
int CLK = 10;
MAX6675 temp(CLK,CS,SO);
char msg1[6];
void setup() {
Serial.begin(9600);
vw_set_tx_pin(12);
vw_setup(2000);
}
void loop() {
Serial.print("Cel.:");
Serial.println(temp.readCelsius()-10);
float c = temp.readCelsius()-10;
Serial.print("Original value1: ");
Serial.println(c);
char str[50];
strcpy(str, "String value using dtostrf1: ");
dtostrf(c, 2, 2, &str[strlen(str)]);
Serial.println(str);
Serial.println();
dtostrf(temp.readCelsius()-10, 6,2,msg1);
delay(2000);
vw_send((uint8_t *)msg1,strlen(msg1));
vw_wait_tx();
}
Probably better to SEND just one or the other. Then, in the Arduino which has received THE TEMPERATURE, you can present the information in both forms, C and F. It may pay you to use a "bespoke" scale for the temperatures. If you expect, say -10 to 35 degrees C, and you want it to the nearest tenth degree, SEND 0 to 450... and when the number gets to the receiving Arduino, subtract 100 and divide by 10, to turn the number into degees C.... probably quite late in the day. All positive integers are a lot easier to work with than a mixture of +ve and negative, and fractions. Turn "the number" into degrees Celsius, at the last minute, just for the poor weak minded humans reading the display.
Double and float are the same on Arduino (and indeed 4 bytes of data).
If it's just about the value, it's better to send it in binary format than in human readable format (saves conversions and much less data to transmit).
By doing a simple multiplication you can convert your float into int: *10 and you have the first decimal, good enough for most sensors which are far less accurate than that anyway. Then you can transmit your value in just two bytes.
Thank you for responding all..
Im not quite understand the code as im quite new to this "VirtualWire"
PaulRB:
Also possible is to send the double data value in its binary format (I think its only 4 bytes on Uno).
As tkbyd suggests, why not just send the Celsius version of the temp and convert to that other old-fashioned scale on the receiving Uno?
Im sorry, I dont quite understand on how to convert on receiving uno since its a char and not intergers.
Right now im just sending Celsius as string using dtostrf and it received as char msg..
Im planning to add 9/5)+32 to the received celsius but I need to convert it into interger value before print the result of (Celsius9/5)+32 on LCD.. but im not sure how to work it out..
Also if the binary sending is much easier can you assist me with the code? Im quite new to it..