Programming the Raspberry Pi: Getting Started with Python (Third Edition) Simon Monk pdf download
Programming the Raspberry Pi: Getting Started with Python (Third Edition) Simon Monk pdf download
https://ebookmeta.com/product/programming-the-raspberry-pi-
getting-started-with-python-third-edition-simon-monk/
https://ebookmeta.com/product/programming-arduino-getting-
started-with-sketches-third-edition-simon-monk/
https://ebookmeta.com/product/raspberry-pi-cookbook-4th-edition-
second-early-release-simon-monk/
https://ebookmeta.com/product/learn-raspberry-pi-programming-
with-python-1st-edition-wolfram-donat/
https://ebookmeta.com/product/graphs-orders-infinites-and-
philosophy-1st-edition-daniel-parrochia/
EcoGothic Gardens in the Long Nineteenth Century
Phantoms Fantasy and Uncanny Flowers 1st Edition Sue
Edney
https://ebookmeta.com/product/ecogothic-gardens-in-the-long-
nineteenth-century-phantoms-fantasy-and-uncanny-flowers-1st-
edition-sue-edney/
https://ebookmeta.com/product/seaside-knitters-
society-14-0-a-murderous-tangle-sally-goldenbaum/
https://ebookmeta.com/product/cambridge-ielts-16-academic-1st-
edition-cambridge-esol/
https://ebookmeta.com/product/beginners-guide-to-streamlit-with-
python-build-web-based-data-and-machine-learning-
applications-1st-edition-sujay-raghavendra/
https://ebookmeta.com/product/pack-origin-the-blissful-
omegaverse-1-1st-edition-kate-king-jessa-wilder/
I Die by This Country 2nd Edition Zouari
https://ebookmeta.com/product/i-die-by-this-country-2nd-edition-
zouari/
About the Author
Dr. Simon Monk has a bachelor’s degree in cybernetics and computer
science and a Ph.D. in software engineering. He is now a full-time writer and
has authored numerous books, including Programming Arduino, 30 Arduino
Projects for the Evil Genius, Hacking Electronics, and Raspberry Pi
Cookbook. Dr. Monk also designs products for MonkMakes.com. You can
follow him on Twitter, where he is @simonmonk2.
Copyright © 2021, 2016, 2013 by McGraw Hill. All rights reserved. Except
as permitted under the United States Copyright Act of 1976, no part of this
publication may be reproduced or distributed in any form or by any means, or
stored in a database or retrieval system, without the prior written permission
of the publisher, with the exception that the program listings may be entered,
stored, and executed in a computer system, but they may not be reproduced
for publication.
ISBN: 978-1-26-425736-2
MHID: 1-26-425736-8
The material in this eBook also appears in the print version of this title:
ISBN: 978-1-26-425735-5, MHID: 1-26-425735-X.
All trademarks are trademarks of their respective owners. Rather than put a
trademark symbol after every occurrence of a trademarked name, we use
names in an editorial fashion only, and to the benefit of the trademark owner,
with no intention of infringement of the trademark. Where such designations
appear in this book, they have been printed with initial caps.
TERMS OF USE
This is a copyrighted work and McGraw-Hill Education and its licensors
reserve all rights in and to the work. Use of this work is subject to these
terms. Except as permitted under the Copyright Act of 1976 and the right to
store and retrieve one copy of the work, you may not decompile, disassemble,
reverse engineer, reproduce, modify, create derivative works based upon,
transmit, distribute, disseminate, sell, publish or sublicense the work or any
part of it without McGraw-Hill Education’s prior consent. You may use the
work for your own noncommercial and personal use; any other use of the
work is strictly prohibited. Your right to use the work may be terminated if
you fail to comply with these terms.
2 Getting Started
3 Python Basics
8 Games Programming
9 Interfacing Hardware
12 Raspberry Pi Robot
13 What Next
Index
CONTENTS
Preface
Acknowledgments
Introduction
1 Introduction
What Is the Raspberry Pi?
What Can You Do with a Raspberry Pi?
A Tour of the Raspberry Pi
Setting Up Your Raspberry Pi
Buying What You Need
Connecting Everything Together
Booting Up
Summary
2 Getting Started
Linux
The Desktop
The Command Line
Navigating with the Terminal
sudo
Applications
Internet Resources
Summary
3 Python Basics
Mu
Python Versions
Python Shell
Editor
Numbers
Variables
For Loops
Simulating Dice
If
Comparisons
Being Logical
Else
While
The Python Shell from the Terminal
Summary
8 Games Programming
What Is Pygame?
Coordinates
Hello Pygame
A Raspberry Game
Following the Mouse
One Raspberry
Catch Detection and Scoring
Timing
Lots of Raspberries
Summary
9 Interfacing Hardware
GPIO Pin Connections
Pin Functions
Serial Interface Pins
Power Pins
Hat Pins
Breadboarding with Jumper Wires
Digital Outputs
Step 1. Put the Resistor on the Breadboard
Step 2. Put the LED on the Breadboard
Step 3. Connect the Breadboard to the GPIO Pins
Analog Outputs
Digital Inputs
Analog Inputs
Hardware
The Software
HATs
Summary
12 Raspberry Pi Robot
Set Up the Raspberry Pi Zero W
Web-Controlled Rover
What You Need
Hardware
Software
Autonomous Rover
What You Need
Hardware
Software
Summary
13 What Next
Linux Resources
Python Resources
Raspberry Pi Resources
Programming Languages
Scratch
C
Other Languages
Applications and Projects
Media Center (Kodi)
Home Automation
Summary
Index
PREFACE
The Raspberry Pi™ is rapidly becoming a worldwide phenomenon. People
are waking up to the possibility of a $35 (U.S.) computer that can be put to
use in all sorts of settings—from a desktop workstation to a media center to a
controller for a home automation system.
This book explains in simple terms, to both nonprogrammers and
programmers new to the Raspberry Pi, how to start writing programs for the
Pi in the popular Python programming language. It then goes on to give you
the basics of creating graphical user interfaces and simple games using the
pygame module.
The software in the book uses Python 3, and the Mu editor. The Raspberry
Pi OS distribution recommended by the Raspberry Pi Foundation is used
throughout the book.
The book starts with an introduction to the Raspberry Pi and covers the
topics of buying the necessary accessories and setting everything up. You
then get an introduction to programming while you gradually work your way
through the next few chapters. Concepts are illustrated with sample
applications that will get you started programming your Raspberry Pi.
Four chapters are devoted to programming and using the Raspberry Pi’s
GPIO connector, which allows the device to be attached to external
electronics. These chapters include three sample projects—a LED lighting
controller, a LED clock, and a Raspberry Pi–controlled robot, complete with
ultrasonic rangefinder.
Here are the key topics covered in the book:
All the code listings in the book are available for download from the
book’s repository on Github at https://github.com/simonmonk/prog_pi_ed3,
where you can also find other useful material relating to the book, including
errata.
Simon Monk
Exploring the Variety of Random
Documents with Different Content
carved on a stone mantel. In 1637 the property was sold to
Christopher Norres, woollen-draper, of Bolton, who was succeeded
by his son, Alexander, a partisan of King Charles in the Civil War.
Norres escaped lightly from the victorious Parliament, with a fine of
£15 and the taking of the Covenant and other oaths; and then
settled down here, building the stone wing that bears the date 1648.
With him, however, ended the Norres reign, for his daughter Alice
married a John Starkie, whose descendants resided here until near
the middle of the eighteenth century. Their punning heraldic
cognisance, six storks for Starkie, may still be seen, done in plaster.
HALL-I’-TH’-WOOD.
It was a neglected and dilapidated old house to
SAMUEL CROMPTON
which the Cromptons came in 1758. For
economical reasons—the window-tax then prevailed—all the
unnecessary windows, and some that really were necessary, had
been bricked up, rain came through the roof, and rats ran unchecked
from room to room. There, in a house a world too large for them,
the widowed Mrs. Crompton and her little lad lived upon the
proceeds of a small farm and the insignificant gains she made from
spinning yarn, by hand, as all yarn then was spun. Samuel helped in
the spinning, much, it may be supposed, against his will; and in the
drudgery of it his inventive powers were wakened, in the direction of
labour-saving. Hargreaves’ spinning-jenny of 1768 and Arkwright’s
invention were new when he began to plan, and his machine took
the form of an improvement combining the principles of both. He
was twenty-one years of age before he began the work, and not
until five years were gone had he completed it. The times were not
propitious for inventors, bands of infuriated weavers roaming the
districts round about, destroying everywhere the spinning-jennies
that they imagined were depriving them of work; and Crompton was
obliged constantly to take his model to pieces and hide it in the
garret roofs of his wind-swept, rat-haunted home. But at length the
weavers’ fury spent itself, and then he could experiment without fear
of house and model being wrecked. Then, however, arose a newer
danger. Crompton, it became gradually known, had a wonderful new
machine in the old place, and many were those who sought in some
way to surprise the secret of it, among them the crafty Arkwright,
inventor and man of business too: an unusual combination of talents
that Crompton, unfortunately for himself, did not possess. In the
result, the secret was given away for a miserable pittance, and not
even patented. Factories were equipped with his invention, and
manufacturers combined to subscribe, as an act of grace, a hundred
guineas that should, multiplied a thousandfold, have been his by
right. In 1812, Crompton found that the number of spindles worked
on his principle totalled five millions. In that year a reward seemed
almost within his grasp, for a vote of £20,000, in recognition of his
services was proposed, and was to have been submitted to
Parliament by Spencer Perceval, the Prime Minister; but that very
day, in the act of carrying a memorandum to that effect in his hand,
Perceval was assassinated by Bellingham in the lobby of the House
of Commons, and the proposal was not renewed. But by the
intervention of some friends a memorial to Parliament was prepared,
which was signed by the principal manufacturers of the kingdom,
with the result that the sum of £5,000 was granted to him. Let us
here observe the exquisite humour of the thing. The “principal
manufacturers” had become such, and had amassed great wealth by
aid of Crompton’s mule, but they meanly went to Government, and
thus taxed the whole nation for a sum themselves should have
raised.
With this sum Crompton established his sons in the bleaching
business; but the establishment failed, and the inventor was again in
straitened circumstances. A second subscription was raised, and a
life annuity purchased for Crompton, producing about £63 per
annum. He enjoyed it only two years, for he died in 1827, aged
seventy-three, and was buried in Bolton parish churchyard.
The last stroke of cynic fortune was not dealt until 1862, when the
hapless inventor had been thirty-five years in his grave. Then the
town of Bolton, whose manufacturers had, living, denied him a
livelihood, set up a statue to the man who had made their town, and
twenty other towns, great and prosperous. Among those present at
the unveiling, and shrinking in his poverty from the robed and finely
apparelled magnates, was Crompton’s surviving son, then aged
seventy-two, and in the poorest circumstances. Palmerston
eventually sent him a dole from the Royal Bounty Fund.
If the spirits of the departed can know what
RELICS OF CROMPTON
goes forward in the world they have left, there
must be bitter ironic laughter in the Beyond. Plundered and
neglected in life, Crompton is tardily honoured in death. The
darkling, mouldering old Hall has, through the munificence of Mr. W.
H. Lever, been purchased from the representatives of the Starkie
family, finely restored, stored with personal relics of Crompton, and
presented, as a lasting memorial, to the town of Bolton. It is open,
freely, every day. There you see Crompton’s old violin, his Bible, and
chair, and a model of his Spinning Mule. But there is much else
besides. Old portraits and old prints decorate the panelled walls, and
ancient furniture fills the room. Panelling has been brought from an
ancient house at Hare Street, near Buntingford, and a finely
moulded plaster ceiling copied from the “Old Woolpack” inn,
Deansgate, Bolton, pulled down in 1880. From the stone-flagged
terrace of the garden you look across to Bolton itself and the
clustered chimneys whose murk affronts the sky.
XII
There are two ways out of Bolton, to Chorley and Preston; known
severally as the Chorley Old and New Roads. The old road ascends
windy heights, and although still a practicable highway, is of such a
character that any traveller—not being a professional explorer of old
roads—who finds himself on it, and perceives the new road going
flat, below, is deeply sorry for himself. The way into this old road is
by the group of houses called Dorfcocker—where the “Tempest
Arms” displays the Tempest cognisance and their motto, “Loywf as
thow Fynds”—and along Boot Lane. Thence comes a steep steady
ascent past the “Bob’s Smithy” inn and the cottages of Scant Row—
well-named in its meagre, hungry look—to the “Horwich Moorgate”
inn with the subsidiary title of the “Blundell Arms.” Did any authority
compensate these unfortunate inns when the traffic was diverted
into the “New” road? Let us hope so, for the doing of it deprived
them—not of a livelihood, else how could they have continued to
live?—but certainly of all save the merest means of existence. There
remains yet a look about the “Moorgate” inn which tells you that not
always did it rub meanly along on selling beer to rustics or mill-
hands. Alas!
Henceforward, having reached the summit, and
THE RESERVOIRS
not wishing to remain on this wind-swept height, it
is necessary to descend: that is obvious enough. But not easily is
that descent made. To Avernus the transition is reputed to be easy
and comfortable: to Horwich, where the old and new roads join, it is
martyrdom, especially if it be undertaken on a cycle. And so
descending, cautiously and with alternate prayers and curses, over
the agonising pits and gullies in the neglected setts of the Chorley
Old Road, to the only less fearful surface of the Chorley New Road at
Horwich, we come at the two hundredth mile from London to the
great lake-like reservoirs of the Liverpool Waterworks, formed in
1848, stretching for a long way alongside the road, and occupying
the site of Anglezarke Moor. To a height of 1,545 feet rises the sullen
mass of Rivington Pike, in the background, crowned with its masonry
beacon. There are at least two dozen other reservoirs of different
sizes up there, in the vast gloomy moors where the Pike presides:
reservoirs in solitudes looking down upon the circle of busy towns
comprising Bolton, Bury, Wigan, Blackburn, and Preston, and
supplying their needs.
RIVINGTON PIKE.
The great reservoirs beside the road, fenced from it by an ugly
dwarf wall and iron railing, are full of fish, and in most respects like
natural lakes; but the scenery, bold though it be, is scrubby and
hard-featured, and the scant trees look to those used to the softer
and more luxuriant vegetation of the south, starved. But if one has
courage sufficient to follow the waggonette-loads of beanfeasters
from Bolton, who favour these scenes, there will be found a quite
charming wooded glen and waterfall at Dean, beyond Rivington
village.
RIVINGTON PIKE FROM THE ROAD.
That, however, is by no means the way to
MILES STANDISH
Chorley; but rather a side dish: albeit a good deal
more appetising than the main road itself. Chorley was in Leland’s
time, the matter of four hundred years ago, down in doleful dumps.
“Chorle,” he notes, painstaking traveller that he was, “wonderful
poor, having no market.” This is where your modern Chorleian smiles
the smile of conscious worth, for the place is the antithesis of what it
was then and is wonderfully rich and populous. At the same time, I
do not find anything at all to say about it, except that continual tale
of cotton-mills, supplemented here by calico-printing. There is an
ancient parish church, with relics of St. Lawrence, its patron saint,
brought from Normandy in 1442 by Sir Rowland Standish, and
enclosed doubly behind glass and an iron grille; and with the
elaborate canopied pew of the Standish family of Duxbury Park, near
by. The Standishes number among their ancestors such diverse
characters as that loyal squire, John Standish, who helped to
dispatch Wat Tyler; and the much more famous Miles Standish, “a
blunt old sea-captain, a man not of words, but of actions,” who, born
in 1584, sailed with the Pilgrim Fathers to America in the Mayflower,
in 1620. The Chorley parish register of baptisms in 1584, in which
his name should occur, is defaced, lending some support to the
theory that his claim to be the rightful heir to the Duxbury estate
was feared by his contemporary relatives, who are in this manner
suspected of seeking to invalidate it. Whatever his prospects of
success, he relinquished them in sailing for New England, where he
became the best-known of those early colonists, and has found
apotheosis in Longfellow’s Courtship of Miles Standish. The poet
represents him as the elderly widowed Governor of Plymouth, in love
with Priscilla, and, at once too shy and too busy to do his own love-
making, despatching his youthful secretary, John Alden—himself in
love with Priscilla—to woo her, “the loveliest maiden in Plymouth,” by
proxy. Poor John went on his mission, as he was bid, and loyally
fulfilled it. But without avail. Miles, in John’s arguments, appeared to
every advantage. He was a great man, the greatest in the colony,
and heir to vast estates; a gentleman, like all the Standishes, with a
silver cock, red-combed and wattled, for arms, and all the rest of it.
But these great gifts were nothing to Priscilla, who no more than any
other girl could endure love-making by deputy, and, seeing the true
condition of affairs, asked, “Why don’t you speak for yourself, John?”
A monument, 120 feet in height, stands on Captain’s Hill, Duxbury,
to the memory of this stout but bashful sailor, and when the
elements are kindly forms a conspicuous landmark. But rain is your
portion in these latitudes, which perhaps is the reason why the
present writer, not alone in this disability, failed to find that “Sea
View” of which the sign of a wayside inn on the road from Chorley to
Preston speaks. But after all, rain or shine, that is no wonder, for
measured on the map, across the flattest of country, it is seven miles
thence to the sea.
Hard by, on the right hand, is Whittle-le-Woods—there should be
elements of humour in the name to Americans, that nation of
whittlers—celebrated (a strictly local celebrity) for its alkaline
springs, sovereign, so they say, for rheumatic affections, but more
potent, it would appear, in brewing, for “Whittle Springs Ale”—a kind
of stingo—obtrudes upon you, on sign and hoarding, all the way into
Preston.
Clayton Green is an outlying settlement of Clayton-le-Woods, one
of the several unimportant villages in the neighbourhood with that
foreign conjunction. There is nothing whatever to be said of Clayton
Green, which has a place in my memory only as the spot where, in
an inclement summer, I stood sheltering under the dripping trees at
the entrance to a park, and saw, as I shivered there in the cold wet
blast, a hundred-legged insect happily crawl into his warm, snug
crevice between the stones of the dry walling, out of the miserable
day. And the cold wind blew, the rain, fell, and the motors swashed
by in the ankle-deep slush of the muddy road, and it was yet over
five miles to the outskirts of Preston.
Proud Preston,
Poor people,
High church,
Low steeple.
But the rhyme long since went out of date. One would hesitate to
declare that Preston is in any sense poor, while certainly the
reproach of its church having a low steeple has been removed these
many years past; for the spire of St. Werburgh is a particularly fine
and lofty one, rising to a height of 303 feet. If it be necessary to find
an origin for that supposed pride of Proud Preston, I should look for
it in the fact that the town has always been the capital of the Duchy
of Lancaster, and not in the story of its ladies once considering
themselves too superior to mate with the commercial men of the
neighbourhood.
“Proud Preston” occupies a proud position, on lofty ground
overlooking the Ribble and its extensive flats. Its name, “Priest’s
Town,” derives from the site having been the property of a
Benedictine priory once situated here, but before the time of the
priory, it was named “Amounderness,” from the ridge, or ness, then,
even more than now, a striking object across the levels.
Penwortham, on the opposite side of the river, was in that early
period the chief place, for there stood the great castle of the Earls of
Chester, giving security to peaceable folk against the incursions of
the Scots; but when the county of Lancaster was made a Duchy, and
the defence centred at Lancaster, Penwortham decayed and Preston
grew populous. The unwisdom of this move across the river to a site
without strong defences was immediately made apparent, for no
sooner had Preston grown into an important town than the Scots,
under Robert Bruce, came and burnt nearly the whole of it.
Charters to the number of fifteen, ranging from
PROUD PRESTON
the time of Henry the First to that of Charles the
Second, have been conferred upon Preston; mostly in recognition of
its importance as capital of the Duchy of Lancaster; and desirable
privileges, such as the right of gaol and gibbet, tumbril and pillory,
were added, so that Preston might deal, quite independently of
Lancaster, with cases arising here, that demanded those engines of
justice.
Still, it was ever a prosperous and busy town, as the antiquity of
its guilds proves; and suffered considerable loss in the Parliamentary
war, when it was the scene of two struggles between Royalists and
Roundheads. The first was in 1643, when the townsfolk were divided
in opinion, and fighting took place in the streets: the second in 1649,
when a Royalist army, commanded by Sir Marmaduke Langdale and
the Duke of Hamilton, was driven from Clitheroe to Ribbleton Moor,
on the outskirts of the town, by Cromwell, with a numerically inferior
force.
The next taste of warlike times was in 1715, which was like to be
a very serious time for Preston; for in the Jacobite rebellion that
made this year memorable, the townsfolk figured more than a
thought too prominently as well-wishers to the cause. English rebels,
as well as Scotch, made this incursion from Scotland something new
in the moving annals of such things. In olden times the Scots had
come from the north as enemies; now the Old Pretender, “James the
Seventh of Scotland and Third of England,” was proclaimed at the
market-cross with every mark of approval, and the hospitality of the
townsfolk and the smiles of the young ladies were extended to those
who, it was thought, were presently to upset “the Elector” in
London.
This kindly reception wrought disaster to
THE REBELLION OF 1715
the rebels. They had reached Preston on
November 9th, but, instead of marching onward and fighting, idled
away the precious days in feasting and flirting: and, as it proved,
these hospitable burgesses and pretty girls formed what military
strategists might call a “containing force” really helpful to the Royal
armies hurrying up to meet the rebels, who were caught in Preston
town, as neatly as possible. The invaders had numbered two
thousand, but it is typical of the mismanagement of this ill-fated
rebellion that ever since October 6th, when the Northumbrian
Jacobites had assembled at Rothbury, their counsels had been
divided. Later, when they had joined forces with a body of Scottish
rebels, and had marched along the Borders, and so down into
Lancashire, there was little authority and no discipline. The Scots
wanted to fight in Scotland, and the English, for their part, declined
to conduct the revolt there. So, grumbling and dissatisfied, they
came south, under the leadership of Forster of Etherston, elected
“General,” but a person of no native capacity or acquired military
knowledge, and simply one of the famous, long-descended
Northumbrian Forsters; famed less on account of their merits than
that they had existed in Northumberland so long, and owned so
many of its acres.
Disheartened by the feebleness of the invasion, five hundred of
the insurgents left, and marched away home again. The remaining
fifteen hundred were reinforced at Preston by the Roman Catholic
gentry of Lancashire, their servants and tenantry, to the number of
twelve hundred, but they appear to have been an embarrassment
rather than of use.
Towards Preston, by way of Manchester and Wigan, came General
Wills, on behalf of King George. His force numbered only a thousand
men, and had the invaders been commanded by a soldier, or even
by a civilian of ordinary courage and determination, it is possible the
rebellion, of 1715 might have been successful. But Forster was a
pitiful fellow. He did not even place Preston in a proper state of
defence. It was not a walled town, and barricades were hastily run
up on Wills’s approach being made known; but no advantage was
taken of the excellent defensible position in advance of the town,
where the road ran in a hollow way, and where the bridge across the
river in itself could have been successfully held by few.
Forster, on hearing of Wills’s march, did
ESCAPE OF FORSTER
certainly a more extraordinary thing than ever
any other military commander is reported to have done on the
approach of the enemy: he went to bed! I believe we could have
respected him more had he run away. How it was that the other
leaders, the Earls of Derwentwater and Kenmure, merely roused him
from his couch, and did not take stronger measures, is a mystery.
Better, perhaps, had they done so; for although the barricaded town
repulsed the attack made by Wills on the 12th, and indeed inflicted
severe loss upon him, Forster agreed to surrender unconditionally,
and delivering Lord Derwentwater and Colonel Macintosh as
hostages, did actually deliver up the town on the 15th. Meanwhile,
the Lancashire Roman Catholics had run away, and none saw the
going of them.
Fighting at Sheriffmuir and elsewhere in Scotland followed before
the rebellion was crushed, but the surrender at Preston marked the
end of this incursion upon English soil. Fourteen hundred prisoners
were taken, many of considerable standing. Some among them
being half-pay officers, were treated as deserters, and were
summarily shot: hundreds were consigned to Chester Castle and
afterwards sold into slavery overseas; but those who had been the
moving spirits were taken to London. Among them were the
egregious Forster, Lords Derwentwater, Kenmure, Nithsdale,
Carnwath, Widdrington, Wintoun, and Nairn. They reached London
on December 9th; riding horseback from Highgate with their arms
tied behind their backs, to the sound of the drum: a mock “public
entry,” to satirise the hopes they had expressed, in a happier hour, of
a triumphal procession into London.
On the whole, the Government acted with leniency. Derwentwater
and Kenmure were executed, twenty-two rebels were hanged in
Lancashire, and four in London; but Lord Nithsdale, exchanging
clothes with his wife, fled from the Tower, and others were permitted
to escape, or were pardoned after an interval.
Forster escaped from Newgate by an ingenious ruse, only possible
in days when prisons were conducted very much like hotels. He had
inveigled Pitts, the Governor, into his room and the two sat drinking
wine there while Forster’s servant locked the head-gaoler’s attendant
in the cellar. Forster then left the room, ostensibly for a moment, but
did not return, and the Governor, alarmed, arose to find himself
locked in. Already, while he was vainly shouting and thumping upon
the thick oak door, Forster and his trusty servant had enlarged
themselves from gaol, and were making for Rochford on the Essex
coast, whence they embarked for France.
Forster took no further part in public affairs, but travelled to Italy,
and died at Rome in 1738. Had he shown generalship at Preston
equal to this of his flight, all might have gone well with the
Pretender.
The rebellion of 1745 came nearer success than this of thirty years
earlier, but we do not find Preston harbouring and encouraging the
rebels of that time, to anything like the same extent. The gaiety of
Preston was not, this time, for them. But what, after all, did that
gaiety amount to? A great deal, perhaps, judged by the standard of
the wild Highlanders, come but lately from their solitary glens; but
very little, it would seem, reckoned from an English standpoint, if the
business then done by the sole wine-merchant of the town may
serve for comparison. It would appear that the merchant who
supplied Manchester lived at Preston, as the resort of the gentry,
and was rarely asked to supply more than a gallon of wine at a time:
and that a time which did not commonly stint itself in drink.
It was a very small place in those days, and numbered little more
than 6,000 inhabitants; but when the factory system was introduced
into the cotton manufacture, it grew rapidly, and is now a great town
of more than 113,000 people. Nothing else so vividly shows us how
far removed we are from those days, in circumstances and spirit,
than the simple juxtaposition of those eloquent figures, which speak
far more eloquently than the most impassioned descriptive writing.
LANCASTER.
There are still some few traces of the Roman
THE NORMAN WAY
antiquity of Lancaster, in the castle—the castle on
the river Lune, that gave the place its name—but it is in Norman and
mediæval circumstances that it chiefly figures. The castle, the very
beginning and origin of Lancaster, stands on a bold hill rising above
the Lune in so convenient a situation for defence that Nature might
almost have thoughtfully provided it for the purpose, and represents
the stronghold built by Roger of Poictou, who held all Lancashire from
William the Conqueror. Exactly how much of the once formidable
Roman castrum he found here cannot be known, for the Normans
were more intent upon conquering and securing their military
successes with fortresses, than upon preserving antiquities. The cult
of the antique was, in fact, not yet born; and when, about 1094, the
great Roger began to build the grim keep that still remains the chief
feature of Lancaster Castle, he spared nothing in the way of Roman
altars and sculptured relics that might in any way serve his turn. To
him and his builders they were relics of old, forgotten things, already
dead and damned with Paganism and the Roman rule, some, six
hundred years: as remote a period, for example, as from our day
backwards to that of Edward the Second, which seems to ourselves
no inconsiderable space of time.
So into the foundations of his immensely thick castle walls, and into
the rubble core of them went many Roman inscribed stones that
antiquaries would now dearly prize. Adrian’s Tower, with the Well
Tower, was built originally in Roman times: the first so early as a.d.
125, and the Well Tower in a.d. 305, by Constantius Chlorus. Roger,
the Norman, seems to have repaired and added to these. In Roman
times the basement of Adrian’s Tower was a place where the corn for
the garrison was ground. Later it became a bakery, and has since
1892 been a museum. In the excavations of 1890, an old floor and a
considerable deal of rubbish were removed, to a depth of eight and a
half feet, revealing the original level. In the course of these works a
portion of the Roman millstone for grinding corn was discovered, and
here it remains, in company with such diverse objects as a Roman
altar, found in the foundations of the Shire Hall in 1797; some pikes
captured from the Scottish rebels of 1715, forbidding festoons of
fetters, and a “madman’s chair,” fitted with bolts and chains, as used
at the time when the dark lower chambers of the keep served the
purpose of county lunatic asylum, and, together with the fearful
treatment accorded the lunatics, served only to confirm them in their
lunacy. There are indeed some very fearful things in this old fortress,
place of judgment, and prison of Lancaster Castle, which has been
everything, from the home of kings down to debtors’ prison and
county gaol.
As Shire Hall, Sessions House, Assize Courts, and gaol it still
remains. Prominent among the gruesome sights of the castle are the
dungeons in the Well Tower, one below the other, in the basement,
where prisoners lay in darkness, secured to the floor by the iron rings
that still remain. The roof of the upper dungeon bears witness to the
method of its construction. The earth having been first spread with a
strongly made layer of wattled osiers, liquid cement was then run over
them, and in drying formed a compact mass.
The earth was then easily excavated beneath the ingeniously
constructed roof. Some few of the osiers still remain in it.
More modern resources of justice are seen in
MALEFACTOR-BRANDING
the Drop Room, and in the Crown Court itself,
where, at the back of the dock, may yet be seen the “Holdfast” and
the branding-iron once used in branding malefactors with an M on the
brawn of the left thumb. The operation was performed in Court and
the success of it announced by the Head Gaoler in the formula, “A fair
mark, my Lord!”
“A FAIR MARK, MY LORD.”
The tragical memories of Lancaster Castle range from mediæval
deeds of blood down to the executions of prisoners taken in the
Jacobite rebellions, and to the merely sordid executions since it has
been a gaol. From 1799 to 1889, when the castle ceased to be a gaol
for the whole of Lancashire, no fewer than 228 criminals were hanged
here.
He is a fortunate visitor who comes to Lancaster at the opening of
Assize (unless he comes for trial), for old times live again in the
pageant of the Judges’ reception by the Javelin-men, in their costume
of blue and yellow, who escort them to their lodgings, and stand
attendant in Court at the opening of the commission of Oyer and
Terminer.
The impressive approach to Lancaster Castle is by way of John o’
Gaunt’s gateway, one of the many works added by that historic
personage, Shakespeare’s “time-honoured Lancaster,” when his father,
Edward the Third, created him Duke of Lancaster and raised
Lancashire in consequence to the condition of County Palatine. The
“time-honoured” one himself stands in effigy in a niche over the door-
way. One would like to think the statue contemporary with him, but
the guide-books, from which no derogatory secrets are hid, tell the
disappointing tale that it dates only from 1822.
JAVELIN-MAN.
LANCASTER CASTLE.
“HORSESHOE CORNER”
John o’ Gaunt is not to be avoided in Lancaster, castle or town. He
is, indeed, to be found pretty well all over the country, for he was not
merely Duke of Lancaster (although that was no small matter), but
owned manors in almost every part of England. Moreover, from him
sprang the House of Lancaster, the Red Rose, whose struggles with
the Yorkist White Rose form so long and bloody a series of chapters in
English history. Here, in Lancaster, from “John o’ Gaunt’s Chair,” the
topmost turret of the castle keep, down to Horseshoe Corner, the
great Duke is everywhere, and figures on picture-postcards, china,
and silver spoons with a fine impartiality. Horseshoe Corner is an
otherwise commonplace crossing of streets where, in the middle of
the roadway, a horseshoe is inserted. It is the representative, at this
long interval of time, of a shoe cast by John o’ Gaunt’s horse on the
spot, and is renewed every seven years.
St. Mary’s Church, adjoining the castle, and separated from it only
by that sad spot on the terrace where criminals were hanged in the
times of public executions, is a fine bold structure of Perpendicular
character, and possibly a good deal might be said of it in the
architectural way; but it interests me chiefly as containing a memorial
brass, now very much the worse for wear, to Thomas Covell, Governor
of the castle forty-eight years, Coroner forty-six years, and six times
Mayor of Lancaster. He died in 1639, aged seventy-eight, and is the
subject of the following encomiastic verse: