LAMPIRAN PROGRAM LENGKAP
/*
AnalogReadSerial
Reads an analog input on pin 0, prints the result to
the serial monitor.
Graphical representation is available using serial
plotter (Tools > Serial Plotter menu)
Attach the center pin of a potentiometer to pin A0, and
the outside pins to +5V and ground.
This example code is in the public domain.
*/
// the setup function runs once when you press reset or
power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}
*/
// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH);
delay(50);
delay(50)
}
#include <LiquidCrystal.h>
// initialize the library with the numbers of the
interface pins
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// the setup routine runs once when you press reset:
// initialize serial communication at 9600 bits per
second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
void setup() {
Serial.begin(9600);
}
void loop() {
lcd.clear ();
float data=analogRead (A0);
lcd.setCursor (0,0);
lcd.print ("Out = ");
lcd.print(sensorValue * 0.4887);
lcd.print (" mV");
lcd.setCursor (0,1);
lcd.print ("Sen = ");
float tegangan=sensorValue * 0.4887;
float sensitivitas = ((tegangan-232.39)/tegangan)*100;
if (sensitivitas <0) {sensitivitas = sensitivitas *-1;}
lcd.print(sensitivitas);
lcd.print(" %") ;
Serial.print("E0");
Serial.print(",");
Serial.print (sensorValue * 0.4887);
Serial.print(",");
Serial.println (sensitivitas);
delay(500);