/* jquery */ /* jquery accordion style*/ /* jquery init */

New Micro:bit Version 2 - Out Now

The new Micro:bit version 2 is now on sale.

While this Version 2 board is backwardly compatible with the previous Micro:bit board there are many new features and capabilities to help us create a wider range of software and hardware projects.

Here's a list of the Version 2 changes and additions:
• 4x Faster 64MHz Arm Cortex-M4 + FPU processor
• Larger 512KB Flash storage on board
• Larger 128KB RAM
• On-board MEMS Microphone with LED indicator
• On-board Speaker
• Touch sensitive logo "button"
• Sleep/off mode with LED indicator (for Battery saving)
• Up to 200mA of current for external accessories
• Bluetooth 5.0 radio allowing micro:bits to talk to each other
• Notched edge connector (easier crocodile clips connection)

All this is mounted on the same sized board while retaining all the original capabilities. Plus the MicroPython language will be fully compatible with these new features.

And, amazingly, it's available for the same low low price!

The new Raspberry Pi 400

Raspberry Pi 400

As of today there's a new and simpler way to join the Pi clan with the Raspberry Pi 400.

All the elements of a Raspberry Pi 4 are neatly embedded in a Pi-branded keyboard unit, namely a quad-core 64-bit processor, 4GB of RAM, wireless networking, dual-display HDMI output with 4K video playback and that classic 40-pin GPIO port.

Even better it comes complete with an SD-Card preloaded with the latest Raspberry Pi OS, plus the official Raspberry Pi Beginner’s Guide manual.

And all this for just £67!

Try My Free Python Coding Tutorials

LEGO® and micro:bit with Brown Dog Projects

I recently came across the Brown Dog Projects website and its selection of simple-to-build, easy-to-code LEGO® themed projects using low-price microprocessor boards like the popular micro:bit.

You can also buy a number of kits, including a micro:bit board kit.
This kit has a Crazy Circuits Bit Board to simplify LEGO® brick and micro:bit board connectivity, plus many other items including a USB Cable, Battery Holder, Small Pushbuttons, LEDs, Potentiometer, Piezo Speaker, LEGO® Compatible Servo and a few LEGO® pieces.

The video below captures some of the potential of this kit.

The Brown Dog Projects website also has a collection of step-by-step project guides

Read More LEGO® Posts

Anton's LEGO® Construction Projects

The web contains many sources of information on LEGO® programmable hub/brick technologies and the associated construction kits. One of these is from a guy called Anton.

Anton has a blog containing How-To tutorials which explain the steps required construct and program LEGO® robot projects, like the ones show in his videos.

For example, Anton has a Bluetooth wireless remote control of the EV3 hub/brick post which involves LEGO® SPIKE Prime, the MicroPython language and the PyBricks module.

Anton also has a large collection of inspirational LEGO® project videos going back over 10 years and covering various products including LEGO® NXT, LEGO® Technic, LEGO® Mindstorms and LEGO® SPIKE.

LEGO® and Python and PyBricks

Over the 20 years LEGO® have created a number of intelligent programmable hub/brick technologies for LEGO® MINDSTORMS, LEGO® TECHNIC, LEGO® CITY, LEGO® BOOST and most recently LEGO® SPIKE.

However, the ability to use the Python programming language for coding LEGO® hub/bricks is a more recent innovation. One of the Python coding options is a module called PyBricks.

PyBricks has a number of advantages:
• It is Open Source with source code on GitHub
• It is based on the popular MicroPython language
• You can run your code directly on the hub/brick
• There's an app to write MicroPython scripts
• You can send scipts to the hub/brick via Bluetooth
• It offers precise motor control
• It is compatible with all official sensors and motors

PyBricks version 2.0 was a little limited in hub/brick support. But now, with PyBricks 3.0 Beta, there's support many more LEGO® platforms, including LEGO® BOOST, LEGO® TECHNIC Control+ and LEGO® City Trains.

LEGO® SPIKE™ and MicroPython

LEGO® SPIKE™ is an education-level product from the LEGO® intelligent programmable hub/brick family.

LEGO® SPIKE™ simplifies the connection of motors and sensors - such as touch, distance-ultrasonic, and color/light - and provides a programming interface via the popular Scratch coding language.

LEGO® SPIKE™ brick/hub has six ports, a speaker, a 5x5 light matrix, a 6-axis gyroscope, Bluetooth wireless communication and a rechargeable battery.
The LEGO® SPIKE™ Prime kit adds motors, sensors and 525 technic-style bricks to create a rapid robotics development environment.

