Category: Blog

Byte Insight

Sense Hat

The Sense Hat from Raspberry Pi was developed as part of the Astro Pi Project.  The Sense Hat comes with its own library and a variety of hardware including: a 8×8 RGB LED matrix for output; a five-button joystick for user control; and the following sensors:

  • Gyroscope used to measure the positioning of an object
  • Accelerometer used to measure the rate of the velocity of an object
  • Magnetometer that provides an electronic compass
  • Temperature
  • Barometric pressure
  • Humidity

The purpose of this page is a quick guide to using the different aspects of the Sense Hat but for full details you should check out the API.

MySql – Insert

Inserting rows into MySql can be done in a couple of ways. You can use the INSERT…VALUES and INSERT…SET commands.

MySql

MySql is the worlds second most popular database engine (July 2013) and its open source. It is based on SQL (Sequential Query Language).  Unlike MS Access it does not run as a stand-alone application.   It runs as a background service on a computer (typically called ‘a server’) and you connect to it using a username and password.  Once you have connected to the MySql server you can query it using SQL or Structured Query Language.  The server will respond with the results of your query.

MySql – Create Database

If you need to create a database via the command line (or through the MYSQL prompt in PHPMyAdmin) then you can use the following where dynamo is the name of the database you wish to create. See W3Schools/Create DB for more information.

CREATE DATABASE dynamo;

MySQL – Create Table

The process and command for creating a table in MySql are similar to that for a database. You will need to make decisions about data types and key fields. Detailed information on creating tables is available at W3Schools/Create Table.

MySql – Relationships

Dealing with relationships in MySql is not as straightforward as either MS Access or as you would have hoped for. Creating simple primary keys isn’t too difficult

Zumo Lines

The Zumo Robot Shield can be fitted with a Reflectance Sensor Array that allows it to solve different line/maze style problems. The Zumo Shield libraries provide methods to help read values from the sensor array. Packages and installation instructions can be downloaded from GitHub and once installed the sensor library can be included from Sketch > Include Library.  The sensor array uses the QTR sensors and therefore their library must also be included (installed as standard).

TKinter Drawing

TKinter is the easiest way to get drawing in Python.

Serial

The Arduino Serial functionality can be used for both debugging and sending data to and from the device via other communication channels such as BlueTooth.

Tkinter Events

Tkinter employs a type of programming called Event-Driven which means that the program runs in a endless loop waiting for things (events) to happen.  In order for the program to respond to these events it needs to know what to listen for.