Thursday, February 21, 2019

A funny python library: pyjokes

pyjokes is a funny python library to to tell a random one line jokes for programmers.

To install pyjokes for python 3:
$ pip3 install pyjokes

To install pyjokes for python 2:
$ pip install pyjokes

In python you can get a random joke by calling pyjokes.get_joke()..
Example to try on Python 3 Shell:
>>> import pyjokes
>>> pyjokes.get_joke()


Wednesday, February 20, 2019

Check glibc version

To check the glibc version in Raspberry Pi/Raspbian, simple enter the command in Terminal:

$ ldd --version

Work on Raspberry Pi/Raspbian:

Also work on Linux Mint:

Tuesday, February 19, 2019

Install Arduino IDE on Raspberry Pi/Raspbian Stretch

This video show how to Install Arduino IDE 1.8.8 on Raspberry Pi 3 B+/Raspbian Stretch. Such that you can program Arduino board on Raspberry Pi.


Setup under test:
Board - Raspberry Pi 3 B+
OS - Raspbian Stretch with desktop and recommended software (Version:November 2018, Release date:2018-11-13)
IDE: Arduino IDE 1.8.8 (Linux ARM)
Arduino Board: Mega 2560

In order to capture the screen action, I remote control the Raspberry Pi from Windows 10 via VNC viewer.

The steps is very straightforward:

- Visit Arduino Download page, download Arduino IDE of Linux ARM.

- After download completed, extract the downloaded file.

- Run the install script:
$ sudo ./install.sh

- After finished, you can run the Arduino IDE in Raspbian desktop Menu -> Programming -> Arduino IDE.

In my case the following error reported when run install.sh:
touch: cannot touch '/root/.local/share/applications/mimeapps.list': No such file or directory
/usr/bin/xdg-mime: 803: /usr/bin/xdg-mime: cannot create /root/.local/share/applications/mimeapps.list.new: Directory nonexistent

It may be caused by mis-located of the file mimeapps.list. Actually the install.sh only add the desktop shortcut, menu item and file associations for Arduino IDE. This error should not affect the functionality. Alternatively, you can run the IDE by switch to the extracted directory, and run the arduino directly.


Add Arduino core for ESP8266 WiFi chip to Arduino IDE:

Arduino core for ESP8266 WiFi chip brings support for ESP8266 chip to the Arduino environment. It lets you write sketches using familiar Arduino functions and libraries, and run them directly on ESP8266, no external microcontroller required.

ESP8266 Arduino core comes with libraries to communicate over WiFi using TCP and UDP, set up HTTP, mDNS, SSDP, and DNS servers, do OTA updates, use a file system in flash memory, work with SD cards, servos, SPI and I2C peripherals.

Once Arduino IDE installed, you can follow the same steps in my old post to "Add Arduino core for ESP8266 to Arduino IDE (run on Raspberry Pi/Raspbian Jessie with PIXEL)".


reference:
Arduino core for ESP8266 WiFi chip project page: https://github.com/esp8266/arduino
Additional Board Manager URLs:
http://arduino.esp8266.com/stable/package_esp8266com_index.json


Arduino core for ESP32 WiFi chip is another similar project to bring support of ESP32 to Arduino IDE. It can be installed to Arduino IDE by following the same step on normal PC. But, I tried to install it to Arduino IDE on Raspberry Pi, it fail due to "Tool xtensa-esp32-elf-gcc is not available for your operating system"!


reference:
Arduino core for ESP32 WiFi chip project page: https://github.com/espressif/arduino-esp32
Additional Board Manager URLs:
https://dl.espressif.com/dl/package_esp32_index.json