Interestingly, internally this intelligent brick/hub runs MicroPython. And, you can open a connection to a REPL session and enter commands to control the SPIKE™ brick/hub - as shown on the instructables website.

And now, with version the Education SPIKE™ 1.3 app update, LEGO® officially provide full language support for the Python Knowledge Base coding, as shown by the message below taken from a LEGO® SPIKE™ webpage.

LEGO® Education SPIKE™ Prime lets your students dip their toes into text-based coding with a beginner-friendly Python experience. Python is a coding language widely used in robotics and it lays a strong foundation for tackling more advanced topics like algorithms, data structures, machine learning, and artificial intelligence.

Python Math - SageMath

Python Coding

SageMath is a free open-source mathematics software system licensed under the GPL. Released in January 2020, SageMath 9.0 now runs on top of Python 3.0 programming langauge.

SageMath builds on top of many existing open-source packages, such as NumPy, SciPy, matplotlib, Sympy and many others. This powerful functionality is accessed through either a Python-based language or more directly using interfaces and wrappers.

By combining a math-like syntax with Python's coding capabilities SageMath can handle a large and diverse range of mathematical problems, including:

• Functions
• Basic Algebra
• Linear Algebra
• Calculus
• Polynomials
• Finite Groups
• Number Theory
• Plotting

More Python Math Coding

Python Math - Function Plotting

Python Coding

Python benefits from an impressive set of graphing packages. However, many of the most popular ones tend to be focussed on the data visualisation side of things rather than mathematics.

When it comes to plotting math functions consider an exploraion of the functionality provided by the matplotlib package. This mature package works runs on a wide range of operating systems and has some math-centric advantages.

For instance, matplotlib includes the pyplot interface, namely matplotlib.pyplot, which is a collection of functions that make matplotlib work like MATLAB.

It also plays nicely with other math packages, including NumPy. The code below uses both matplotlib.pyplot and numpy to plot sine and cos curves:

import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 10, 100)

plt.plot(x, np.sin(x))
plt.plot(x, np.cos(x))

Adding graph axis labels and a title is also sraightforward with pyplot, as shown below:

plt.xlabel('x values')
plt.ylabel('sin(x) and cos(x)')
plt.title('Plot of sin and cos')
plt.legend(['sin(x)', 'cos(x)'])
plt.show()

Importantly matplotlib has extensive collection of tutorial documentation pages covering the pyplot interface in addition to many other math-aligned applications, all with fully explained code examples.

In addition to the official documention a quick search of the web will unveil a plethora of matplotlib plotting code examples and links to diverse selection of real-world applications.

More Python Math Coding

Python Math - Complex Numbers

Python Coding

Imaginary Numbers and Complex Numbers are vital to solving many mathematical problems - including the study of waves, electric motor efficency and fractals.

Python uses the j symbol to represent the imaginary part of a Complex Numbers.

An example of how this is done is shown in the Python Interactive Mode session below...

>>> a = 4 + 3j
>>> print(a)
(4+3j)

Once created a Complex Number can be treated much like any other number, as below...

>>> a = 1 + 2j
>>> b = 2 + 4j
>>> print('Addition =', a + b)
Addition = (3+6j)
>>> print('Subtraction =', a - b)
Subtraction = (-1-2j)
>>> print('Multiplication =', a * b)
Multiplication = (-6+8j)
>>> print('Division =', a / b)
Division = (2+0j)

And you can extract a Complex Number's real and imaginary components as below...

>>> a = 1 + 2j
>>> b = 3 + 5j
>>> c = a + b
>>> c.real
4.0
>>> c.imag
7.0

More Python Math Coding

Python Math - math module

Python Coding

The Python language math module has a good collection of functionallity. Here are a few highlights to help with solving common math problems.

Constants

There are a number of useful constants in the math module:

#Import math module
import math

math.e
math.pi
math.tau

Factorials

There is a useful factorial() function:

#Import math module
import math

num = input("Enter a number: ")
fac = math.factorial(int(num));
print("Factorial of ", num, " is ", fac)

GCD (Greatest Common Divisor)

This module also has a gcd() function:

#Import math module
import math

print(math.gcd(54, 24))

And there's far more to explore including Logarithmic Functions, Trigonometric Functions, Angular Conversion and Hyperbolic Functions.

