Jacob Unwin


Read this first

Line Drawing with a Delphi Canvas

This project shows how the canvas class can be used in Delphi to draw straight lines onto the screen. These lines are drawn via a drag and draw method, clicking on the canvas starts drawing the line, and releasing the button finishes drawing the line - the draw lines button must be clicked before any lines can be drawn.


Whilst drawing lines is the main feature this program is demonstrating, I have also made some other additions:

  • A snap to grid button allows horizontal and vertical lines to be drawn with ease, drawing on the canvas the nearest 10 pixel to the mouse position.

  • It is also possible so signify individual rooms by selecting the draw room button, and adding a rectangle to the screen. Clicking on this rectangle selects the room in question.

  • Finally, it is possible to undo the last 10 drawings made to the canvas object using the undo button.

View and download the code at...

Continue reading →

Multi-Servo Control Via Computer

In response to a request, I have created a program which allows for multi servo control through Processing. Connect two servo’s to pins 9 and 10 of your Arduino, as shown in my previous blog post, which has got much more information on using potentiometers. You will also need to ensure you have the Servo library for Arduino (again more is detailed in my last blog post).

To control servo’s using your computer, you will need to use Processing. This is an incredibly useful java based programming language, wich makes it really easy to communicate with the Arduino. You can find out more at processing.org .

Connecting your Arduino to a computer is as simple as plugging it in to a USB port. Then, when you load the processing file below, look in the black box at the bottom of the screen to see a list of ports available on your computer, and which one the Arduino is using, then change the...

Continue reading →

Arduino Bit Array

Sometimes even using a byte of memory takes up too much space, especially when working with simple true / false values of 1′s / 0′s. I have created a library which allows you to split a byte into 8 individual bits, based on the Arduino bitWrite and bitRead, this library allows you to create an array of 8 bits in a byte, effectively allowing you to store 8 boolean variables in the space that just one previously occupied – a massive saving in memory space. This allows you to store much more data in the Arduino’s RAM, this could possibly be used for mapping applications etc.

#include "bitArray.h" //Here we include the library in our code bitArray bitOne(1, 0, 1, 1, 1, 0, 1, 0); //Here we create a new bit array bitArray bitTwo; //here we create a bit array without setting any bits void setup(){ Serial.begin(9600); //We start the Serial Serial.print("bitArray one: ");...

Continue reading →

Arduino Live Debugger

The ability to pause an Arduino sketch is something I feel the platform has been missing. Because of this I have written a simple library, which allows you to place pauses in the sketch for debugging purposes. Once you have uploaded your sketch, it will run until it hits a pause, alerting you and suppling info. You can then type ‘y’ into the Serial feed to continue until you reach the next pause.

Find it on Github.

Continue reading →

Making a 7-Segment Display Countdown Clock

In this article I will show you how to control a basic seven segment display from an Arduino. I will then show you how it can be made into a simple countdown timer.

The seven segment display I use in this post is from spark fun. It is an anode display, meaning that it draws its power through two pins. To make individual segments light up, you turn off the power to the corresponding pin, lowering the resistance and allowing that segment to make a complete circuit. This is useful if you have a large number of displays, as it means that the Arduino does not have to power the display. If you have a common cathode display, just reverse all of the code i.e. where it saiys digitalWrite(A, HIGH); make it digitalWrite(A, LOW) and so on.


Now its time to wire up the display, connect the power pin to the 3.3v plug on your Arduino, remembering to place a 330ohm resistor between the power supply...

Continue reading →

Servo Control via Potentiometer (using Arduino)

This tutorial explains how to directly interface with a servo via a potentiometer, using an Arduino. It ensures that the input and output are calibrated correctly, so that the servo and potentiometer remain in sync, and allows you to view readings through a serial viewer. When writing this code, I used extracts from the calibrate example in the Arduino library, and code from the Michal Rinott tutorial on the arduino.cc site.

In case you didn’t know, a potentiometer is a variable resistor, which can be used to adjust a power output according to how far open / closed it is. With the Arduino you can read this change as an analog input, allowing for high control over inputs. I used a potentiometer from spark fun. It is actually called a Trimpot, but this is basically just a really small potentiometer. You could use a bigger one if you prefer. On the potentiometer you should have three...

Continue reading →

Subscribe to Jacob Unwin

Don’t worry; we hate spam with a passion.
You can unsubscribe with one click.