Here is arduino sketch:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
//LiquidCrystal(rs, enable, d4, d5, d6, d7)
LiquidCrystal lcd(A0, A1, A2, A3, A4, A5);
char inString[20];
float number=0;
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.setCursor(0, 1);
// Print a message to the LCD.
lcd.print("V const ");
Serial.begin(9600);
// Enable Monitor mode. Note the terminating character \n
Serial.print("ROUT:MON:STAT ON\n");
delay(100);
}
void loop() {
// loops the function reading() that reads the serial and displays the numbers on the LCD
reading();
}
float reading(){
// set the cursor to column 0, line 1
lcd.setCursor(0, 1);
//Ask for data in daq
Serial.print("ROUT:MON:DATA?\n");
int i=0;
while(Serial.available()){
inString[i] = (char)Serial.read();
i++;}
//transform the char array in a float
number = atof(inString);
lcd.print(number,4);
lcd.print(" units ");
delay(100);
//return number for data handling
return number;
}
In the experiment, depending on the resistance readings, voltage width pulses applied to the samples are modified.
No comments:
Post a Comment