For a full list of functionality see the Python3 math module documenation page.

More Python Math Coding

Game of Life in Python Turtle Graphics

In the September 2020 issue of the Linux Format magazine (LXF) you'll find a Calvin Robinson article on how to code the classic Game of Life simulation, as invented by mathematician John Horton Conway.

The source code examples for this article are in the Python language and use its Turtle Graphics capabilties.

Creating a Turtle Graphics program is fun. But if you'd prefer a more efficient Game of Life then consider recoding the simulation to use the PyGame or PyGame Zero modules - as described in the YouTube coding tutorial video below.

Back issues of the Linux Format magazine are available from the LXF Archive webpage.
And you can download article source code listings from the LXF website.

Try My Free Python Coding Tutorials

Self-Replicating Python Code - Quines and Introns

Python Coding

Lex Fridman is well known for his in-depth AI-focussed interviews with some of the key people in artificial intelligence machine learning, software development and technology in general.

In a recent YouTube video post Lex explains how to write self-replicating Python code in the form of Quines and Introns.

Try My Free Python Coding Tutorials

Mars Rover for Micro:bit or Raspberry Pi Zero

JavaFX on Raspberry Pi

With all the excitement of the NASA Mars 2020 Mission launch on 30th July, maybe you fancy building your own Mars Rover vehicle.

Then take a look at the 4tronix MARS Rover Robot Kit.

The self-assembly kit is loosely based on the NASA/JPL Curiosity and Mars 2020 rover designand uses a similar rocker arm, bogey and differential arm mechanism.

It can be controlled with either a Micro:bit or Raspberry Pi Zero and comes complete with coding support for both these boards.

MARS Rover Robot Kit features include:
• 6 Motors - 80 rpm 6V, N20 micro gear motors
• 4 Servos - MG90S metal gear analog micro servos
• 4 Fire LEDS
• Ultrasonic distance sensor on steerable mast
• 30 special PCBs
• 11 different PCB designs

JavaFX Coding on Raspberry Pi

JavaFX on Raspberry Pi

In the July Java Magazine there's a tutorial-style article on JavaFX programming with the Raspberry Pi.

In this tutorial Frank Delporte explores a maker-style project and explains everything from first principles including Java installation, multiple code listings, GPIO introduction, the electronic components inventory list, circuit diagrams and much more.

If this article make you hungry for more Raspberry Pi Java and JavaFX coding material then check out Frank's book 'Getting Started with Java on the Raspberry Pi', which is available in both paper or ebook formats.

Adafruit's PyPortal for Raspberry Pi

Adafruit PyPortal

In the recent Linux Magazine there's an article about the PyPortal from Adafruit

While relatively expensive this product is a very flexible enhancement to your Raspberry Pi, with a touch-screen plus it's own microprocessor, sound output and WiFi connection.

The product's potential can be glimpsed with a quick web search, which will uncover plenty of powerful maker-style projects.

Discover the Raspberry Pi

 

Linux Format Python Game Coding

Interested in how to code Classic Games in the Python language?

Then check out Calvin Robinson's series of articles in the Linux Format magazine (LXF).

The series so far includes:
• Issue 262: a Lunar Lander game
• Issue 263: a Platform-style game
• Issue 264: a 2D Top Down Perspective Shooter game
• Issue 265: a Space Invader game

Back issues of the Linux Format magazine are available from the LXF Archive webpage and you can also download source code listings for all coding articles.

Try My Free Python Coding Tutorials

Raspberry Pi DOS Emulation

In the recent MagPi magazine issue 95 there is an article on creating a DOS emulation on the Raspberry Pi.

Using a newer and more powerful DOSBox emulator called DOSBox-X, plus a 4GB or 8GB Raspberry Pi 4, you can run a number of DOS-based Microsoft Windows operating systems - including Windows 3.x, Windows 95, Windows 98 and Windows ME - plus all the software and games written for DOS or these versions of Windows.

Additionally DOSBox-X has an advanced graphical interface to help with machine configuration and virtual disk-swapping.

Inspirational Java Applications

Are you interested in taking your Java coding skills to a higher level?

Are you wondering what can be achieved using the Java language?

An recent article in the Free Java magazine lists 25 of the most significant Java projects over the last few decades.

Here's a little taste of some of these projects:

