hola soy nuevo en el foro así es que aprovecho para presentarme la duda es que no se como enviar datos de temperatura con el rf 434 lo que quiero es que en el transmisor me sense el sensor ds1820 y ala ves me lo visualise en una lcd jhd162a y al mismo tiempo lo trasmita a otro arduino con el receptor rf434 y también me lo visualice en una lcd como al principio. el programa para el censado es el siguiente nada mas para visualizarlo en la lcd:
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>
// Connections:
// rs (LCD pin 4) to Arduino pin 12
// rw (LCD pin 5) to Arduino pin 11
// enable (LCD pin 6) to Arduino pin 10
// LCD pin 15 to Arduino pin 13
// LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
int backLight = 13; // pin 13 will control the backlight
// Data wire is plugged into pin 8 on the Arduino
#define ONE_WIRE_BUS 8
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
// Assign the addresses of your 1-Wire temp sensors.
// See the tutorial on how to obtain these addresses:
DeviceAddress insideThermometer = { 0x28, 0x72, 0xFC, 0x09, 0x03, 0x00, 0x00, 0x18 };
//DeviceAddress outsideThermometer = { 0x28, 0x20, 0x04, 0xA8, 0x02, 0x00, 0x00, 0x4D };
void setup(void)
{
// Start up the library
sensors.begin();
// set the resolution to 10 bit (good enough?)
sensors.setResolution(insideThermometer, 10);
//sensors.setResolution(outsideThermometer, 10);
pinMode(backLight, OUTPUT);
digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
lcd.begin(16,2); // columns, rows. use 16,2 for a 16x2 LCD, etc.
lcd.clear(); // start with a blank screen
}
void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
lcd.print("Error");
} else {
lcd.print(tempC);
lcd.print(" C - F ");
lcd.print(DallasTemperature::toFahrenheit(tempC));
}
}
void loop(void)
{
delay(2000);
sensors.requestTemperatures();
lcd.setCursor(0,1);
lcd.print("");
printTemperature(insideThermometer);
lcd.setCursor(0,0);
lcd.print(" TEMPERATURA");
//printTemperature(outsideThermometer);
}
entonces en el modulo de rf me encontre con un ejemplo que enciente 3 leds cada 1000ms funciona todo vien el programa es el siguiente del trasmisor:
// Need these lines below ///////////////////
#include <VirtualWire.h>
#undef int
#undef abs
#undef double
#undef float
#undef round
////////////////////////////////////////////
const char *redoff = "a"; // to turn off the red LED, send "aa" down the wireless tube, etc.
const char *redon = "b";
const char *yellowoff = "c";
const char *yellowon = "d";
const char *greenoff = "e";
const char *greenon = "f";
void setup()
{
// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for RF Link module
vw_setup(2400); // Bits per sec
vw_set_tx_pin(1); // pin 1 is the TX pin on our Arduino Duemilanove
}
void loop()
{
delay(1000);
vw_send((uint8_t *)redon, strlen(redon));
vw_wait_tx(); // Wait for sending of message to finish.
delay(1000);
vw_send((uint8_t *)redoff, strlen(redoff));
vw_wait_tx();
delay(1000);
vw_send((uint8_t *)yellowon, strlen(yellowon));
vw_wait_tx();
delay(1000);
vw_send((uint8_t *)yellowoff, strlen(yellowoff));
vw_wait_tx();
delay(1000);
vw_send((uint8_t *)greenon, strlen(greenon));
vw_wait_tx();
delay(1000);
vw_send((uint8_t *)greenoff, strlen(greenoff));
vw_wait_tx();
}
y el del receptor es el sig:
// Need these lines below ///////////////////
#include <VirtualWire.h>
#undef int
#undef abs
#undef double
#undef float
#undef round
uint8_t buf[VW_MAX_MESSAGE_LEN]; // this is an array of unsigned integers 8-bits long. In other words, bytes between 0 and 65535
uint8_t buflen = VW_MAX_MESSAGE_LEN;
int red = 2;
int yellow = 4;
int green = 6;
////////////////////////////////////////////
void setup()
{
pinMode(red, OUTPUT); // for our LEDs
pinMode(yellow, OUTPUT);
pinMode(green, OUTPUT);
// wake up the wireless receiver
vw_set_ptt_inverted(true); // need this line
vw_setup(2400); // sets speed of data reception.
vw_set_rx_pin(0); // this is the RX pin number - 0 on a Duemilanove
vw_rx_start(); // start the receiver!
}
void loop()
{
// check to see if there is received data in the buffer, and that it came through correctly.
// if the message didn't come through completely, it will be ignored
if (vw_get_message(buf, &buflen))
{
switch(buf[0])
{
case 'a':
digitalWrite(red, LOW);
break;
case 'b':
digitalWrite(red, HIGH);
break;
case 'c':
digitalWrite(yellow, LOW);
break;
case 'd':
digitalWrite(yellow, HIGH);
break;
case 'e':
digitalWrite(green, LOW);
break;
case 'f':
digitalWrite(green, HIGH);
}
}
}
entonces la pregunta como adaptaria el programa del sensado al del transmisor y el receptor
ay si alguien me pudiera ayudar
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.