Quantcast
Channel: Intel Communities: Message List
Viewing all articles
Browse latest Browse all 20191

Send tempertaure sensor data from one edison, and display the temperature on another edison using the LCD?

$
0
0

Hi,

 

I have been trying to do this for a while now, however I am new to this coding! Would anyone be kind enough in order to provide me with some code, so that I can send live temperature sensor data from one arduino board, and display it on a lcd or serial monitor of a different edison board connected to the same wifi?

 

I have read many different posts on here and other websites, and managed to make a p2p connection between the two boards, however I am absolutley unable to code so that the two boards talk to each other. This is the code I have so far (This only works for one board, as I do not know how to input the other board into it):

 

My questions are: How do I link this with the two boards (please provide me with some code if possible), what programs do I need to use, do I need to upload two different files to the two edisons? Please help!

 

-----------------------------------------------

#include <math.h>

#include <rgb_lcd.h>

#include <Wire.h>

 

rgb_lcd lcd;

const int pinTemp = A0;      // pin of temperature sensor

float temperature;           //A0

int B=3975;                  // B value of the thermistor

float resistance;

int blueLED = 3;

int btn = 4;

 

void setup()

{

  pinMode(btn, INPUT);

  pinMode (blueLED, OUTPUT);

   lcd.begin(16, 2);          // I2C lets the main loop know that the lcd is 16 by 2

}

 

void loop(){

int buttonState = digitalRead(btn);

if(buttonState == 1){

  digitalWrite(blueLED,1);

     int val = analogRead(pinTemp);                               // get analog value

    resistance=(float)(1023-val)*10000/val;                      // get resistance

    temperature=1/(log(resistance/10000)/B+1/298.15)-273.15;     // calc temperature

  // Print out to the LCD

    lcd.print("Temp1: ");   

    lcd.print(temperature); //print the output of the above calculations

    lcd.print(" *C");

    lcd.setCursor(0, 1);  

    delay(1000);            // delay 1 second, adjust this to affect the rate that the device polls the temp

    lcd.clear();      // refreshes the LCD

 

}

else if (buttonState == 0){

  lcd.print("Temp1: OFF ");

  lcd.setCursor(0, 1);

  digitalWrite(blueLED,0);

  delay(1000);

  lcd.clear();      // refreshes the LCD

}

}

 

-------------------------------------------------

 

 

HOW WOULD YOU SOLVE THIS/ CODE THIS?


Viewing all articles
Browse latest Browse all 20191

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>