• The Maestro Mars Rover Controller
• Java Mission-planning and Analysis for Remote Sensing (JMARS)
• Wikipedia Search has a Java coded search engine
• Minecraft, the classic blocks-building game
• The Integrated Genome Browser visualisation tool
• VisibleTesla enables owners to monitor and control aspects of the Tesla Model S

8GB Raspberry Pi Model 4B and RPI OS

Raspberry Pi

After almost 3 million sales the Raspberry Pi 4B now comes in an 8GB version, which is available to purchase for $75.

It was already known that the RPi 4B's BCM2711 chip could address up to 16GB of LPDDR4 SDRAM. But only now does a new Micron-designed component enable the 8GB version to be manufactured.

To complement the 8GB RPI 4B there's a new beta-level 64-bit ARM version of the Raspberry Pi operating system to utilise all those extra gigabytes.

New OS features include:

• Bookshelf app to access Raspberry Pi Press magazines, including The MagPi, HackSpace and Wireframe (found in the Help menu). Any magazine PDF downloads are saved in the “Bookshelf” sub-directory of your home directory.

• Magnifier app to improve is accessibility to the Desktop for people with visual impairments. Once installed a magnifying glass icon appears at the right-hand end of the taskbar. To use click this icon (or use the Ctrl-Alt-M shortcut) and then play with the zoom and static-window/follow-cursor options.

• User research allows anyone to send back feedback how you use your Raspberry Pi. It is in the form of a questionnaire, which appears the first time the Chromium browser is launched. There are just four questions and the associated unique id string doesn't compromise your animininity.

Try My Free Python Coding Tutorials

Java 11 Coding on the Raspberry Pi

Java on Raspberry Pi

In the latest MagPi magazine issue #93 there's an article by Frank Delporte on the Java programming language.

The topic is Get Started with Java and Electronics and it's a great introduction to beginning to use the Java OpenJDK 11 - as included with the Raspberry Pi Raspbian operating system.

The article's code examples start with a 'Hello World' class, then move on to interfacing with the Raspberry Pi GPIO pins for developing electronics projects.

For the best Java coding experience you'll ideally need a Raspberry Pi 4 with as much memory as possible - 4GB would be best.

More LEGO® Boost Python Coding

As my original LEGO® Boost kit and Python coding post has received quite a number of page views I thought I'd post some additional information on this topic.

Andrey Pokhilko

I recently came across Andrey Pokhilko and his YouTube video (below). In this video he talks about his own LEGO® Boost Robotics construction and coding project, along with a demonstration of Vernie's capabilities plus a custom power pack hack.

To view Andrey's Python code examples navigate over to his GitHub resources page.

Mikhail Zakharov

I also noticed Mikhail Zakharov has added Python coded Voice Command Control to his own LEGO® Boost Vernie project.

Mikhail's Python source code can be found on his GitLib resources page.

Try My Free Python Coding Tutorials

PyCon 2020 - Online Content

With the current global lockdown events like PyCon US 2020 have been cancelled.

However, you can still access plenty of Python technology news and information for free by subscribing to PyCon online./p>

Options include receiving email notifications and watching the PyCon 2020 YouTube Channel.

Content includes:
• Recorded talks and tutorials
• Online Summit and Hatchery programs
• Poster presenters sharing their creations
• Startup Row company presentations
• Sponsor workshop videos and job postings

Try My Free Python Coding Tutorials

Java 14 Insights

A recent issue of Oracle's monthly Java Magazine highlights the latest edition of the Java programming language - namely version 14.

The magazine's articles highlight the essential functionality of Java 14 programming, including the new features and its Java Flight Recorder.

The Java Magazine can be read for free in HTML form. And each article is also available as a PDF download.

Read all my Java Coding posts

Raspberry Pi Official Birthday

The 29th February is the official Raspberry Pi birthday - something that only happens every four years.

Will we see a new Pi model released? Or maybe some other Raspberry Pi related hardware? Keep a watch on the Raspberry Pi blog to find out.

Try My Free Python Coding Tutorials

Free Raspberry Pi GUI Coding Course

Do you want to learn how to build your own Graphical User Interface (GUI) with GuiZero?

Well, with this free Google supported GUI course learn how to incorporate interactivity into your apps by experimenting with different types of interface widgets - such as buttons and text boxes.

Topics covered include:
• Design with boxes and auto or grid layouts
• Responding to user inputs using events
• Reading and modifying the widget properties
• Handling time-based events
• User optimisation techniques
• Splitting projects into manageable chunks

Try My Free Python Coding Tutorials