<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://lms.onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=Arduino%3A_Calibration</id>
	<title>Arduino: Calibration - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://lms.onnocenter.or.id/wiki/index.php?action=history&amp;feed=atom&amp;title=Arduino%3A_Calibration"/>
	<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=Arduino:_Calibration&amp;action=history"/>
	<updated>2026-04-20T15:47:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://lms.onnocenter.or.id/wiki/index.php?title=Arduino:_Calibration&amp;diff=45252&amp;oldid=prev</id>
		<title>Onnowpurbo: New page: Sumber: https://www.arduino.cc/en/Tutorial/Calibration    This example demonstrates one techinque for calibrating sensor input. The board takes sensor readings for five seconds during the ...</title>
		<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=Arduino:_Calibration&amp;diff=45252&amp;oldid=prev"/>
		<updated>2015-12-05T09:55:32Z</updated>

		<summary type="html">&lt;p&gt;New page: Sumber: https://www.arduino.cc/en/Tutorial/Calibration    This example demonstrates one techinque for calibrating sensor input. The board takes sensor readings for five seconds during the ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Sumber: https://www.arduino.cc/en/Tutorial/Calibration&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example demonstrates one techinque for calibrating sensor input. The board takes sensor readings for five seconds during the startup, and tracks the highest and lowest values it gets. These sensor readings during the first five seconds of the sketch execution define the minimum and maximum of expected values for the readings taken during the loop. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Hardware Required==&lt;br /&gt;
&lt;br /&gt;
* Arduino or Genuino board&lt;br /&gt;
* LED&lt;br /&gt;
* analog sensor (a photoresistor will do)&lt;br /&gt;
* 10k ohm resistor&lt;br /&gt;
* 220 ohm resistor&lt;br /&gt;
* hook-up wires&lt;br /&gt;
* breadboard &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Rangkaian==&lt;br /&gt;
&lt;br /&gt;
[[Image:Arduino speaker photocell bb.png|center|200px|thumb]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Arduino speaker photocell schem.png|center|200px|thumb]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&lt;br /&gt;
 /*&lt;br /&gt;
   Calibration&lt;br /&gt;
 &lt;br /&gt;
  Demonstrates one technique for calibrating sensor input.  The&lt;br /&gt;
  sensor readings during the first five seconds of the sketch&lt;br /&gt;
  execution define the minimum and maximum of expected values&lt;br /&gt;
  attached to the sensor pin.&lt;br /&gt;
 &lt;br /&gt;
  The sensor minimum and maximum initial values may seem backwards.&lt;br /&gt;
  Initially, you set the minimum high and listen for anything&lt;br /&gt;
  lower, saving it as the new minimum. Likewise, you set the&lt;br /&gt;
  maximum low and listen for anything higher as the new maximum.&lt;br /&gt;
 &lt;br /&gt;
  The circuit:&lt;br /&gt;
  * Analog sensor (potentiometer will do) attached to analog input 0&lt;br /&gt;
  * LED attached from digital pin 9 to ground&lt;br /&gt;
 &lt;br /&gt;
  created 29 Oct 2008&lt;br /&gt;
  By David A Mellis&lt;br /&gt;
  modified 30 Aug 2011&lt;br /&gt;
  By Tom Igoe&lt;br /&gt;
 &lt;br /&gt;
  http://www.arduino.cc/en/Tutorial/Calibration &lt;br /&gt;
 &lt;br /&gt;
  This example code is in the public domain.&lt;br /&gt;
 &lt;br /&gt;
  */&lt;br /&gt;
 &lt;br /&gt;
 // These constants won&amp;#039;t change:&lt;br /&gt;
 const int sensorPin = A0;    // pin that the sensor is attached to&lt;br /&gt;
 const int ledPin = 9;        // pin that the LED is attached to&lt;br /&gt;
 &lt;br /&gt;
 // variables:&lt;br /&gt;
 int sensorValue = 0;         // the sensor value&lt;br /&gt;
 int sensorMin = 1023;        // minimum sensor value&lt;br /&gt;
 int sensorMax = 0;           // maximum sensor value&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 void setup() {&lt;br /&gt;
   // turn on LED to signal the start of the calibration period:&lt;br /&gt;
   pinMode(13, OUTPUT);&lt;br /&gt;
   digitalWrite(13, HIGH);&lt;br /&gt;
 &lt;br /&gt;
   // calibrate during the first five seconds&lt;br /&gt;
   while (millis() &amp;lt; 5000) {&lt;br /&gt;
     sensorValue = analogRead(sensorPin);&lt;br /&gt;
 &lt;br /&gt;
     // record the maximum sensor value&lt;br /&gt;
     if (sensorValue &amp;gt; sensorMax) {&lt;br /&gt;
       sensorMax = sensorValue;&lt;br /&gt;
     }&lt;br /&gt;
 &lt;br /&gt;
     // record the minimum sensor value&lt;br /&gt;
     if (sensorValue &amp;lt; sensorMin) {&lt;br /&gt;
       sensorMin = sensorValue;&lt;br /&gt;
     }&lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   // signal the end of the calibration period&lt;br /&gt;
   digitalWrite(13, LOW);&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void loop() {&lt;br /&gt;
   // read the sensor:&lt;br /&gt;
   sensorValue = analogRead(sensorPin); &lt;br /&gt;
 &lt;br /&gt;
   // apply the calibration to the sensor reading&lt;br /&gt;
   sensorValue = map(sensorValue, sensorMin, sensorMax, 0, 255); &lt;br /&gt;
 &lt;br /&gt;
   // in case the sensor value is outside the range seen during calibration&lt;br /&gt;
   sensorValue = constrain(sensorValue, 0, 255); &lt;br /&gt;
 &lt;br /&gt;
   // fade the LED using the calibrated value:&lt;br /&gt;
   analogWrite(ledPin, sensorValue);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Referensi==&lt;br /&gt;
&lt;br /&gt;
* https://www.arduino.cc/en/Tutorial/Calibration&lt;/div&gt;</summary>
		<author><name>Onnowpurbo</name></author>
	</entry>
</feed>