Monday 17 August 2020

1.8" Color TFT LCD display - ST7735R compatible


https://www.adafruit.com/product/358

https://github.com/adafruit/Adafruit-ST7735-Library

https://www.xtronical.com/basics/displays/lcd-tft-colourcolor-display-128x128-pixelst7735-driver/lcd-tft-colourcolor-display-128x128-pixel-1-44inch-3-7cm-st7735-driver/

http://www.zonnepanelen.wouterlood.com/arduino-bare-basics/4-arduino-and-160x128-tft-display-with-a-st7735s-controller/

 

https://thesolaruniverse.wordpress.com/2019/12/24/connecting-a-240x240-tft-display-with-st7789-controller-with-a-nodemcu-esp8266-or-an-arduino-nano/

 

PINOUTS

LCD     ARDUINO NANO

GND --- GND 

VCC --- 3v3

SCL --- D13 SPI SCK

SDA --- D11 SPI MOSI

RES --- RST (set as -1 in code) // was D9*

DC  --- D9* (register select) choose pin // was D8*

CS  --- D10 SPI SS

BL  === (BACK LIGHT)???

 

 

This option needed because x0,y0 coordinate starts at an offset.



Tuesday 7 August 2018

OLED + 4WD Hercules board


Tried hooking up an AdaFruit (clone) OLED  to a 4WD Hercules (incl motor controller) board. Too much used up after compilation. Error message:

Sketch uses 10366 bytes (33%) of program storage space. Maximum is 30720 bytes.
Global variables use 2140 bytes (104%) of dynamic memory, leaving -92 bytes for local variables. Maximum is 2048 bytes.
Not enough memory; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing your footprint.
Error compiling for board Arduino Pro or Pro Mini.

Apparently, the OLED display uses lots of memory, 1 KB or RAM according to this website:

https://learn.adafruit.com/memories-of-an-arduino/large-memory-consumers#step-5

(Screencap included)

Now, I need to have some input/output, either:

  1.  Two buttons + small display
  2.  Wireless "terminal"
Hmmm.... so, either:
  1.  Add another Arduino (mini?) with OLED --  data via UART between the two Arduinos; Plus two buttons
  2. Add HC05 BT module -- use mobile phone as terminal.
Pros/cons with option 1:  +++ Small enough to fit into a small breadboard --- Can't locate my Arduino mini at the moment. At home maybe? --- Need to put them all on a protoboard later or they will go "missing".

Pros/cons with option 2: +++ I think I have an HC05 module already +++ quick setup --- Have to have HP later during "running"

UPDATE:

It turned up that there are libraries for the OLED display that uses TEXT ONLY, thus not requiring large RAM -- the screen is not buffered/duplicated for graphics... yeay!!!

Discussion about it here: https://forum.arduino.cc/index.php?topic=335594.0

The library: https://github.com/greiman/SSD1306Ascii. Downloaded this one as a ZIP, extracted into the my Arduino Library folder, removed some of the files (docs), move the filed from the SRC folder out to the main folder.... It worked!!! (see pic).


Another library but works for SPI only:

https://github.com/stanleyseow/ArduinoTracker-MicroAPRS/tree/master/libraries/SSD1306_text. (This one is discussed elsewhere on the net)

Tried this one first, did not notice "SPI" (he he he.... duh!). Of course did not work. But keeping it here for reference. (Hmmm this part is giving weird formatting problem in blogger.com. Oh I know.. the "less than" symbol is mesing things up.. OK fixed.)

Monday 9 July 2018

Revisiting a small OLED that I have lying around for quite some time.

This morning I hooked up a small OLED display module that I found again -- was looking for it a couple of weeks back -- just to refresh my memory how it works.

Well, it did not work ... hahaha.

I don't know what is wrong with it. Thinking of getting a new one. I like that display because it uses I2C inteface. So, saves on many many pins on the Arduino.

Some URLs that will be useful (for me, at least) when setting up this OLED...








Friday 15 December 2017

Serial terminal basics

https://learn.sparkfun.com/tutorials/terminal-basics/command-line-windows-mac-linux

Friday 19 February 2016

Program "Maze Generator"

Rajah 1: Maze Generator, Compute! December 1981
Lagi sekali, kita selongkar majalah Compute! di www.archive.org. Kali ini kita lihat isu 19, Disember 1981.  Ada suatu artikel di mukasurat 54 serta program yang menarik perhatian saya iaitu "Maze Generator".

Ianya ialah mengenai suatu algotrima pendek yang mampu menghasilkan sebuah maze secara rawak. Perinciannya meliputi komputer Commodore Pet (Microsoft BASIC) dan Atari 400/800. Contoh maze yang terhasil adalah seperti dalam Rajah 2.

Rajah 2: Contoh Maze
Rajah 3: Carta Alir "Maze Generator"
Algoritmanya adalah seperti dalam Rajah 3. Asasnya, maze dibina di dalam sebuah medan yang dinamakan "Background field" (BF). Ia terdiri daripada baris-baris (Y) yang jumlahnya ganjil. Setiap baris pula terbina dengan sel-sel (X) yang juga jumlahnya ganjil. Ianya membentuk jajaran (array) 2 dimensi X*Y; dengan koordinat (X,Y) = (0,0) terletak di penjuru atas-kanan.

"Maze Generator"

Pembinaan maze dimulakan dengan meletak penanda khas di sel (1,1). Kemudian nombor rawak 0 - 3 dipilih untuk menentukan arah pergerakan ke sel baharu (B). Sel baharu ini terletak selang satu sel daripada sel asal (A). Sel (penghadang) yang berada di antara dua sel tadi -- (A) dan (B) -- dipadam. Sekarang sel (B) menjadi sel (A); dan proses tadi diulang untuk mencari sel (b) yang baru; sehingga ketemu "jalan buntu".

Jika kebuntuan terjadi kurang daripada lima langkah, laluan yang telah terlakar akan diunduri sehingga bertemu dengan sel yang belum dipadam. Dari situ laluan baru akan dilakarkan dengan mengulangi lagi langkah-langkah tersebut di atas.

Program versi Microsoft BASIC

Berikut ialah program yang ditulis dengen Microsoft BASIC untuk Commodore Pet:




Wednesday 10 February 2016

Pentomino versi Python

Ini adalah beberapa rakaman video (youtube) yang saya buat bagi program 'PENTOMINOS' yang saya tulis semula dalam Python. Saja untuk suka-suka. Video yang pertama ini ialah untuk puzzle bersaiz 3x20 sel.

3x20 sel

Program asal adalah seperti yang dibincangkan dalam pos bertajuk "Pentominos: A Puzzle-Solving Program | The BASIC Programs". Program asal ditulis dalam bahasa BASIC untuk mikrokomputer Commodore. Versi Python ini adalah lebih-kurang berdasarkan program BASIC yang asal.

Algoritma utamanya ialah seperti berikut:

slotno = 0
while slotno < 12:
full = get_next_empty_spot()
if full:
end
while not all_pieces_tried( slotno ):
p = get_untried_piece( slotno )
if p==-1: break
fit = try_piece( p, slotno )
if fit:
place_piece( p, nextrot, slotno )
pieceno[slotno] = p
rotation[slotno] = nextrot
slotno = slotno + 1
break
else:
tried[slotno][p] = True
if not fit:
reset_unused_pieces( slotno )
slotno = slotno - 1
if slotno<0: slotno="0</font">
undraw_piece( slotno )

Berikut ini adalah rakaman-rakaman video untuk puzzle bersaiz 4x15, 5x12 dan 6x10.


4x15 sel


5x12 sel


6x10 sel