<?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=Thingspeak%3A_Analog_GPIO</id>
	<title>Thingspeak: Analog GPIO - 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=Thingspeak%3A_Analog_GPIO"/>
	<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=Thingspeak:_Analog_GPIO&amp;action=history"/>
	<updated>2026-04-20T16:43:47Z</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=Thingspeak:_Analog_GPIO&amp;diff=57401&amp;oldid=prev</id>
		<title>Onnowpurbo: Created page with &quot; #include &quot;ThingSpeak.h&quot;  #include &lt;Ethernet.h&gt;  #include &quot;secrets.h&quot;    byte mac[] = SECRET_MAC;  // Set the static IP address to use if the DHCP fails to assign  IPAddress i...&quot;</title>
		<link rel="alternate" type="text/html" href="https://lms.onnocenter.or.id/wiki/index.php?title=Thingspeak:_Analog_GPIO&amp;diff=57401&amp;oldid=prev"/>
		<updated>2019-11-04T10:50:31Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; #include &amp;quot;ThingSpeak.h&amp;quot;  #include &amp;lt;Ethernet.h&amp;gt;  #include &amp;quot;secrets.h&amp;quot;    byte mac[] = SECRET_MAC;  // Set the static IP address to use if the DHCP fails to assign  IPAddress i...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt; #include &amp;quot;ThingSpeak.h&amp;quot;&lt;br /&gt;
 #include &amp;lt;Ethernet.h&amp;gt;&lt;br /&gt;
 #include &amp;quot;secrets.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 byte mac[] = SECRET_MAC;&lt;br /&gt;
 // Set the static IP address to use if the DHCP fails to assign&lt;br /&gt;
 IPAddress ip(192, 168, 0, 177);&lt;br /&gt;
 IPAddress myDns(192, 168, 0, 1);&lt;br /&gt;
 EthernetClient client; &lt;br /&gt;
 &lt;br /&gt;
 unsigned long myChannelNumber = SECRET_CH_ID;&lt;br /&gt;
 const char * myWriteAPIKey = SECRET_WRITE_APIKEY; &lt;br /&gt;
 &lt;br /&gt;
 void setup() {&lt;br /&gt;
   Ethernet.init(10);  // Most Arduino Ethernet hardware&lt;br /&gt;
   Serial.begin(115200);  //Initialize serial&lt;br /&gt;
     &lt;br /&gt;
   // start the Ethernet connection:&lt;br /&gt;
   Serial.println(&amp;quot;Initialize Ethernet with DHCP:&amp;quot;);&lt;br /&gt;
   if (Ethernet.begin(mac) == 0) {&lt;br /&gt;
     Serial.println(&amp;quot;Failed to configure Ethernet using DHCP&amp;quot;);&lt;br /&gt;
     // Check for Ethernet hardware present&lt;br /&gt;
     if (Ethernet.hardwareStatus() == EthernetNoHardware) {&lt;br /&gt;
       Serial.println(&amp;quot;Ethernet shield was not found.  Sorry, can&amp;#039;t run without hardware. :(&amp;quot;);&lt;br /&gt;
       while (true) {&lt;br /&gt;
         delay(1); // do nothing, no point running without Ethernet hardware&lt;br /&gt;
       }&lt;br /&gt;
     }&lt;br /&gt;
     if (Ethernet.linkStatus() == LinkOFF) {&lt;br /&gt;
       Serial.println(&amp;quot;Ethernet cable is not connected.&amp;quot;);&lt;br /&gt;
     }&lt;br /&gt;
     // try to congifure using IP address instead of DHCP:&lt;br /&gt;
     Ethernet.begin(mac, ip, myDns);&lt;br /&gt;
   } else {&lt;br /&gt;
     Serial.print(&amp;quot;  DHCP assigned IP &amp;quot;);&lt;br /&gt;
     Serial.println(Ethernet.localIP());&lt;br /&gt;
   }&lt;br /&gt;
   // give the Ethernet shield a second to initialize:&lt;br /&gt;
   delay(1000);&lt;br /&gt;
 &lt;br /&gt;
   ThingSpeak.begin(client);  // Initialize ThingSpeak&lt;br /&gt;
 }  &lt;br /&gt;
 &lt;br /&gt;
 void loop() {&lt;br /&gt;
   &lt;br /&gt;
   float a0 = analogRead(15);&lt;br /&gt;
   if (isnan(a0) || isnan(t) ) {&lt;br /&gt;
      Serial.println(&amp;quot;Failed to read from GPIO 15&amp;quot;);&lt;br /&gt;
      return;&lt;br /&gt;
   }&lt;br /&gt;
   &lt;br /&gt;
   // set the fields with the values&lt;br /&gt;
   ThingSpeak.setField(3, a0); &lt;br /&gt;
   &lt;br /&gt;
   // write to the ThingSpeak channel &lt;br /&gt;
   int x = ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);&lt;br /&gt;
   if(x == 200){&lt;br /&gt;
     Serial.println(&amp;quot;Channel update successful.&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
   else{&lt;br /&gt;
     Serial.println(&amp;quot;Problem updating channel. HTTP error code &amp;quot; + String(x));&lt;br /&gt;
   }&lt;br /&gt;
      &lt;br /&gt;
   delay(20000); // Wait 20 seconds to update the channel again&lt;br /&gt;
 }&lt;/div&gt;</summary>
		<author><name>Onnowpurbo</name></author>
	</entry>
</feed>