<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OLED | Learn with Edwin Robotics</title>
	<atom:link href="https://learn.edwinrobotics.com/category/display/oled/feed/" rel="self" type="application/rss+xml" />
	<link>https://learn.edwinrobotics.com</link>
	<description>Tutorials on basics of electronics, etc.</description>
	<lastBuildDate>Thu, 28 Mar 2019 05:08:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
	<item>
		<title>Micro OLED Hookup guide for ESP8266 and Particle Photon</title>
		<link>https://learn.edwinrobotics.com/micro-oled-hookup-guide-for-esp8266-and-particle-photon/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=micro-oled-hookup-guide-for-esp8266-and-particle-photon</link>
					<comments>https://learn.edwinrobotics.com/micro-oled-hookup-guide-for-esp8266-and-particle-photon/#comments</comments>
		
		<dc:creator><![CDATA[Abhishek Nair]]></dc:creator>
		<pubDate>Sun, 22 May 2016 14:18:12 +0000</pubDate>
				<category><![CDATA[Display]]></category>
		<category><![CDATA[ESP8266]]></category>
		<category><![CDATA[OLED]]></category>
		<category><![CDATA[Particle Photon]]></category>
		<guid isPermaLink="false">http://learn.edwinrobotics.com/?p=284</guid>

					<description><![CDATA[<img width="6000" height="4000" src="https://learn.edwinrobotics.com/wp-content/uploads/OLED_cover.jpg" class="attachment- size- wp-post-image" alt="" style="float:left; margin:0 15px 15px 0;" decoding="async" fetchpriority="high" srcset="https://learn.edwinrobotics.com/wp-content/uploads/OLED_cover.jpg 6000w, https://learn.edwinrobotics.com/wp-content/uploads/OLED_cover-300x200.jpg 300w, https://learn.edwinrobotics.com/wp-content/uploads/OLED_cover-1024x683.jpg 1024w, https://learn.edwinrobotics.com/wp-content/uploads/OLED_cover-140x94.jpg 140w" sizes="(max-width: 6000px) 100vw, 6000px" />&#160; &#160; Introduction to Micro OLED Display &#160; An organic light-emitting diode (OLED) is a light-emitting diode (LED) in which the emissive electroluminescent layer is a film of organic compound that emits light in response to an electric current. This layer of organic semiconductor is situated between two electrodes typically and at least one of [&#8230;]]]></description>
										<content:encoded><![CDATA[<img width="6000" height="4000" src="https://learn.edwinrobotics.com/wp-content/uploads/OLED_cover.jpg" class="attachment- size- wp-post-image" alt="" style="float:left; margin:0 15px 15px 0;" decoding="async" loading="lazy" srcset="https://learn.edwinrobotics.com/wp-content/uploads/OLED_cover.jpg 6000w, https://learn.edwinrobotics.com/wp-content/uploads/OLED_cover-300x200.jpg 300w, https://learn.edwinrobotics.com/wp-content/uploads/OLED_cover-1024x683.jpg 1024w, https://learn.edwinrobotics.com/wp-content/uploads/OLED_cover-140x94.jpg 140w" sizes="auto, (max-width: 6000px) 100vw, 6000px" /><h1 style="text-align: left; padding-left: 210px;"><a href="http://learn.edwinrobotics.com/wp-content/uploads/OLED.png" target="_blank" rel="noopener noreferrer"><img decoding="async" class="alignnone wp-image-321 size-medium" src="http://learn.edwinrobotics.com/wp-content/uploads/OLED-184x300.png" alt="OLED" width="184" height="300" srcset="https://learn.edwinrobotics.com/wp-content/uploads/OLED-184x300.png 184w, https://learn.edwinrobotics.com/wp-content/uploads/OLED-627x1024.png 627w, https://learn.edwinrobotics.com/wp-content/uploads/OLED.png 911w" sizes="(max-width: 184px) 100vw, 184px" /></a></h1>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h1 style="text-align: left;"><strong>Introduction to Micro OLED Display</strong></h1>
<p>&nbsp;</p>
<p>An organic light-emitting diode (OLED) is a light-emitting diode (LED) in which the emissive electroluminescent layer is a film of organic compound that emits light in response to an electric current. This layer of organic semiconductor is situated between two electrodes typically and at least one of these electrodes is transparent.</p>
<p>The Micro OLED Display used in this tutorial is a small monochrome, blue-on-black OLED. It’s 64 pixels wide and 48 pixels tall, measuring 0.66&#8243; across. It’s micro sized and sufficient enough to fit a deceivingly large amount of graphics on there. this Micro OLED is easy to control over either an SPI or I<sup>2</sup>C interface.</p>
<p>Sparkfun have the breakout board for this display, its easy and time saving to use the same breakout for any projects.This Micro OLED Breakout provides access to 16 of the OLED’s pins. This breakout board operates at 3.3V with a current of 10mA (20mA max).The Micro OLED present in this breakout is same as  Display used in the <a href="http://shop.edwinrobotics.com/displays/118-sparkfun-microview-oled-arduino-module.html" target="_blank" rel="noopener noreferrer">SparkFun MicroView &#8211; OLED Arduino Module</a>.</p>
<p>The breakout board is an open source design and you can get the design files <a href="https://github.com/sparkfun/Micro_OLED_Breakout/tree/V_1.0">here</a></p>
<p>&nbsp;</p>
<p><strong>Display board Features:</strong></p>
<ul>
<li>Operating Voltage: 3.3V</li>
<li>Screen Size: 64&#215;48 pixels (0.66&#8243; Across)</li>
<li>Monochrome Blue-on-Black</li>
<li>SPI or I<sup>2</sup>C Interface</li>
</ul>
<p>&nbsp;</p>
<p><strong>OLED Pin Reference:</strong></p>
<blockquote>
<h5 style="text-align: left;"></h5>
<table class="pin_table" style="height: 447px;" width="538">
<tbody>
<tr>
<th>Pin Label</th>
<th>SPI Function</th>
<th>I<sup>2</sup>C Function</th>
<th>Notes</th>
</tr>
<tr>
<td style="text-align: center;">GND</td>
<td style="text-align: center;">Ground</td>
<td style="text-align: center;">Ground</td>
<td style="text-align: center;">0V</td>
</tr>
<tr>
<td style="text-align: center;">3V3 (VDD)</td>
<td style="text-align: center;">Power</td>
<td style="text-align: center;">Power</td>
<td style="text-align: center;">Should be a regulated 3.3V supply.</td>
</tr>
<tr>
<td style="text-align: center;">D1 (SDI)</td>
<td style="text-align: center;">MOSI</td>
<td style="text-align: center;">SDA</td>
<td style="text-align: center;">Serial data in</td>
</tr>
<tr>
<td style="text-align: center;">D0 (SCK)</td>
<td style="text-align: center;">SCK</td>
<td style="text-align: center;">SCL</td>
<td style="text-align: center;">SPI and I<sup>2</sup>C clock</td>
</tr>
<tr>
<td style="text-align: center;">D2 (SDO)</td>
<td style="text-align: center;">MISO</td>
<td style="text-align: center;">—</td>
<td style="text-align: center;">Can be unused in SPI mode. No function for I<sup>2</sup>C.</td>
</tr>
<tr>
<td style="text-align: center;">D/C</td>
<td style="text-align: center;">Data/Command</td>
<td style="text-align: center;">I<sup>2</sup>C address selection</td>
<td style="text-align: center;">Digital pin to signal if incoming byte is a command or screen data.</td>
</tr>
<tr>
<td style="text-align: center;">RST</td>
<td style="text-align: center;">Reset</td>
<td style="text-align: center;">Reset</td>
<td style="text-align: center;">Active-low screen reset.</td>
</tr>
<tr>
<td style="text-align: center;">CS</td>
<td style="text-align: center;">CS</td>
<td style="text-align: center;">—</td>
<td style="text-align: center;">SPI chip select (active-low)</td>
</tr>
</tbody>
</table>
</blockquote>
<p><span style="line-height: 1.5;">Sparkfun has provided detailed hookup guide on their blog to setup the OLED breakout board.Follow the links below to see the detailed Instructions.</span></p>
<ul>
<li><a href="https://learn.sparkfun.com/tutorials/micro-oled-breakout-hookup-guide#breakout-board-overview" target="_blank" rel="noopener noreferrer">Breakout Board Overview</a></li>
<li><a href="https://learn.sparkfun.com/tutorials/micro-oled-breakout-hookup-guide#hardware-assembly" target="_blank" rel="noopener noreferrer">Hardware Assembly</a></li>
<li><a href="https://learn.sparkfun.com/tutorials/micro-oled-breakout-hookup-guide#hardware-hookup" target="_blank" rel="noopener noreferrer">Hardware Hookup</a></li>
<li><a href="https://learn.sparkfun.com/tutorials/micro-oled-breakout-hookup-guide#arduino-library-download-install-and-test" target="_blank" rel="noopener noreferrer">Arduino Library Download, Install, and Test</a></li>
<li><a href="https://learn.sparkfun.com/tutorials/micro-oled-breakout-hookup-guide#using-the-arduino-library" target="_blank" rel="noopener noreferrer">Using the Arduino Library</a></li>
</ul>
<p>When we tested the board with Sparkfun library we faced some issue with displaying text, thus we made changes to library and sorted out the issue. The library is available to download from GitHub, <a href="https://github.com/EdwinRobotics/ER_Micro_OLED_Arduino_Library/archive/GSlibrary.zip" target="_blank" rel="noopener noreferrer">Click here</a> to download the library.</p>
<p>When you use this Library, make sure you either replace the Sparkfun library or remove and make a backup of the Sparkfun library from the Arduino.</p>
<p>The hookup guide to setup the Micro OLED display with different boards can be found below:</p>
<ul>
<li><a href="#Step1">Micro OLED Breakout Hookup with ESP8266 </a></li>
<li><span style="color: #333333;"><a href="#Step2">Micro OLED Breakout Hookup with Particle Photon</a></span></li>
</ul>
<h1 style="text-align: justify;"></h1>
<h1 id="Step1" style="text-align: justify;"><strong>Micro OLED Breakout Hookup with ESP8266</strong></h1>
<p>&nbsp;</p>
<p>The ESP8266 is a low-cost Wi-Fi chip with full TCP/IP stack and Microcontroller capability produced by Shanghai-based Chinese manufacturer, Espressif. There are many third party modules With ESP8266 available in the market and you can decide which one suits best for your application, we are using the Sprakfun ESP8266 Thing in this tutorial.</p>
<p><a href="https://cdn.sparkfun.com//assets/parts/1/0/4/0/0/13231-04.jpg" target="_blank" rel="noopener noreferrer"><img decoding="async" class="alignnone" src="https://cdn.sparkfun.com//assets/parts/1/0/4/0/0/13231-04.jpg" width="600" height="600" /></a></p>
<p>The SparkFun ESP8266 Thing is a breakout and development board for the ESP8266 WiFi SoC – a leading platform for Internet of Things (IoT) or WiFi-related projects. These are some features of the board:</p>
<p>&nbsp;</p>
<h2>ESP8266 Thing Features:</h2>
<h2></h2>
<ul>
<li>All module pins broken out</li>
<li>On-board LiPo charger/power supply</li>
<li>802.11 b/g/n</li>
<li>Wi-Fi Direct (P2P), soft-AP</li>
<li>Integrated TCP/IP protocol stack</li>
<li>Integrated TR switch, balun, LNA, power amplifier and matching network</li>
<li>Integrated PLLs, regulators, DCXO and power management units</li>
<li>Integrated low power 32-bit CPU could be used as application processor</li>
<li>+19.5dBm output power in 802.11b mode</li>
<li>Arduino IDE integration</li>
<li>Breadboard Compatible Breakout Headers position</li>
<li>Power On-Off Switch</li>
<li>Status LED</li>
<li>Operating Voltage: 3.3v</li>
</ul>
<p>Refer the Graphical Datasheet for hardware description</p>
<p><a href="http://learn.edwinrobotics.com/wp-content/uploads/ESP8266ThingV1-page-001.jpg" target="_blank" rel="noopener noreferrer"><img loading="lazy" decoding="async" class="alignnone wp-image-313 size-full" src="http://learn.edwinrobotics.com/wp-content/uploads/ESP8266ThingV1-page-001.jpg" alt="ESP8266ThingV1-page-001" width="3300" height="2550" srcset="https://learn.edwinrobotics.com/wp-content/uploads/ESP8266ThingV1-page-001.jpg 3300w, https://learn.edwinrobotics.com/wp-content/uploads/ESP8266ThingV1-page-001-300x232.jpg 300w, https://learn.edwinrobotics.com/wp-content/uploads/ESP8266ThingV1-page-001-1024x791.jpg 1024w" sizes="auto, (max-width: 3300px) 100vw, 3300px" /></a></p>
<p>&nbsp;</p>
<h2>Programming the Thing:</h2>
<p>The ESP8266 has a built-in serial bootloader, which allows for easy programming and re-programming. You don’t need a specialized, expensive programmer – just a simple, USB-to-Serial converter.</p>
<p>We use a 3.3V FTDI Basic to program the Thing, but other serial converters with 3.3V I/O levels should work. The converter does need a DTR line in addition to the RX and TX pins.The FTDI Basic’s 6-pin header matches up exactly to the Thing’s 6-pin serial port header. To set up for programming, simply connect the FTDI directly to this port – take care to match up the DTR and GND pins!</p>
<p style="padding-left: 150px;"><a href="http://learn.edwinrobotics.com/wp-content/uploads/s.jpg" target="_blank" rel="noopener noreferrer"><img loading="lazy" decoding="async" class="alignnone wp-image-318 size-medium" src="http://learn.edwinrobotics.com/wp-content/uploads/s-300x300.jpg" alt="s" width="300" height="300" srcset="https://learn.edwinrobotics.com/wp-content/uploads/s-300x300.jpg 300w, https://learn.edwinrobotics.com/wp-content/uploads/s-150x150.jpg 150w, https://learn.edwinrobotics.com/wp-content/uploads/s-184x184.jpg 184w, https://learn.edwinrobotics.com/wp-content/uploads/s.jpg 600w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></p>
<p><b>Note:</b> While programming the Thing, it&#8217;s best to power it off USB. We&#8217;ve noticed programming is more likely to fail if the Thing is only powered via the battery.</p>
<p>Now we will see how to connect the ESP8266 Thing with Micro OLED Breakout in I<sup>2</sup>C Mode:</p>
<ul>
<li>Setup the jumpers in the Hardware</li>
</ul>
<blockquote><p><strong>Setting Jumpers for I<span style="font-size: 13.3333px; line-height: 20px;">2</span>C Mode:</strong></p>
<ul>
<li><strong>Short D1/D2</strong> – This will combine the data output line and data input line into one.</li>
<li><strong>Set BS1 to 1</strong> – The BS1 jumpers comes defaulted to 0, which does half the job of setting it to SPI. To set the display to I<span style="font-size: 13.3333px; line-height: 20px;">2</span>C, you’ll need to flip that jumper to 1. Also make sure the BS2 jumper remains set to 0.</li>
<li><strong>Set D/C</strong> – In I<span style="font-size: 13.3333px; line-height: 20px;">2</span>C mode, the D/C pin configures the display’s 7-bit address. You can set it to either 0 or 1, just keep that value in mind when you get to the code part of this tutorial.</li>
</ul>
</blockquote>
<p>Once you’re done setting jumpers, the back of the board should look a little something like this:</p>
<p><a href="https://cdn.sparkfun.com/assets/learn_tutorials/3/0/8/Micro_LED_Tutorial-06.jpg" target="_blank" rel="noopener noreferrer"><img loading="lazy" decoding="async" class="alignnone" src="https://cdn.sparkfun.com/assets/learn_tutorials/3/0/8/Micro_LED_Tutorial-06.jpg" width="1000" height="1000" /></a></p>
<p><a href="http://learn.edwinrobotics.com/wp-content/uploads/ESp-OLED.png" target="_blank" rel="noopener noreferrer"><img loading="lazy" decoding="async" class="alignnone wp-image-328 size-full" src="http://learn.edwinrobotics.com/wp-content/uploads/ESp-OLED.png" alt="ESp-OLED" width="1134" height="1134" srcset="https://learn.edwinrobotics.com/wp-content/uploads/ESp-OLED.png 1134w, https://learn.edwinrobotics.com/wp-content/uploads/ESp-OLED-150x150.png 150w, https://learn.edwinrobotics.com/wp-content/uploads/ESp-OLED-300x300.png 300w, https://learn.edwinrobotics.com/wp-content/uploads/ESp-OLED-1024x1024.png 1024w, https://learn.edwinrobotics.com/wp-content/uploads/ESp-OLED-184x184.png 184w" sizes="auto, (max-width: 1134px) 100vw, 1134px" /></a></p>
<p>Follow the above shown connections for I2C interface between OLED and ESP8266 Thing. Any Digital pin can be connected to RST(Reset) Pin of OLED, we used Pin number 5 from the ESP8266 Thing.</p>
<p>&nbsp;</p>
<p><strong>Note: </strong>Pin 5 on the ESP8266 Thing is connected to onboard LED, we tampered the tracks to LED to disable it.</p>
<p>Try out the following code on the ESP8266 Things and check whether your board is working fine or not, We used the modified library (The <a href="https://github.com/EdwinRobotics/ER_Micro_OLED_Arduino_Library/archive/GSlibrary.zip" target="_blank" rel="noopener noreferrer">link</a> to download the library is mentioned above), make sure you must use the same to made it work.</p>
<blockquote><p>#include &lt;Wire.h&gt; <span style="color: #00ccff;">//Include Wire if you&#8217;re using I2C</span><br />
<span style="color: #00ccff;">//#include &lt;SPI.h&gt; // Include SPI if you&#8217;re using SPI</span><br />
#include &lt;ER_MicroOLED.h&gt; <span style="color: #00ccff;">// Include the ER_MicroOLED library</span><br />
#define PIN_RESET 5 <span style="color: #00ccff;">// Connect RST to pin 9 (req. for SPI and I2C)</span><br />
<span style="color: #00ccff;">//#define PIN_DC 8 // Connect DC to pin 8 (required for SPI)</span><br />
<span style="color: #00ccff;">//#define PIN_CS 10 // Connect CS to pin 10 (required for SPI)</span><br />
#define DC_JUMPER 1<br />
<span style="color: #00ccff;">// Also connect pin 13 to SCK and pin 11 to MOSI</span><br />
<span style="color: #00ccff;"> // Declare a MicroOLED object. The parameters include:</span><br />
<span style="color: #00ccff;"> // 1 &#8211; Reset pin: Any digital pin</span><br />
<span style="color: #00ccff;"> // 2 &#8211; D/C pin: Any digital pin (SPI mode only)</span><br />
<span style="color: #00ccff;"> // 3 &#8211; CS pin: Any digital pin (SPI mode only, 10 recommended)</span><br />
<span style="color: #00ccff;"> //MicroOLED oled(PIN_RESET, PIN_DC, PIN_CS);</span><br />
MicroOLED oled(PIN_RESET, DC_JUMPER); <span style="color: #00ccff;">// Example I2C declaration</span></p>
<p>void setup()<br />
{<br />
oled.begin();</p>
<p><span style="color: #00ccff;">// clear(ALL) will clear out the OLED&#8217;s graphic memory.</span><br />
<span style="color: #00ccff;"> // clear(PAGE) will clear the Arduino&#8217;s display buffer.</span><br />
oled.clear(ALL); <span style="color: #00ccff;">// Clear the display&#8217;s memory (gets rid of artifacts)</span><br />
<span style="color: #00ccff;">// To actually draw anything on the display, you must call the</span><br />
<span style="color: #00ccff;"> // display() function.</span><br />
oled.display();<br />
delay(2000);</p>
<p>oled.clear(PAGE);<br />
oled.clear(ALL);<br />
oled.setCursor(0,0);<br />
oled.setTextColor(WHITE);<br />
oled.setTextSize(0);</p>
<p>oled.println(&#8220;hello !!!!&#8221;);<br />
oled.display();<br />
}</p>
<p>void loop()<br />
{<br />
<span style="color: #00ccff;">//oled.line(x0, y0, x1, y1); // Draw a line from (x0,y0) to (x1,y1);</span><br />
oled.line(5, 15, 57, 15); <span style="color: #00ccff;">// Draw a line from (x0,y0) to (x1,y1);</span></p>
<p><span style="color: #00ccff;">//oled.rect(x0, y0, width, height); // Draw a rectange from (7,5) to (31,18)</span><br />
oled.rect(5, 20, 52, 20); <span style="color: #00ccff;">// Draw a rectange from (7,5) to (31,18)</span></p>
<p>oled.line(5, 45, 57, 45); <span style="color: #00ccff;">// Draw a line from (x0,y0) to (x1,y1);</span></p>
<p><span style="color: #00ccff;">//oled.rectFill(7, 5, 35, 5); // Fill a rectangle from (7, 5) to (42, 10)</span><br />
oled.rectFill(10, 25, 42, 10); <span style="color: #00ccff;">// Fill a rectangle from (7, 5) to (42, 10)</span></p>
<p><span style="color: #00ccff;">//oled.circleFill(42, 20, 7); // Fill a circle, 7 radius, centered at (42, 20)</span></p>
<p>oled.display(); // Draw to the screen<br />
}</p></blockquote>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h1 id="Step2" style="text-align: justify;"><strong>Micro OLED Hookup with Particle Photon</strong></h1>
<p>&nbsp;</p>
<p>The <a href="http://shop.edwinrobotics.com/particle/77-particle-photon.html" target="_blank" rel="noopener noreferrer">Photon</a> is a development kit for creating Wi-Fi connected products. It&#8217;s based on Broadcom&#8217;s WICED architecture, and combines a powerful STM32 ARM Cortex M3 microcontroller and a Broadcom Wi-Fi chip (the same one that&#8217;s in Nest Protect, LIFX, and Amazon Dash).</p>
<p style="padding-left: 150px;"><a href="http://learn.edwinrobotics.com/wp-content/uploads/temp.png" target="_blank" rel="noopener noreferrer"><img loading="lazy" decoding="async" class="alignnone wp-image-340 size-full" src="http://learn.edwinrobotics.com/wp-content/uploads/temp.png" alt="photon" width="293" height="521" srcset="https://learn.edwinrobotics.com/wp-content/uploads/temp.png 293w, https://learn.edwinrobotics.com/wp-content/uploads/temp-169x300.png 169w" sizes="auto, (max-width: 293px) 100vw, 293px" /></a></p>
<h2>Photon Features:</h2>
<ul class="fancy-list">
<li>Fits in a standard breadboard (with headers)</li>
<li>Surface mountable for machine assembly (without headers)</li>
<li>Backwards compatible with the Spark Core</li>
<li>Broadcom BCM43362 Wi-Fi chip</li>
<li>STM32F205 120Mhz ARM Cortex M3</li>
<li>1MB flash, 128KB RAM</li>
<li>802.11b/g/n</li>
<li>FCC/CE/IC certified</li>
<li>Open source hardware</li>
<li>On-board RGB status LED (ext. drive provided)</li>
<li>18 Mixed-signal GPIO and advanced peripherals</li>
<li>Real-time operating system (FreeRTOS)</li>
<li>Soft AP setup</li>
</ul>
<p>&nbsp;</p>
<table style="height: 281px;" width="586">
<thead>
<tr>
<th style="text-align: center;">Peripheral Type</th>
<th style="text-align: center;">Qty</th>
<th style="text-align: center;">Input(I) / Output(O)</th>
<th style="text-align: center;">FT<sup>[1]</sup> / 3V3<sup>[2]</sup></th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;">Digital</td>
<td style="text-align: center;">18</td>
<td style="text-align: center;">I/O</td>
<td style="text-align: center;">FT/3V3</td>
</tr>
<tr>
<td style="text-align: center;">Analog (ADC)</td>
<td style="text-align: center;">8</td>
<td style="text-align: center;">I</td>
<td style="text-align: center;">3V3</td>
</tr>
<tr>
<td style="text-align: center;">Analog (DAC)</td>
<td style="text-align: center;">2</td>
<td style="text-align: center;">O</td>
<td style="text-align: center;">3V3</td>
</tr>
<tr>
<td style="text-align: center;">SPI</td>
<td style="text-align: center;">2</td>
<td style="text-align: center;">I/O</td>
<td style="text-align: center;">3V3</td>
</tr>
<tr>
<td style="text-align: center;">I2S</td>
<td style="text-align: center;">1</td>
<td style="text-align: center;">I/O</td>
<td style="text-align: center;">3V3</td>
</tr>
<tr>
<td style="text-align: center;">I2C</td>
<td style="text-align: center;">1</td>
<td style="text-align: center;">I/O</td>
<td style="text-align: center;">FT</td>
</tr>
<tr>
<td style="text-align: center;">CAN</td>
<td style="text-align: center;">1</td>
<td style="text-align: center;">I/O</td>
<td style="text-align: center;">FT</td>
</tr>
<tr>
<td style="text-align: center;">USB</td>
<td style="text-align: center;">1</td>
<td style="text-align: center;">I/O</td>
<td style="text-align: center;">3V3</td>
</tr>
<tr>
<td style="text-align: center;">PWM</td>
<td style="text-align: center;">9<sup>[3]</sup></td>
<td style="text-align: center;">O</td>
<td style="text-align: center;">3V3</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><strong>Notes:</strong></p>
<p><sup>[1]</sup> FT = 5.0V tolerant pins. All pins except A3 and DAC are 5V tolerant (when not in analog mode). If used as a 5V input the pull-up/pull-down resistor must be disabled.</p>
<p><sup>[2]</sup> 3V3 = 3.3V max pins.</p>
<p><sup>[3]</sup> PWM is available on D0, D1, D2, D3, A4, A5, WKP, RX, TX with a caveat: PWM timer peripheral is duplicated on two pins (A5/D2) and (A4/D3) for 7 total independent PWM outputs. For example: PWM may be used on A5 while D2 is used as a GPIO, or D2 as a PWM while A5 is used as an analog input. However A5 and D2 cannot be used as independently controlled PWM outputs at the same time.</p>
<p>&nbsp;</p>
<h2>Photon Graphical Pin Description:</h2>
<p>&nbsp;</p>
<p><a href="https://docs.particle.io/assets/images/photon_pin_markings_1400.png" target="_blank" rel="noopener noreferrer"><img loading="lazy" decoding="async" class="alignnone" src="https://docs.particle.io/assets/images/photon_pin_markings_1400.png" width="1400" height="1513" /></a></p>
<p><a href="https://docs.particle.io/datasheets/photon-datasheet/" target="_blank" rel="noopener noreferrer">Click here</a> to see the Complete Datasheet for <a href="http://shop.edwinrobotics.com/particle/77-particle-photon.html" target="_blank" rel="noopener noreferrer">Particle Photon</a>.</p>
<p>To hookup the OLED with Photon in I2C mode is pretty much same as what we seen with ESP8266 Thing except this point that both the SDA and SCL lines must be pulled high always. Refer the connection diagram for better idea.</p>
<p><a href="http://learn.edwinrobotics.com/wp-content/uploads/photon-oled.png" target="_blank" rel="noopener noreferrer"><img loading="lazy" decoding="async" class="alignnone wp-image-349 size-full" src="http://learn.edwinrobotics.com/wp-content/uploads/photon-oled.png" alt="photon-oled" width="861" height="629" srcset="https://learn.edwinrobotics.com/wp-content/uploads/photon-oled.png 861w, https://learn.edwinrobotics.com/wp-content/uploads/photon-oled-300x219.png 300w" sizes="auto, (max-width: 861px) 100vw, 861px" /></a></p>
<p>Pullup is the thing you need to take care of, we used 10kΩ Resistor for pullup and connected it to 3v3 supply line as shown in the figure.</p>
<p>&nbsp;</p>
<h2><strong>Programme the Particle Photon:</strong></h2>
<p>Photon can be programmed in three ways:</p>
<ul>
<li>Particle Build(Online)</li>
<li>Particle Dev(Half Online, Half Offline)</li>
<li>ARM GCC and the DFU Bootloader (Offline)</li>
</ul>
<p>We recommend you to start with Particle Build(Online), the Particle Build IDE is an always-online, browser-based portal where your Photon code can be edited, saved, and shared. This cloud-based IDE handles code compilation and flashes the built binaries to your Photon over-the-air. You don’t even need your Photon next to you to update its program!</p>
<p>To load the Build IDE head over to <a href="https://build.particle.io/" target="_blank" rel="noopener noreferrer">build.particle.io</a>.</p>
<p>Sparkfun has provided more detailed Instructions for the beginners to understand the IDE better, <a href="https://learn.sparkfun.com/tutorials/photon-development-guide/particle-build-online" target="_blank" rel="noopener noreferrer">Click here</a> to see the Particle Build(Online) guide.</p>
<p>Similarly they provided instruction to understand <a href="https://learn.sparkfun.com/tutorials/photon-development-guide/particle-dev-half-online-half-offline" target="_blank" rel="noopener noreferrer">Particle Dev(Half Online, Half Offline) guide</a> and <a href="https://learn.sparkfun.com/tutorials/photon-development-guide/arm-gcc-and-the-dfu-bootloader-offline" target="_blank" rel="noopener noreferrer">ARM GCC and the DFU Bootloader (Offline) guide</a>.</p>
<p>&nbsp;</p>
<p>To run the OLED program in the Particle Build(online), follow these steps:</p>
<ul>
<li>Add your device to the Particle Build.
<ul>
<li>Download Particle Mobile App to your Handset- <a href="https://itunes.apple.com/us/app/particle-build-photon-electron/id991459054?ls=1&amp;mt=8" target="_blank" rel="noopener noreferrer">iPhone</a> | <a href="https://play.google.com/store/apps/details?id=io.particle.android.app" target="_blank" rel="noopener noreferrer">Android</a></li>
<li>Open the app on your phone. Log in or sign up for an account with Particle if you don&#8217;t have one.</li>
<li>Use this <a href="https://docs.particle.io/guide/getting-started/start/photon/#step-2-connect-with-your-smartphone" target="_blank" rel="noopener noreferrer">Particle First time setup guide</a></li>
</ul>
</li>
<li>Open the online terminal <a href="https://build.particle.io/" target="_blank" rel="noopener noreferrer">build.particle.io</a> and login in to your account</li>
<li>Check under devices tab that whether your devices is listed or not, if not try to add it using mobile app.</li>
<li>Goto &#8221; <strong>code tab</strong>  -&gt; <strong>Create New App </strong>&#8220;</li>
<li>Add micro OLED library to current App.</li>
<li>To add Librbary, goto: &#8221; <strong>Libraries Tab</strong> -&gt; <strong>Community Library Search Box</strong> -&gt; type <strong>OLED </strong>&#8220;</li>
<li>There you will see <strong>SPARKFUNMICROOLED </strong>Library, Click &#8221; <strong>Include in App </strong>&#8221; option.</li>
<li>Save the App using save option.</li>
<li>Use the following code to begin with</li>
</ul>
<blockquote><p><span style="color: #33cccc;">/******************************************************************************</span><br />
<span style="color: #33cccc;"> Micro-OLED-Shield-Example.ino</span><br />
<span style="color: #33cccc;"> SparkFun Micro OLED Library Hello World Example</span><br />
<span style="color: #33cccc;"> Jim Lindblom @ SparkFun Electronics</span><br />
<span style="color: #33cccc;"> Original Creation Date: June 22, 2015</span></p>
<p><span style="color: #33cccc;">This sketch prints a friendly, recognizable logo on the OLED Shield, then</span><br />
<span style="color: #33cccc;"> goes on to demo the Micro OLED library&#8217;s functionality drawing pixels,</span><br />
<span style="color: #33cccc;"> lines, shapes, and text.</span></p>
<p><span style="color: #33cccc;">Hardware Connections:</span><br />
<span style="color: #33cccc;"> This sketch was written specifically for the Photon Micro OLED Shield,</span><br />
<span style="color: #33cccc;"> which does all the wiring for you. If you have a Micro OLED breakout,</span><br />
<span style="color: #33cccc;"> use the following hardware setup:</span></p>
<p><span style="color: #33cccc;">MicroOLED &#8212;&#8212;&#8212;&#8212;- Photon</span><br />
<span style="color: #33cccc;"> GND &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- GND</span><br />
<span style="color: #33cccc;"> VDD &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- 3.3V (VCC)</span><br />
<span style="color: #33cccc;"> D1/MOSI &#8212;&#8212;&#8212;&#8212;&#8212;&#8211; A5 (don&#8217;t change)</span><br />
<span style="color: #33cccc;"> D0/SCK &#8212;&#8212;&#8212;&#8212;&#8212;&#8212; A3 (don&#8217;t change)</span><br />
<span style="color: #33cccc;"> D2</span><br />
<span style="color: #33cccc;"> D/C &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- D6 (can be any digital pin)</span><br />
<span style="color: #33cccc;"> RST &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- D7 (can be any digital pin)</span><br />
<span style="color: #33cccc;"> CS &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- A2 (can be any digital pin)</span></p>
<p><span style="color: #33cccc;">Development environment specifics:</span><br />
<span style="color: #33cccc;"> IDE: Particle Build</span><br />
<span style="color: #33cccc;"> Hardware Platform: Particle Photon</span><br />
<span style="color: #33cccc;"> SparkFun Photon Micro OLED Shield</span></p>
<p><span style="color: #33cccc;">This code is beerware; if you see me (or any other SparkFun</span><br />
<span style="color: #33cccc;"> employee) at the local, and you&#8217;ve found our code helpful,</span><br />
<span style="color: #33cccc;"> please buy us a round!</span></p>
<p><span style="color: #33cccc;">Distributed as-is; no warranty is given.</span><br />
<span style="color: #33cccc;"> *******************************************************************************/</span><br />
#include &#8220;SparkFunMicroOLED/SparkFunMicroOLED.h&#8221; <span style="color: #33cccc;">// Include MicroOLED library</span><br />
#include &#8220;math.h&#8221;</p>
<p><span style="color: #33cccc;">//////////////////////////////////</span><br />
<span style="color: #33cccc;"> // MicroOLED Object Declaration //</span><br />
<span style="color: #33cccc;"> //////////////////////////////////</span><br />
<span style="color: #33cccc;"> // Declare a MicroOLED object. If no parameters are supplied, default pins are</span><br />
<span style="color: #33cccc;"> // used, which will work for the Photon Micro OLED Shield (RST=D7, DC=D6, CS=A2)</span><br />
<span style="color: #33cccc;"> //MicroOLED oled;</span><br />
MicroOLED oled(MODE_I2C, D6); <span style="color: #33cccc;">// Example I2C declaration RST=D7, DC=LOW (0)</span></p>
<p><span style="color: #33cccc;">//SYSTEM_MODE(MANUAL);</span></p>
<p>void setup()<br />
{<br />
Serial.begin(9600);<br />
oled.begin(); <span style="color: #33cccc;">// Initialize the OLED</span><br />
oled.clear(ALL); <span style="color: #33cccc;">// Clear the display&#8217;s internal memory</span><br />
oled.display(); <span style="color: #33cccc;">// Display what&#8217;s in the buffer (splashscreen)</span><br />
delay(1000);<span style="color: #33cccc;"> // Delay 1000 ms</span><br />
randomSeed(analogRead(A0) + analogRead(A1));<br />
}</p>
<p>void loop()<br />
{<br />
pixelExample();<span style="color: #33cccc;"> // Run the pixel example function</span><br />
lineExample(); <span style="color: #33cccc;">// Then the line example function</span><br />
shapeExample(); <span style="color: #33cccc;">// Then the shape example</span><br />
textExamples(); <span style="color: #33cccc;">// Finally the text example</span><br />
<span style="color: #33cccc;"> }</span></p>
<p>void pixelExample()<br />
{<br />
printTitle(&#8220;Pixels&#8221;, 1);</p>
<p>for (int i=0; i&lt;512; i++)<br />
{<br />
oled.pixel(random(oled.getLCDWidth()), random(oled.getLCDHeight()));<br />
oled.display();<br />
}<br />
}</p>
<p>void lineExample()<br />
{<br />
int middleX = oled.getLCDWidth() / 2;<br />
int middleY = oled.getLCDHeight() / 2;<br />
int xEnd, yEnd;<br />
int lineWidth = min(middleX, middleY);</p>
<p>printTitle(&#8220;Lines!&#8221;, 1);</p>
<p>for (int i=0; i&lt;3; i++)<br />
{<br />
for (int deg=0; deg&lt;360; deg+=15)<br />
{<br />
xEnd = lineWidth * cos(deg * M_PI / 180.0);<br />
yEnd = lineWidth * sin(deg * M_PI / 180.0);</p>
<p>oled.line(middleX, middleY, middleX + xEnd, middleY + yEnd);<br />
oled.display();<br />
delay(10);<br />
}<br />
for (int deg=0; deg&lt;360; deg+=15)<br />
{<br />
xEnd = lineWidth * cos(deg * M_PI / 180.0);<br />
yEnd = lineWidth * sin(deg * M_PI / 180.0);</p>
<p>oled.line(middleX, middleY, middleX + xEnd, middleY + yEnd, BLACK, NORM);<br />
oled.display();<br />
delay(10);<br />
}<br />
}<br />
}</p>
<p>void shapeExample()<br />
{<br />
printTitle(&#8220;Shapes!&#8221;, 0);</p>
<p><span style="color: #33cccc;">// Silly pong demo. It takes a lot of work to fake pong&#8230;</span><br />
int paddleW = 3; <span style="color: #33cccc;">// Paddle width</span><br />
int paddleH = 15; <span style="color: #33cccc;">// Paddle height</span><br />
<span style="color: #33cccc;">// Paddle 0 (left) position coordinates</span><br />
int paddle0_Y = (oled.getLCDHeight() / 2) &#8211; (paddleH / 2);<br />
int paddle0_X = 2;<br />
<span style="color: #33cccc;">// Paddle 1 (right) position coordinates</span><br />
int paddle1_Y = (oled.getLCDHeight() / 2) &#8211; (paddleH / 2);<br />
int paddle1_X = oled.getLCDWidth() &#8211; 3 &#8211; paddleW;<br />
int ball_rad = 2; <span style="color: #33cccc;">// Ball radius</span><br />
<span style="color: #33cccc;">// Ball position coordinates</span><br />
int ball_X = paddle0_X + paddleW + ball_rad;<br />
int ball_Y = random(1 + ball_rad, oled.getLCDHeight() &#8211; ball_rad);<span style="color: #33cccc;">//paddle0_Y + ball_rad;</span><br />
int ballVelocityX = 1; <span style="color: #33cccc;">// Ball left/right velocity</span><br />
int ballVelocityY = 1; <span style="color: #33cccc;">// Ball up/down velocity</span><br />
int paddle0Velocity = -1; <span style="color: #33cccc;">// Paddle 0 velocity</span><br />
int paddle1Velocity = 1; <span style="color: #33cccc;">// Paddle 1 velocity</span></p>
<p>//while(ball_X &gt;= paddle0_X + paddleW &#8211; 1)<br />
while ((ball_X &#8211; ball_rad &gt; 1) &amp;&amp;<br />
(ball_X + ball_rad &lt; oled.getLCDWidth() &#8211; 2))<br />
{<br />
<span style="color: #33cccc;">// Increment ball&#8217;s position</span><br />
ball_X+=ballVelocityX;<br />
ball_Y+=ballVelocityY;<br />
<span style="color: #33cccc;">// Check if the ball is colliding with the left paddle</span><br />
if (ball_X &#8211; ball_rad &lt; paddle0_X + paddleW)<br />
{<br />
<span style="color: #33cccc;">// Check if ball is within paddle&#8217;s height</span><br />
if ((ball_Y &gt; paddle0_Y) &amp;&amp; (ball_Y &lt; paddle0_Y + paddleH))<br />
{<br />
ball_X++; <span style="color: #33cccc;">// Move ball over one to the right</span><br />
ballVelocityX = -ballVelocityX; <span style="color: #33cccc;">// Change velocity</span><br />
}<br />
}<br />
<span style="color: #33cccc;">// Check if the ball hit the right paddle</span><br />
if (ball_X + ball_rad &gt; paddle1_X)<br />
{<br />
<span style="color: #33cccc;">// Check if ball is within paddle&#8217;s height</span><br />
if ((ball_Y &gt; paddle1_Y) &amp;&amp; (ball_Y &lt; paddle1_Y + paddleH))<br />
{<br />
ball_X&#8211;; <span style="color: #33cccc;">// Move ball over one to the left</span><br />
ballVelocityX = -ballVelocityX; <span style="color: #33cccc;">// change velocity</span><br />
}<br />
}<br />
<span style="color: #33cccc;">// Check if the ball hit the top or bottom</span><br />
if ((ball_Y &lt;= ball_rad) || (ball_Y &gt;= (oled.getLCDHeight() &#8211; ball_rad &#8211; 1)))<br />
{<br />
<span style="color: #33cccc;">// Change up/down velocity direction</span><br />
ballVelocityY = -ballVelocityY;<br />
}<br />
<span style="color: #33cccc;">// Move the paddles up and down</span><br />
paddle0_Y += paddle0Velocity;<br />
paddle1_Y += paddle1Velocity;<br />
<span style="color: #33cccc;">// Change paddle 0&#8217;s direction if it hit top/bottom</span><br />
if ((paddle0_Y &lt;= 1) || (paddle0_Y &gt; oled.getLCDHeight() &#8211; 2 &#8211; paddleH))<br />
{<br />
paddle0Velocity = -paddle0Velocity;<br />
}<br />
<span style="color: #33cccc;">// Change paddle 1&#8217;s direction if it hit top/bottom</span><br />
if ((paddle1_Y &lt;= 1) || (paddle1_Y &gt; oled.getLCDHeight() &#8211; 2 &#8211; paddleH))<br />
{<br />
paddle1Velocity = -paddle1Velocity;<br />
}</p>
<p>/<span style="color: #33cccc;">/ Draw the Pong Field</span><br />
<span style="color: #33cccc;"> oled.clear(PAGE); // Clear the page</span><br />
<span style="color: #33cccc;"> // Draw an outline of the screen:</span><br />
oled.rect(0, 0, oled.getLCDWidth() &#8211; 1, oled.getLCDHeight());<br />
<span style="color: #33cccc;">// Draw the center line</span><br />
oled.rectFill(oled.getLCDWidth()/2 &#8211; 1, 0, 2, oled.getLCDHeight());<br />
<span style="color: #33cccc;">// Draw the Paddles:</span><br />
oled.rectFill(paddle0_X, paddle0_Y, paddleW, paddleH);<br />
oled.rectFill(paddle1_X, paddle1_Y, paddleW, paddleH);<br />
<span style="color: #33cccc;">// Draw the ball:</span><br />
oled.circle(ball_X, ball_Y, ball_rad);<br />
<span style="color: #33cccc;">// Actually draw everything on the screen:</span><br />
oled.display();<br />
delay(25); <span style="color: #33cccc;">// Delay for visibility</span><br />
<span style="color: #33cccc;"> }</span><br />
delay(1000);<br />
}</p>
<p>void textExamples()<br />
{<br />
printTitle(&#8220;Text!&#8221;, 1);</p>
<p><span style="color: #33cccc;">// Demonstrate font 0. 5&#215;8 font</span><br />
oled.clear(PAGE);<span style="color: #33cccc;"> // Clear the screen</span><br />
oled.setFontType(0); <span style="color: #33cccc;">// Set font to type 0</span><br />
oled.setCursor(0, 0); <span style="color: #33cccc;">// Set cursor to top-left</span><br />
<span style="color: #33cccc;">// There are 255 possible characters in the font 0 type.</span><br />
<span style="color: #33cccc;"> // Lets run through all of them and print them out!</span><br />
for (int i=0; i&lt;=255; i++)<br />
{<br />
<span style="color: #33cccc;">// You can write byte values and they&#8217;ll be mapped to</span><br />
<span style="color: #33cccc;"> // their ASCII equivalent character.</span><br />
oled.write(i); <span style="color: #33cccc;">// Write a byte out as a character</span><br />
oled.display(); <span style="color: #33cccc;">// Draw on the screen</span><br />
delay(10); <span style="color: #33cccc;">// Wait 10ms</span><br />
<span style="color: #33cccc;">// We can only display 60 font 0 characters at a time.</span><br />
<span style="color: #33cccc;"> // Every 60 characters, pause for a moment. Then clear</span><br />
<span style="color: #33cccc;"> // the page and start over.</span><br />
if ((i%60 == 0) &amp;&amp; (i != 0))<br />
{<br />
delay(500); <span style="color: #33cccc;">// Delay 500 ms</span><br />
oled.clear(PAGE); <span style="color: #33cccc;">// Clear the page</span><br />
oled.setCursor(0, 0); <span style="color: #33cccc;">// Set cursor to top-left</span><br />
}<br />
}<br />
delay(500); <span style="color: #33cccc;">// Wait 500ms before next example</span></p>
<p><span style="color: #33cccc;">// Demonstrate font 1. 8&#215;16. Let&#8217;s use the print function</span><br />
<span style="color: #33cccc;"> // to display every character defined in this font.</span><br />
oled.setFontType(1); // Set font to type 1<br />
oled.clear(PAGE); <span style="color: #33cccc;">// Clear the page</span><br />
oled.setCursor(0, 0); <span style="color: #33cccc;">// Set cursor to top-left</span><br />
<span style="color: #33cccc;">// Print can be used to print a string to the screen:</span><br />
oled.print(&#8221; !\&#8221;#$%&amp;'()*+,-./01234&#8243;);<br />
oled.display(); <span style="color: #33cccc;">// Refresh the display</span><br />
delay(1000); <span style="color: #33cccc;">// Delay a second and repeat</span><br />
oled.clear(PAGE);<br />
oled.setCursor(0, 0);<br />
oled.print(&#8220;56789:;&lt;=&gt;?@ABCDEFGHI&#8221;);<br />
oled.display();<br />
delay(1000);<br />
oled.clear(PAGE);<br />
oled.setCursor(0, 0);<br />
oled.print(&#8220;JKLMNOPQRSTUVWXYZ[\\]^&#8221;);<br />
oled.display();<br />
delay(1000);<br />
oled.clear(PAGE);<br />
oled.setCursor(0, 0);<br />
oled.print(&#8220;_`abcdefghijklmnopqrs&#8221;);<br />
oled.display();<br />
delay(1000);<br />
oled.clear(PAGE);<br />
oled.setCursor(0, 0);<br />
oled.print(&#8220;tuvwxyz{|}~&#8221;);<br />
oled.display();<br />
delay(1000);</p>
<p><span style="color: #33cccc;">// Demonstrate font 2. 10&#215;16. Only numbers and &#8216;.&#8217; are defined.</span><br />
<span style="color: #33cccc;"> // This font looks like 7-segment displays.</span><br />
<span style="color: #33cccc;"> // Lets use this big-ish font to display readings from the</span><br />
<span style="color: #33cccc;"> // analog pins.</span><br />
for (int i=0; i&lt;25; i++)<br />
{<br />
oled.clear(PAGE); <span style="color: #33cccc;">// Clear the display</span><br />
oled.setCursor(0, 0); <span style="color: #33cccc;">// Set cursor to top-left</span><br />
oled.setFontType(0); <span style="color: #33cccc;">// Smallest font</span><br />
oled.print(&#8220;A0:&#8221;); <span style="color: #33cccc;">// Print &#8220;A0&#8221;</span><br />
oled.setFontType(2);<span style="color: #33cccc;"> // 7-segment font</span><br />
oled.print(analogRead(A0)); <span style="color: #33cccc;">// Print a0 reading</span><br />
oled.setCursor(0, 16); <span style="color: #33cccc;">// Set cursor to top-middle-left</span><br />
oled.setFontType(0); <span style="color: #33cccc;">// Repeat</span><br />
oled.print(&#8220;A1:&#8221;);<br />
oled.setFontType(2);<br />
oled.print(analogRead(A1));<br />
oled.setCursor(0, 32);<br />
oled.setFontType(0);<br />
oled.print(&#8220;A7:&#8221;);<br />
oled.setFontType(2);<br />
oled.print(analogRead(A7));<br />
oled.display();<br />
delay(100);<br />
}</p>
<p><span style="color: #33cccc;">// Demonstrate font 3. 12&#215;48. Stopwatch demo.</span><br />
oled.setFontType(3); <span style="color: #33cccc;">// Use the biggest font</span><br />
int ms = 0;<br />
int s = 0;<br />
while (s &lt;= 50)<br />
{<br />
oled.clear(PAGE); <span style="color: #33cccc;">// Clear the display</span><br />
oled.setCursor(0, 0); <span style="color: #33cccc;">// Set cursor to top-left</span><br />
if (s &lt; 10)<br />
oled.print(&#8220;00&#8221;);<span style="color: #33cccc;"> // Print &#8220;00&#8221; if s is 1 digit</span><br />
else if (s &lt; 100)<br />
oled.print(&#8220;0&#8221;); <span style="color: #33cccc;">// Print &#8220;0&#8221; if s is 2 digits</span><br />
oled.print(s); <span style="color: #33cccc;">// Print s&#8217;s value</span><br />
<span style="color: #33cccc;"> oled.print(&#8220;:&#8221;); // Print &#8220;:&#8221;</span><br />
oled.print(ms);<span style="color: #33cccc;"> // Print ms value</span><br />
oled.display(); <span style="color: #33cccc;">// Draw on the screen</span><br />
ms++; // Increment ms<br />
if (ms &gt;= 10) <span style="color: #33cccc;">// If ms is &gt;= 10</span><br />
{<br />
ms = 0; <span style="color: #33cccc;">// Set ms back to 0</span><br />
s++; <span style="color: #33cccc;">// and increment s</span><br />
}<br />
delay(1);<br />
}<br />
}</p>
<p><span style="color: #33cccc;">// Center and print a small title</span><br />
<span style="color: #33cccc;"> // This function is quick and dirty. Only works for titles one</span><br />
<span style="color: #33cccc;"> // line long.</span><br />
void printTitle(String title, int font)<br />
{<br />
int middleX = oled.getLCDWidth() / 2;<br />
int middleY = oled.getLCDHeight() / 2;</p>
<p>oled.clear(PAGE);<br />
oled.setFontType(font);<br />
<span style="color: #33cccc;">// Try to set the cursor in the middle of the screen</span><br />
oled.setCursor(middleX &#8211; (oled.getFontWidth() * (title.length()/2)),<br />
middleY &#8211; (oled.getFontWidth() / 2));<br />
<span style="color: #33cccc;">// Print the title:</span><br />
oled.print(title);<br />
oled.display();<br />
delay(1500);<br />
oled.clear(PAGE);<br />
}</p></blockquote>
<p>&nbsp;</p>
<p>Care must be taken to initialize object in the code for I2C communication, use the following parameter for declartion based on your application.<br />
<span style="color: #33cccc;">//MicroOLED oled(MODE_SPI, PIN_RESET, PIN_DC, PIN_CS); // Example SPI declaration</span><br />
<span style="color: #33cccc;"> //MicroOLED oled(MODE_I2C, PIN_RESET); // Example I2C declaration</span></p>
<p>&nbsp;</p>
<p>Note: The Hookup shown here for I2C communication is tested and in working condition, to do the SPI interface of the OLED Module, you need to do the following things:</p>
<ul>
<li>Modify the Jumpers on the back of the OLED breakout for SPI Communication</li>
<li><a href="https://learn.sparkfun.com/tutorials/micro-oled-breakout-hookup-guide#breakout-board-overview" target="_blank" rel="noopener noreferrer">Visit here</a> for jumper settings</li>
<li>Refer the shown connection chart below for SPI connection.</li>
<li>Make sure to initialize these connected pins in the object declaration.</li>
</ul>
<blockquote><p>&nbsp;</p>
<table>
<tbody>
<tr>
<td width="227">
<p style="text-align: center;"><strong>OLED</strong></p>
</td>
<td style="text-align: center;" width="227"><strong>Photon</strong></td>
<td style="text-align: center;" width="147"><strong>ESP8266</strong></td>
</tr>
<tr>
<td width="227">
<p style="text-align: center;">GND</p>
</td>
<td style="text-align: center;" width="227">GND</td>
<td style="text-align: center;" width="147">GND</td>
</tr>
<tr>
<td width="227">
<p style="text-align: center;">3v3</p>
</td>
<td style="text-align: center;" width="227">3v3</td>
<td style="text-align: center;" width="147">3v3</td>
</tr>
<tr>
<td width="227">
<p style="text-align: center;">D1-MOSI</p>
</td>
<td style="text-align: center;" width="227">
<table style="height: 62px;" width="256">
<tbody>
<tr>
<td width="118">A5</td>
<td width="67">D2</td>
</tr>
</tbody>
</table>
</td>
<td style="text-align: center;" width="147">13</td>
</tr>
<tr>
<td style="text-align: center;" width="227">D0-SCK</td>
<td style="text-align: center;" width="227">
<table style="height: 57px;" width="257">
<tbody>
<tr>
<td width="118">A3</td>
<td width="67">D4</td>
</tr>
</tbody>
</table>
</td>
<td width="147">
<p style="text-align: center;">14</p>
</td>
</tr>
<tr>
<td style="text-align: center;" width="227">D2-MISO</td>
<td style="text-align: center;" width="227">
<table style="height: 58px;" width="257">
<tbody>
<tr>
<td width="118">A4</td>
<td width="67">D3</td>
</tr>
</tbody>
</table>
</td>
<td width="147">
<p style="text-align: center;">12</p>
</td>
</tr>
<tr>
<td style="text-align: center;" width="227">DC</td>
<td style="text-align: center;" width="227">
<table style="height: 64px;" width="256">
<tbody>
<tr>
<td width="118">&#8211;</td>
<td width="67">&#8211;</td>
</tr>
</tbody>
</table>
</td>
<td width="147">
<p style="text-align: center;">&#8211;</p>
</td>
</tr>
<tr>
<td style="text-align: center;" width="227">RST</td>
<td style="text-align: center;" width="227">
<table style="height: 80px;" width="313">
<tbody>
<tr>
<td width="118">Any Digital pin</td>
<td width="111">Any Digital pin</td>
</tr>
</tbody>
</table>
</td>
<td width="147">
<p style="text-align: center;">D5</p>
</td>
</tr>
<tr>
<td style="text-align: center;" width="227">CS</td>
<td style="text-align: center;" width="227">
<table style="height: 62px;" width="312">
<tbody>
<tr>
<td width="125">Any Digital Pin</td>
<td width="113">Any Digital Pin</td>
</tr>
</tbody>
</table>
</td>
<td width="147">
<p style="text-align: center;">D4/D2</p>
</td>
</tr>
</tbody>
</table>
</blockquote>
<p><strong> Note: </strong>Use any one of the SPI peripheral of the photon. MISO pins can be unused.</p>
<h2><strong>Buy: </strong></h2>
<ul>
<li><strong><a href="http://shop.edwinrobotics.com/displays/118-sparkfun-microview-oled-arduino-module.html" target="_blank" rel="noopener noreferrer">SparkFun MicroView – OLED Arduino Module</a></strong></li>
<li><strong><a href="http://shop.edwinrobotics.com/particle/77-particle-photon.html" target="_blank" rel="noopener noreferrer">Particle Photon</a></strong></li>
</ul>
<h2>Source:</h2>
<ul>
<li><a href="https://en.wikipedia.org/wiki/ESP8266" target="_blank" rel="noopener noreferrer">ESp8266 Wiki</a></li>
<li><a href="https://www.particle.io/prototype" target="_blank" rel="noopener noreferrer">Particle Photon</a></li>
<li><a href="https://learn.sparkfun.com/tutorials/micro-oled-breakout-hookup-guide" target="_blank" rel="noopener noreferrer">Sparkfun Micro OLED Hookup</a></li>
<li><a href="https://docs.particle.io/guide/getting-started/start/photon/" target="_blank" rel="noopener noreferrer">Particle Photon Docs</a></li>
<li><a href="https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide">ESP8266 Thing Hookup Guide</a></li>
<li><a href="https://learn.sparkfun.com/tutorials/photon-development-guide/introduction" target="_blank" rel="noopener noreferrer">Sparkfun Photon Development Guide</a></li>
<li><a href="https://en.wikipedia.org/wiki/OLED" target="_blank" rel="noopener noreferrer">OLED Wiki</a></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://learn.edwinrobotics.com/micro-oled-hookup-guide-for-esp8266-and-particle-photon/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/

Object Caching 58/102 objects using APC
Page Caching using Disk: Enhanced 
Lazy Loading (feed)
Database Caching 7/26 queries in 0.016 seconds using APC

Served from: learn.edwinrobotics.com @ 2025-07-23 21:02:27 by W3 Total Cache
-->