Go Down

Topic: Ploting real-time graph with C# (Read 2323 times) previous topic - next topic

Matteq

Hello. I need a advice. I want to make program in C# which is ploting a real-time graph according to temperature change readed from Arduino. I'm using VS 2012. I don't know how to start - if you've any links/guidelines I would be grateful.

robtillaart


check - http://arduino.cc/forum/index.php/topic,134913.0.html - for inspiration ...
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

NickPyner

#2
Dec 18, 2012, 01:27 am Last Edit: Dec 19, 2012, 06:00 am by NickPyner Reason: 1
Do you really need to do this?

Do you know of the PLX-DAQ macro? You may find that is all you want.     http://www.parallax.com/tabid/393/default.aspx

The following shows how Arduino goes with it. The serial commands are all you need.

Code: [Select]
//  code uses Arduino LCD stuff, for shield on Freetronics EtherTen.
//  Serial print commands are for PLX-DAQ
//  Research your own pins!

#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(8,9,56,5,6,7); // patchwire is D4 to A2 (pin16) on this proto
int flag;
// Data wire is on pin 3
#define ONE_WIRE_BUS 3
// 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.
DeviceAddress InThermo = {  
 0x28, 0x69, 0xC2, 0xB0, 0x03, 0x00, 0x00, 0X9F };
DeviceAddress OutThermo = {
 0x28, 0x7A, 0x8B, 0xC0, 0x03, 0x00, 0x00, 0x2F };

//temperature variables
float InTemp, OutTemp, diff, drain, flow, power, tempC;

void setup(void)
{
 // start serial port
 Serial.begin(9600);

 // set up the LCD,s number of columns and rows:
 lcd.begin(16, 2);
 Serial.println("LABEL,Time,TempIn,TempOut,diff");
 // Print a message to the LCD.
 lcd.print("temp in     out");    

 // Start up the library
 sensors.begin();
 sensors.setResolution(InThermo, 12);
 sensors.setResolution(OutThermo, 12);
}

void loop(void)
{
 delay(1000);
   Serial.print("DATA,TIME,       ");
 flag = 0;
 //Get the sensor readings. There are two of them
 sensors.requestTemperatures();

 GetandPrint(InThermo);
 InTemp=tempC;
 flag = 1;

 GetandPrint(OutThermo);
 diff = tempC - InTemp;
 Serial.print (diff);
 Serial.println(" ,  ");

}

void GetandPrint(DeviceAddress deviceAddress)
{
 tempC = sensors.getTempC(deviceAddress);
 if (tempC == -127.00) {
   Serial.print("Error getting temperature");
 }
 else {
   Serial.print(tempC);
   Serial.print(" ,  ");
 }
 lcd.setCursor (1,1);
 if (flag==1)
   (
   lcd.setCursor (11,1)
     );
 lcd.print (tempC);
}

Go Up