Wiring and coding a beautiful screen RC1602B5-LLH-JWV with Arduino

I came across this great looking screen on TME one day and decided to give it a go. Unfortunately, I didn’t manage to get it to work on the first attempt.

I found it recently in my things and decided to give it a go. I finally managed to display things on it, and it is beautiful!

Here’s a list of things I used:

Wire your screen as I showed on image below made with Fritzing.

Please keep in mind that I had to use parts that were available in Fritzing.

Here is what it looks like in my case:

Once you got your screen connected, its the time for coding!

// HelloWorld - simple demonstration of lcd
// Created by Bill Perry 2016-07-02
// bperrybap@opensource.billsworld.billandterrie.com
//
// This example code is unlicensed and is released into the public domain
// ----------------------------------------------------------------------------
// 
// Sketch will print "Hello, World!" on top row of lcd
// and will print the amount of time since the Arduino has been reset
// on the second row.
//
// If initialization of the LCD fails and the arduino supports a built in LED,
// the sketch will simply blink the built in LED.
//

#include <Wire.h>	// can be left out in arduino.cc IDE 1.6.7 and later
#include <hd44780.h>	// can be left out in arduino.cc IDE 1.6.7 and later
#include <hd44780_I2Clcd.h>

//
// enter address of LCD.
// Addresses seen so far include:
// - 0x3a, 0x3b (PCF2119x)
// - 0x3c (unknwon chip)
// - 0x3d (unknwon chip)
// - 0x3e (unknwon chip)
// - 0x3f (unknwon chip)

const int i2c_addr = 0x3c;

hd44780_I2Clcd lcd(i2c_addr);

// LCD geometry
const int LCD_ROWS = 2;
const int LCD_COLS = 16;

void setup()
{
	// initialize LCD with number of columns and rows: 
	if( lcd.begin(LCD_COLS, LCD_ROWS))
	{
		// begin() failed so blink the onboard LED if possible
#ifdef LED_BUILTIN
		pinMode(LED_BUILTIN, OUTPUT);
		while(1)
		{
			digitalWrite(LED_BUILTIN, HIGH);
			delay(500);
			digitalWrite(LED_BUILTIN, LOW);
			delay(500);
		}
#else
		while(1){} // spin and do nothing
#endif
	}
	
	// Print a message to the LCD
	lcd.print("Hello, World!");
}

void loop()
{
static unsigned long lastsecs = -1; // pre-initialize with non zero value
unsigned long secs;

	secs = millis() / 1000;

	// see if 1 second has passed
	// so the display is only updated once per second
	if(secs != lastsecs)
	{
		lastsecs = secs; // keep track of last seconds

		// set the cursor position to column 0, row 1
		// note: row 1 is the second row from top,
		// since row counting begins with 0
		lcd.setCursor(0, 1);

		// print uptime on lcd device: (time since last reset)
		PrintUpTime(lcd, secs);
	}
}

// PrintUpTime(outdev, secs) - print uptime in HH:MM:SS format
// outdev - the device to send output
//   secs - the total number of seconds uptime
void PrintUpTime(Print &outdev, unsigned long secs)
{
unsigned int hr, mins, sec;

	// convert total seconds to hours, mins, seconds
	mins =  secs / 60;	// how many total minutes
	hr = mins / 60;		// how many total hours
	mins = mins % 60;	// how many minutes within the hour
	sec = secs % 60;	// how many seconds within the minute
		

	// print uptime in HH:MM:SS format
	// Print class does not support fixed width formatting
	// so insert a zero if number smaller than 10
	if(hr < 10)
		outdev.write('0');
	outdev.print((int)hr);
	outdev.write(':');
	if(mins < 10)
		outdev.write('0');
	outdev.print((int)mins);
	outdev.write(':');
	if(sec < 10)
		outdev.write('0');
	outdev.print((int)sec);
}

[Python / OSX]Get network connection details, restart wifi, and do more than you think straight from python

Hi!
I recently figured out how to restart internet(en0) interface on OSX and read some interesting details about our connection. Thanks to objc library I was able to access objective-C methods provided by OSX.
Here is CWInterface Class Reference. Check it out because this documentation provide many interesting methods.

Continue reading [Python / OSX]Get network connection details, restart wifi, and do more than you think straight from python

[Python]How to scan for available networks on OSX

Hi!
I’m posting this simple code for getting list of avaliable networks on OSX.


#!/usr/bin/python
import os

f = os.popen('airport -s')
now = f.read().splitlines(True)
database=[]
for x in range(1,len(now)):
	i = now[x].strip().index(':')
	ssid_database=now[x].strip()
	#print(ssid_database)
	database.append(ssid_database[0:i-3])
print(database)

Try that with
python filename.py

Have fun! 🙂

[TUT] Jak wykonać screenshot snapchata i pozostać niewykrytym / How to make screenshot of someone’s snapchat and stay undetected

Jeżeli posiadacie Snapchat dobrze wiecie, że pojawia się tam sporo interesujących zdjęc które chcielibyśmy zachowac w pamięci naszego telefonu. Jednak sprawa nie jest tak prosta jak mogłoby się wydawać. Każdy screenshot czyli przechwycenie obrazu z ekranu przez użytkownika jest odnotowywane a informacja o tym zdarzeniu zostaje wysłana do waszego rozmówcy.

Istnieje jednak prosty sposób aby tego uniknąć.

Continue reading [TUT] Jak wykonać screenshot snapchata i pozostać niewykrytym / How to make screenshot of someone’s snapchat and stay undetected

Witaj na moim blogu! / Hello and welcome on my dev blog!

Niejednokrotnie pisząc jakiś kod napotykałem błędy i problemy. Czasami internet nie pomagał więc jedyne co mogłem zrobić to mozolnie, krok po kroku próbować dojśc do momentu kiedy kod działał.

Dlatego stworzyłem tego bloga.. żeby oszczędzić innym ludziom czasu spędzonego na szukaniu informacji.

Każdy wpis poza tym będę dublował pisząc go po Polsku i Angielsku.

Czytajcie więc 🙂


It was not only once when I was writing some code and I faced errors and problems. Sometimes internet couldn’t help me, so the only thing that I could do was to slowly, step by step trying to reach the moment when the code worked.

That’s why I created this blog.. to save your time.

Every article will be published  2 times. I will write in English and Polish.

So read 🙂