100% found this document useful (1 vote)
8 views

10723Essentials of Arduino™ Boards Programming: Step-by-Step Guide to Master Arduino Boards Hardware and Software 1st Edition Farzin Asadi - Download the full ebook set with all chapters in PDF format

The document promotes the 'Essentials of Arduino™ Boards Programming' ebook by Farzin Asadi, which serves as a comprehensive guide to mastering Arduino hardware and software. It is part of the Apress Maker Innovations series, designed to provide hands-on learning experiences in electronics and programming, suitable for both beginners and experienced makers. The ebook covers a wide range of topics including microcontrollers, digital I/O, and various practical projects to enhance skills in hardware design and engineering.

Uploaded by

moyneritchi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
8 views

10723Essentials of Arduino™ Boards Programming: Step-by-Step Guide to Master Arduino Boards Hardware and Software 1st Edition Farzin Asadi - Download the full ebook set with all chapters in PDF format

The document promotes the 'Essentials of Arduino™ Boards Programming' ebook by Farzin Asadi, which serves as a comprehensive guide to mastering Arduino hardware and software. It is part of the Apress Maker Innovations series, designed to provide hands-on learning experiences in electronics and programming, suitable for both beginners and experienced makers. The ebook covers a wide range of topics including microcontrollers, digital I/O, and various practical projects to enhance skills in hardware design and engineering.

Uploaded by

moyneritchi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

Read Anytime Anywhere Easy Ebook Downloads at ebookmeta.

com

Essentials of Arduino™ Boards Programming: Step-


by-Step Guide to Master Arduino Boards Hardware
and Software 1st Edition Farzin Asadi

https://ebookmeta.com/product/essentials-of-arduino-boards-
programming-step-by-step-guide-to-master-arduino-boards-
hardware-and-software-1st-edition-farzin-asadi/

OR CLICK HERE

DOWLOAD EBOOK

Visit and Get More Ebook Downloads Instantly at https://ebookmeta.com


Maker Innovations Series
Jump start your path to discovery with the Apress Maker Innovations
series! From the basics of electricity and components through to the most
advanced options in robotics and Machine Learning, you’ll forge a path to
building ingenious hardware and controlling it with cutting-edge software.
All while gaining new skills and experience with common toolsets you can
take to new projects or even into a whole new career.
The Apress Maker Innovations series offers projects-based learning,
while keeping theory and best processes front and center. So you get
hands-on experience while also learning the terms of the trade and how
entrepreneurs, inventors, and engineers think through creating and
executing hardware projects. You can learn to design circuits, program AI,
create IoT systems for your home or even city, and so much more!
Whether you’re a beginning hobbyist or a seasoned entrepreneur
working out of your basement or garage, you’ll scale up your skillset to
become a hardware design and engineering pro. And often using low-
cost and open-source software such as the Raspberry Pi, Arduino, PIC
microcontroller, and Robot Operating System (ROS). Programmers and
software engineers have great opportunities to learn, too, as many projects
and control environments are based in popular languages and operating
systems, such as Python and Linux.
If you want to build a robot, set up a smart home, tackle assembling a
weather-ready meteorology system, or create a brand-new circuit using
breadboards and circuit design software, this series has all that and more!
Written by creative and seasoned Makers, every book in the series tackles
both tested and leading-edge approaches and technologies for bringing
your visions and projects to life.​

More information about this series at https://link.springer.com/


bookseries/17311
Essentials of
Arduino™ Boards
Programming
Step-by-Step Guide to Master
Arduino Boards Hardware
and Software

Farzin Asadi
Essentials of Arduino™ Boards Programming: Step-by-Step Guide to Master
Arduino Boards Hardware and Software
Farzin Asadi
Department of Electrical and Electronics Engineering, Maltepe University,
Istanbul, Türkiye
ISBN-13 (pbk): 978-1-4842-9599-1 ISBN-13 (electronic): 978-1-4842-9600-4
https://doi.org/10.1007/978-1-4842-9600-4
Copyright © 2023 by Farzin Asadi
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or
part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way,
and transmission or information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Miriam Haidara
Development Editor: James Markham
Coordinating Editor: Jessica Vakili
Cover image designed by eStudioCalamar
Distributed to the book trade worldwide by Apress Media, LLC, 1 New York Plaza, New York, NY
10004, U.S.A. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com,
or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member
(owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance
Inc is a Delaware corporation.
For information on translations, please e-mail booktranslations@springernature.com; for
reprint, paperback, or audio rights, please e-mail bookpermissions@springernature.com.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Print
and eBook Bulk Sales web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is
available to readers on GitHub (https://github.com/Apress). For more detailed information,
please visit http://www.apress.com/source-code.
Paper in this product is recyclable
Dedicated to my lovely brother, Farzad, and my lovely
sisters, Farnaz and Farzaneh.
Table of Contents
About the Author�������������������������������������������������������������������������������xiii

About the Technical Reviewer������������������������������������������������������������xv

Introduction��������������������������������������������������������������������������������������xvii

Chapter 1: Introduction to Arduino Boards����������������������������������������� 1


1.1 Introduction��������������������������������������������������������������������������������������������������� 1
1.2 Microcontrollers�������������������������������������������������������������������������������������������� 2
1.3 Elements of a Microcontroller����������������������������������������������������������������������� 4
1.4 Difference Between Microcontroller and Microprocessor���������������������������� 6
1.5 Arduino Boards���������������������������������������������������������������������������������������������� 6
1.6 Programming the Arduino Boards���������������������������������������������������������������� 11
1.7 Downloading the Arduino IDE����������������������������������������������������������������������� 13
1.8 HEX File�������������������������������������������������������������������������������������������������������� 13
1.9 Uploading a Program onto the Arduino Board���������������������������������������������� 21
1.10 Power Supply for the Arduino Board���������������������������������������������������������� 24
1.11 Ready-to-Use Examples����������������������������������������������������������������������������� 26
1.12 Arduino Shields������������������������������������������������������������������������������������������ 28
1.13 Language Reference���������������������������������������������������������������������������������� 31
1.14 References for Further Study��������������������������������������������������������������������� 31

vii
Table of Contents

Chapter 2: Digital Input/Output (I/O)������������������������������������������������� 33


2.1 Introduction�������������������������������������������������������������������������������������������������� 33
2.2 Properties of Pins Configured As Input�������������������������������������������������������� 35
2.3 Pull-Up or Pull-Down Resistors with Pins Configured As Input�������������������� 36
2.4 Properties of Pins Configured As INPUT_PULLUP���������������������������������������� 37
2.5 Properties of Pins Configured As OUTPUT���������������������������������������������������� 38
2.6 Blinking the Onboard LED���������������������������������������������������������������������������� 39
2.7 Delay Generation with the millis Function��������������������������������������������������� 42
2.8 Measurement of Time Used to Run the Commands������������������������������������� 43
2.9 Delay in the Range of Microseconds������������������������������������������������������������ 46
2.10 Blink Two LEDs������������������������������������������������������������������������������������������� 47
2.11 RGB LED����������������������������������������������������������������������������������������������������� 50
2.12 One-Digit Decimal Counter������������������������������������������������������������������������ 55
2.13 Binary Counter������������������������������������������������������������������������������������������� 65
2.14 Binary Counter with 74LS595 Shift Register���������������������������������������������� 71
2.15 Four-Digit Display��������������������������������������������������������������������������������������� 75
2.16 TM1637 Four-Digit Display������������������������������������������������������������������������� 81
2.17 Reading Digital Data���������������������������������������������������������������������������������� 85
2.18 Internal Pull-Up Resistor���������������������������������������������������������������������������� 87
2.19 Toggle a Pin������������������������������������������������������������������������������������������������ 89
2.20 One-Digit Decimal Counter������������������������������������������������������������������������ 90
2.21 Electronic Dice������������������������������������������������������������������������������������������� 96
2.22 Reading a Keypad�������������������������������������������������������������������������������������101
2.23 Simple Calculator��������������������������������������������������������������������������������������104
2.24 Simple Digital Lock�����������������������������������������������������������������������������������109
2.25 Switch Bouncing and How to Avoid It�������������������������������������������������������112
2.26 Implementation of Logic Functions�����������������������������������������������������������113

viii
Table of Contents

2.27 Bit Shift Operators�������������������������������������������������������������������������������������117


2.28 Logical Bitwise Operations�����������������������������������������������������������������������118
2.29 Setting and Clearing a Specific Bit�����������������������������������������������������������120
2.30 Control a Buzzer with Arduino�������������������������������������������������������������������122
2.31 Control a Relay with Arduino���������������������������������������������������������������������123
2.32 References for Further Study��������������������������������������������������������������������126

Chapter 3: Analog-to-Digital Converter (ADC) and


Digital-to-Analog Converter (DAC)����������������������������������������������������127
3.1 Introduction�������������������������������������������������������������������������������������������������127
3.2 Protection of ADC����������������������������������������������������������������������������������������129
3.3 Simple DC Voltmeter�����������������������������������������������������������������������������������132
3.4 Serial Plotter�����������������������������������������������������������������������������������������������134
3.5 AREF Pin������������������������������������������������������������������������������������������������������137
3.6 Speed of Conversion�����������������������������������������������������������������������������������139
3.7 Voltage Level Indicator��������������������������������������������������������������������������������141
3.8 Measurement of Negative Voltages������������������������������������������������������������145
3.9 Measurement of Current Signals����������������������������������������������������������������147
3.10 External ADC and DAC�������������������������������������������������������������������������������150
3.11 PCF8591 As ADC���������������������������������������������������������������������������������������152
3.12 PCF8591 As DAC���������������������������������������������������������������������������������������155
3.13 References for Further Study��������������������������������������������������������������������159

Chapter 4: LCD and EEPROM�������������������������������������������������������������161


4.1 Introduction�������������������������������������������������������������������������������������������������161
4.2 Showing Text on Parallel LCD����������������������������������������������������������������������165
4.3 Showing Text on I2C Serial LCD������������������������������������������������������������������167
4.4 Internal EEPROM�����������������������������������������������������������������������������������������168

ix
Table of Contents

4.5 get( ) and put( ) Commands�������������������������������������������������������������������������170


4.6 External EEPROM����������������������������������������������������������������������������������������172
4.7 Writing and Reading Integer Numbers to the External EEPROM�����������������174
4.8 Writing and Reading Structures to the External EEPROM���������������������������175
4.9 References for Further Study����������������������������������������������������������������������177

Chapter 5: Serial Communication�����������������������������������������������������179


5.1 Introduction�������������������������������������������������������������������������������������������������179
5.2 Observing the Data Transfer with an Oscilloscope�������������������������������������184
5.3 Sending a String to a Computer������������������������������������������������������������������186
5.4 Receiving a String from a Computer�����������������������������������������������������������187
5.5 Receiving Floating-Point Numbers�������������������������������������������������������������188
5.6 Receiving Integer Numbers�������������������������������������������������������������������������190
5.7 Printing the Quotation Mark������������������������������������������������������������������������192
5.8 Printing Binary and Hexadecimal Numbers������������������������������������������������192
5.9 Useful Functions for String Variables����������������������������������������������������������193
5.10 Useful Functions for Character Variables��������������������������������������������������196
5.11 References for Further Study��������������������������������������������������������������������199

Chapter 6: Mathematical Functions�������������������������������������������������201


6.1 Introduction�������������������������������������������������������������������������������������������������201
6.2 Basic Mathematical Function����������������������������������������������������������������������201
6.3 Overflow of Variables����������������������������������������������������������������������������������205
6.4 E Notation���������������������������������������������������������������������������������������������������206
6.5 Map Function����������������������������������������������������������������������������������������������207
6.6 sizeof Operator��������������������������������������������������������������������������������������������209
6.7 Defining Binary and Hexadecimal Variables�����������������������������������������������211
6.8 References for Further Study����������������������������������������������������������������������212

x
Table of Contents

Chapter 7: Pulse Width Modulation (PWM)���������������������������������������213


7.1 Introduction�������������������������������������������������������������������������������������������������213
7.2 PWM Generation on Pin 9���������������������������������������������������������������������������215
7.3 PWM Generation on Pin 5���������������������������������������������������������������������������216
7.4 Duty Cycle Control with Potentiometer�������������������������������������������������������217
7.5 Control the Intensity of an LED��������������������������������������������������������������������219
7.6 Change the Frequency of the PWM Signal��������������������������������������������������222
7.7 References for Further Study����������������������������������������������������������������������224

Chapter 8: Control of Different Types of Motors�������������������������������225


8.1 Introduction�������������������������������������������������������������������������������������������������225
8.2 Control of Servo Motor��������������������������������������������������������������������������������225
8.3 Control of BLDC�������������������������������������������������������������������������������������������228
8.4 Control of Stepper motor with A4988 Driver�����������������������������������������������229
8.5 Control of 28BYJ-48 5V Stepper motor�������������������������������������������������������233
8.6 Control of DC Motor�������������������������������������������������������������������������������������236
8.7 Reading an Encoder������������������������������������������������������������������������������������241
8.8 Control of Servo Motor with Encoder����������������������������������������������������������245
8.9 References for Further Study����������������������������������������������������������������������247

Chapter 9: Interrupts and Internal Comparator��������������������������������249


9.1 Introduction�������������������������������������������������������������������������������������������������249
9.2 Simple Frequency Meter�����������������������������������������������������������������������������250
9.3 Improved Simple Frequency Meter�������������������������������������������������������������253
9.4 Frequency Measurement with the FreqCount Library���������������������������������255
9.5 pulseIn Command���������������������������������������������������������������������������������������256
9.6 Triggering an Interrupt with a Push Button�������������������������������������������������257
9.7 Triggering an Interrupt with Level���������������������������������������������������������������259

xi
Table of Contents

9.8 Comparator Interrupt����������������������������������������������������������������������������������261


9.9 Important Registers of the Internal Analog Comparator�����������������������������264
9.10 Example Code for the Internal Comparator�����������������������������������������������268
9.11 Pin Change Interrupt���������������������������������������������������������������������������������281
9.12 References for Further Study��������������������������������������������������������������������286

Chapter 10: Timers���������������������������������������������������������������������������289


10.1 Introduction�����������������������������������������������������������������������������������������������289
10.2 Clear Timer on Compare Match (CTC) Mode���������������������������������������������290
10.3 Timer 1 in CTC Mode���������������������������������������������������������������������������������299
10.4 Timer 2 in CTC Mode���������������������������������������������������������������������������������304
10.5 References for Further Study��������������������������������������������������������������������308

Chapter 11: Reading Different Sensors with Arduino�����������������������309


11.1 Introduction�����������������������������������������������������������������������������������������������309
11.2 DHT11 Temperature Sensor����������������������������������������������������������������������309
11.3 HCSR04 Ultrasonic Sensor������������������������������������������������������������������������311
11.4 YL69 Soil Moisture Sensor������������������������������������������������������������������������313
11.5 References for Further Study��������������������������������������������������������������������315

Appendix A: Testing the Components�����������������������������������������������317

Index�������������������������������������������������������������������������������������������������327

xii
About the Author
Farzin Asadi received his BSc in Electronics
Engineering, MSc in Control Engineering, and
PhD in Mechatronics Engineering.
Currently, he is with the Department of
Electrical and Electronics Engineering at
Maltepe University, Istanbul, Turkey.
Dr. Asadi has published more than 40 papers
in ISI/Scopus indexed journals. He has written 25
books. His research interests include switching
converters, control theory, robust control of
power electronics converters, and robotics.

xiii
About the Technical Reviewer
Hai Van Pham received his BSc, MSc, and PhD
in Computer Science.
Currently, he is with the School of
Information and Communication Technology,
Hanoi University of Science and Technology,
Hanoi, Vietnam.
Dr. Pham has published over 100 papers in
ISI/Scopus indexed journals. He is an associate
editor in domestic and international journals
and served as chair and technical committee
member of many national and international
conferences including SOICT 2014, KSE 2015, KSE 2017, KSE 2019, KSE
2021, and KSE 2022.
His research interests include artificial intelligence, knowledge-based
systems, big data, soft computing, rule-based systems, and fuzzy systems.

xv
Introduction
Arduino is an open source hardware and software company, project,
and user community that designs and manufactures single-board
microcontrollers and microcontroller kits for building digital devices.
Arduino boards use a variety of microcontrollers, and each board is
suitable for a specific application. For instance, Arduino Nano or Pro Mini
is an ideal option if space or weight is important for you. If you search for
a board with many input/output (I/O) pins, then Arduino MEGA is a good
option for you. If you need an Arduino board for a time-critical application
like a robot control, then Arduino DUE is a good choice. Arduino UNO is a
good option for educational purposes. All of the examples in this book are
done with Arduino UNO.
There exist many other development boards in the world, but why are
Arduino boards so famous with millions of users? Here are some of the
basic reasons that make Arduino boards outstanding:

1) Arduino has an official free of charge Integrated


Development Environment (IDE) to make coding
easier, especially for beginners. The Arduino IDE
has a minimalist interface, making it simple to write,
compile, and upload the code to the Arduino board.
It is a versatile software compatible with Windows,
Linux, and macOS.

2) The Arduino IDE is also preloaded with a broad


library of codes that users can use, modify, or
practice. Users can use these codes instead of
coding from scratch or can modify the codes for

xvii
Introduction

similar projects. This makes learning easier for


beginners because they already have codes to
familiarize themselves with, along with tons of
tutorials from Arduino’s community. It also benefits
professionals by saving them time because they can
simply copy nuggets of codes that they need for their
projects from the libraries.

3) Programming an Arduino board requires no


external programmer. All you need is a USB cable to
connect your Arduino board to the computer.

4) Many types of shields are designed for Arduino


boards. Shields are modular circuit boards that
piggyback onto the Arduino board to instill it with
extra functionality.

Therefore, enough reasons for learning how to work with Arduino


boards exist!
This book is for Arduino enthusiasts of all experience levels. Being
familiar with a programming language (especially C) is an advantage;
however, it is not necessary. This book is full of solved examples. All of the
given examples are tested. In many cases, you can edit the given codes to
solve your own problems.
This book is composed of 11 chapters. Here is a brief summary of each
chapter:
Chapter 1 is an introductory chapter about microcontrollers and
Arduino boards.
Chapter 2 shows how to generate or read digital data.
Chapter 3 shows how to generate and read analog data.
Chapter 4 shows how to connect a Liquid Crystal Display (LCD) or an
Electrically Erasable Programmable Read-Only Memory (EEPROM) to an
Arduino board.

xviii
Introduction

Chapter 5 shows how to use serial communication to transfer data


between an Arduino board and a computer.
Chapter 6 introduces the ready-to-use mathematical functions
available in the Arduino IDE.
Chapter 7 shows how to generate a pulse width modulation (PWM)
signal with an Arduino board.
Chapter 8 shows how different types of motors can be controlled with
an Arduino board.
Chapter 9 introduces the interrupts and shows how to use them.
Chapter 10 introduces the timers and shows how timers can be
programmed in Clear Timer on Compare Match (CTC) mode.
Chapter 11 shows how different types of sensors can be read with an
Arduino board.
I hope that this book will be useful to the readers, and I welcome
comments on the book.

xix
CHAPTER 1

Introduction
to Arduino Boards
1.1 Introduction
Arduino is an open source platform used for building electronics projects.
Arduino consists of both a physical programmable circuit board (often
referred to as a microcontroller) and a piece of software or IDE (Integrated
Development Environment) that runs on your computer, used to write and
upload computer code to the physical board.
The Arduino platform has become quite popular with people just
starting out with electronics, and for good reason. Unlike most previous
programmable circuit boards, the Arduino does not need a separate piece
of hardware (called a programmer) in order to load new code onto the
board; you can simply use a USB cable. Additionally, the Arduino IDE uses
a simplified version of C++, making it easier to learn to program. Finally,
Arduino provides a standard form factor that breaks out the functions of
the microcontroller into a more accessible package.
This chapter is an introduction to microcontrollers and Arduino
boards and makes the foundation for other chapters.

© Farzin Asadi 2023 1


F. Asadi, Essentials of Arduino™ Boards Programming, Maker Innovations Series,
https://doi.org/10.1007/978-1-4842-9600-4_1
Chapter 1 Introduction to Arduino Boards

1.2 Microcontrollers
A microcontroller is a compact integrated circuit designed to govern a specific
operation in an embedded system. A typical microcontroller includes a
processor, memory, and input/output (I/O) peripherals on a single chip.
Some of the commonly used microcontrollers are shown in Figures 1-1 to 1-3.

Figure 1-1. A microcontroller made by ATMEL

Figure 1-2. A microcontroller made by Microchip


2
Chapter 1 Introduction to Arduino Boards

Figure 1-3. A microcontroller made by STMicroelectronics

Sometimes referred to as an embedded controller or microcontroller


unit (MCU), microcontrollers are found in vehicles, robots, office
machines, medical devices, mobile radio transceivers, vending machines,
and home appliances, among other devices. They are essentially simple
miniature personal computers (PCs) designed to control small features of
a larger component, without a complex front-end operating system (OS).
For example, a car might have many microcontrollers that control
various individual systems within, such as the antilock braking
system, traction control, fuel injection, or suspension control. All the
microcontrollers communicate with each other to inform the correct
actions. Some might communicate with a more complex central
computer within the car, and others might only communicate with other
microcontrollers. They send and receive data using their I/O peripherals
and process that data to perform their designated tasks.

3
Chapter 1 Introduction to Arduino Boards

1.3 Elements of a Microcontroller
The core elements of a microcontroller are

The processor (CPU): A processor can be thought


of as the brain of the device. It processes and
responds to various instructions that direct the
microcontroller’s function. This involves performing
basic arithmetic, logic, and I/O operations. It
also performs data transfer operations, which
communicate commands to other components in
the larger embedded system.

Memory: A microcontroller’s memory is used to


store the data that the processor receives and uses to
respond to instructions that it’s been programmed
to carry out. A microcontroller has two main
memory types: program memory and data memory.

Program memory stores long-term information about the instructions


that the CPU carries out. Program memory is nonvolatile memory,
meaning it holds information over time without needing a power source.
Data memory is required for temporary data storage while the
instructions are being executed. Data memory is volatile, meaning the data
it holds is temporary and is only maintained if the device is connected to a
power source.

I/O peripherals: The input and output devices are


the interface for the processor to the outside world.
The input ports receive information and send it
to the processor in the form of binary data. The
processor receives that data and sends the necessary
instructions to output devices that execute tasks
external to the microcontroller.

4
Chapter 1 Introduction to Arduino Boards

While the processor, memory, and I/O peripherals are the defining
elements of the microprocessor, there are other elements that are
frequently included. The term I/O peripherals itself simply refers to
supporting components that interface with the memory and processor.
There are many supporting components that can be classified as
peripherals. Having some manifestation of an I/O peripheral is elemental
to a microprocessor, because they are the mechanism through which the
processor is applied.
Other supporting elements of a microcontroller include

Analog-to-digital converter (ADC): An ADC is


a circuit that converts analog signals to digital
signals. It allows the processor at the center of the
microcontroller to interface with external analog
devices, such as sensors.

Digital-to-analog converter (DAC): A DAC


performs the inverse function of an ADC and allows
the processor at the center of the microcontroller to
communicate its outgoing signals to external analog
components.

System bus: The system bus is the connective wire


that links all components of the microcontroller
together.

Serial port: The serial port is one example of an


I/O port that allows the microcontroller to connect
to external components. It has a similar function
to a USB or a parallel port but differs in the way it
exchanges bits.

5
Chapter 1 Introduction to Arduino Boards

1.4 Difference Between Microcontroller


and Microprocessor
The distinction between microcontrollers and microprocessors has gotten
less clear as chip density and complexity have become relatively cheap to
manufacture, and microcontrollers have thus integrated more “general
computer” types of functionality. On the whole, though, microcontrollers
can be said to function usefully on their own, with a direct connection to
sensors and actuators, where microprocessors are designed to maximize
compute power on the chip, with internal bus connections (rather
than direct I/O) to supporting hardware such as RAM and serial ports.
Simply put, coffee makers use microcontrollers; desktop computers use
microprocessors.
Microcontrollers are less expensive and use less power than
microprocessors. Microprocessors do not have built-in RAM, read-only
memory (ROM), or other peripherals on the chip, but rather attach to
these with their pins. A microprocessor can be considered the heart of a
computer system, whereas a microcontroller can be considered the heart
of an embedded system.

1.5 Arduino Boards
In a nutshell, an Arduino (/ɑːrˈdwiːnoʊ/) is an open hardware development
board that can be used by tinkerers, hobbyists, and makers to design and
build devices that interact with the real world.
The Arduino hardware and software were designed for artists,
designers, hobbyists, hackers, newbies, and anyone interested in creating
interactive objects or environments. Arduino can interact with buttons,
LEDs, motors, speakers, GPS units, cameras, the Internet, and even your
smartphone or your TV! This flexibility combined with the fact that the
Arduino software is free, the hardware boards are pretty cheap, and both

6
Chapter 1 Introduction to Arduino Boards

the software and hardware are easy to learn has led to a large community
of users who have contributed code and released instructions for a huge
variety of Arduino-based projects.
Most Arduino boards use Atmel 8-bit microcontrollers (ATmega8,
ATmega168, ATmega328, ATmega1280, or ATmega2560). Some Arduino
boards use ARM Cortex–based microcontrollers.
Some of the commonly used Arduino boards are shown in
Figures 1-4 to 1-6.

Figure 1-4. Arduino UNO board

7
Chapter 1 Introduction to Arduino Boards

Figure 1-5. Arduino MEGA board

Figure 1-6. Arduino Nano board

8
Chapter 1 Introduction to Arduino Boards

All of the experiments of this book are done with the aid of the
Arduino UNO board (Figure 1-4). Arduino UNO uses the ATmega328
microcontroller made by ATMEL. ATmega328 is made in different
packages (Figures 1-7 and 1-8).

Figure 1-7. Dual inline package (DIP) version of ATmega328

9
Chapter 1 Introduction to Arduino Boards

Figure 1-8. Very thin Quad Flat No-lead (VQFN) version of


ATmega328

The connection between ATmega328 pins and Arduino UNO board


pins is shown in Figure 1-9. For example, ATmega328’s PC2 and PD5 pins
are connected to pins A2 and 5 of the Arduino UNO board.

10
Chapter 1 Introduction to Arduino Boards

Figure 1-9. Connection between ATmega328 microcontroller pins


and Arduino UNO pins

1.6 Programming the Arduino Boards


Arduino boards can be programmed in different ways. In this book, we
will use the C programming in order to program the Arduino board.
Arduino boards can be programmed using visual environments and other
languages (e.g., Python) as well.

11
Chapter 1 Introduction to Arduino Boards

We will write the C code in the Arduino Integrated Development


Environment (IDE). The Arduino IDE (Figure 1-10) contains a text editor
for writing code, a message area, a text console, a toolbar with buttons
for common functions, and a series of menus. It connects to the Arduino
hardware to upload programs and communicate with them.

Figure 1-10. Arduino IDE

Programs written using the Arduino IDE are called sketches. These
sketches are written in the text editor and are saved with the file .ino
extension.
As shown in Figure 1-10, the C code has two default functions: setup
and loop. The code inside the void setup will be executed once, and only
once, at the beginning of the program. Then, the code inside the void loop
will be executed again and again (hence the name “loop”), until you power
off the Arduino board.

12
Chapter 1 Introduction to Arduino Boards

1.7 Downloading the Arduino IDE


You can download the Arduino IDE using the www.arduino.cc/en/
software link. Use the DOWNLOAD OPTIONS section (Figure 1-11) of the
given link to download the suitable version for your computer.

Figure 1-11. Download section of the Arduino website

1.8 HEX File
A HEX file is a hexadecimal source file typically used in the programming
of microcontrollers. If you share a .INO file, anyone can edit or see the
main program. But HEX files are much more secure than INO files; no one
can edit them because of the hexadecimal format.
Let’s see how we can see the generated HEX file associated with a C
code. Open the Arduino IDE (Figure 1-12).

13
Chapter 1 Introduction to Arduino Boards

Figure 1-12. An empty sketch

Write the code shown in Figure 1-13. This code turns on the onboard
LED, waits for 1 s, turns off the onboard LED, waits for 1 s, and repeats this
procedure.

14
Chapter 1 Introduction to Arduino Boards

Figure 1-13. Code to blink the onboard LED

Click File ➤ Save or press Ctrl+S. This opens the Save sketch folder as…
window for you (Figure 1-14). Save the file with the name of blink.

15
Chapter 1 Introduction to Arduino Boards

Figure 1-14. Saving the sketch

Click File ➤ Preferences (Figure 1-15).

16
Chapter 1 Introduction to Arduino Boards

Figure 1-15. File ➤ Preferences

Check the compilation box (Figure 1-16).

17
Chapter 1 Introduction to Arduino Boards

Figure 1-16. Preferences window

Click the Verify button (Figure 1-17). Wait until “Done compiling”
appears on the screen (Figure 1-18).

Figure 1-17. Verify button

18
Chapter 1 Introduction to Arduino Boards

Figure 1-18. Compiling is done

Now go to C:\Users\Your_Name\AppData\Local\Temp\. The


generated HEX file is located there (Figure 1-19).

19
Chapter 1 Introduction to Arduino Boards

Figure 1-19. Generated HEX file

You can use Notepad++ to open the HEX file (Figure 1-20). As the
name suggests, it contains a collection of HEX numbers.

Figure 1-20. Notepad++ is used to open the generated HEX file


20
Chapter 1 Introduction to Arduino Boards

1.9 Uploading a Program onto


the Arduino Board
Connect the Arduino UNO to the computer using its cable. Open the Tools
and select the Board: “Arduino UNO” (Figure 1-21).

Figure 1-21. Selection of the Arduino UNO board


21
Chapter 1 Introduction to Arduino Boards

AVRISP mkII is good for Arduino UNO. Ensure that it is selected


(Figure 1-22).

Figure 1-22. Selection of AVRISP mkII

Now write your code and save it (Figure 1-23). Then click the Upload
button (Figure 1-24) to upload the code into the Arduino board.

22
Chapter 1 Introduction to Arduino Boards

Figure 1-23. Code to blink the onboard LED

23
Random documents with unrelated
content Scribd suggests to you:
said to be among his kinsmen at Wardak; the next that he is stirring
up the Zurmut people east of Ghazni; and then come all sorts of
absurd rumours about his being on the way to Kohistan to see what
Mir Butcha is doing.
Our intelligence department is growing at last to be something
more than a name. Before the events of the 11th and 23rd
December, the only reports that were received as trustworthy were
those given by paid spies and followers of the sirdars—followers who
are, as a rule, of the purest type of ruffianism. One always looks
upon a sirdar as a past-master in the art of deception, who would
sacrifice the British at any moment if he could do so with impunity;
and the hangers-on of these chiefs are not a whit better than their
masters. The action of the 11th in the Chardeh Valley proved to
demonstration that no trust could be placed in the reports given by
the sirdars: there were found to be 10,000 or 15,000 men within ten
miles of Sherpur, whereas we had only heard of 5,000 being at
Argandeh. Now there has been established a regular system of
patrols, and a certain number of Kizilbash horsemen are stationed at
various points on the Argandeh Kotal, Surkh Kotal, the Kohistan
Road northwards over the Paen Minar Kotal, and about Charasia.
They are under the command of one responsible native leader in
Sherpur, who again is directly controlled by Lieutenant-Colonel
Lockhart, the Quartermaster-General of the division. As these
horsemen are paid, not by results, but for regular service on patrol
work, they are likely to be more trustworthy than the highly-paid
spies hitherto employed. If the system could be a little more
extended on the lines I have before pointed out in previous letters—
viz., regular establishment—it might be a great aid to us in the
guerilla warfare we are engaged in.
Important news has been received that Abdur Rahman Khan has
left Tashkend, and is now probably in Turkistan. If his residence
among the Russians has not thoroughly converted him to their
views, he might be a useful man for us to take up. He is ambitious,
and, if we can trust Mr. Schuyler’s estimate of him, has some ability
which might now be turned to good use. What his influence would
be now in the country after so many years of absence we cannot
tell; but to-day, in mentioning his name to an old Cabuli, and saying
that he was possibly already in Turkistan, my listener’s face lighted
up with pleasure, and he eagerly asked if he would return to Cabul.
There are so many possibilities to be weighed in calculating the
chances of settling affairs here on a fairly safe basis, that Abdur
Rahman’s claims may come to be considered. Unless, as I have said,
he has been Russianised, he might fall in with our views, and, at
least as a provincial governor, be trusted with authority.
In the meantime we are making preparations to hold Cabul as well
as Sherpur in case of an attempted repetition of the events of
December 11th to 23rd. General Charles Gough’s brigade in the Bala
Hissar is busy at work, cutting a broad road from the Shah Shehr
Gate (that facing Siah Sung) to the gate overlooking the city near
Chandaul. The broken places in the walls have been built up, and
improvements made by the Engineers, so as to give shelter to the
garrison if an attack were attempted from the city. The Sherderwaza
Heights immediately above the Bala Hissar are also to be held in
future by one battalion (say 500 or 600 men), stationed in three
strong towers, now in course of construction. The first and strongest
of these is on the spur above the Arsenal; a steep point completely
commanding the Upper Bala Hissar already being crowned with
strong walls, the basement of the tower. The crest of the
Sherderwaza Heights already boasts of a strong wall, part of the
Afghan fortifications; and this position is naturally so strong, the
hillside sloping down almost perpendicularly towards Chardeh Valley,
that with the two towers now being built it could defy assault from
any force destitute of artillery. The ridge running down westwards to
the Cabul gorge would also be held if an enemy menaced the city,
and on the Asmai Heights on the northern side a strong fort is to be
built. The military roads converging upon Dehmazung from Sherpur
cantonments unite in Deh-i-Afghan and pass by the foot of the
Asmai Hill, whence they are to be continued in one broad road until
the main Bamian Road through Chardeh Valley is gained. The towers
above mentioned are to be provisioned and watered, always, for ten
days, and are to contain small-arm ammunition equal to the
requirements of a battalion for that period, calculated on the basis of
serious fighting. A road broad enough for guns will also be made
about Cabul itself from Deh-i-Afghan to the Bala Hissar, in addition
to a circular road about Sherpur cantonments. Another road is to be
cut from Bemaru village to the Siah Sung Heights, with a bridge
spanning the Cabul river; and yet another from the 67th Gateway
(near the south-eastern bastion) direct to the Bala Hissar, this also
crossing the river by a new pile bridge. These two roads will ensure
communication between Sherpur and the fortress without our troops
having to pass near the city walls; and will give us alternative
bridges over the Cabul, whereas we formerly had only one bridge,
that on the city road from Sherpur. With regard to the cantonment
itself, the clear space for 1,000 yards about the walls is already
partly made, although the débris of forts and villages destroyed
requires much levelling before it can be said that all cover has been
swept away. The blocks of solid mud and the loose rubbish could be
utilized by skirmishers advancing to attack, and until this
accumulation of ruins has been thoroughly levelled, our rifle-fire will
not have a fair chance. On the eastern point of the Bemaru Heights
a very strong tower is now being rapidly built, and the hill about it is
to be scarped for ten yards, so that to assault it from outside
cantonments would be impossible. At the north-west corner, below
the western end of Bemaru Heights, the line of trenches with their
parapet of gun-carriage wheels (described in one of my letters
written during the siege) will also be strengthened by a broad and
deep wet ditch.

CHAPTER XXII.
Philanthropic Work in Cabul—Dr. Owen’s Hospital—Prejudices gradually Overcome
—The Attendance of Women—The Hospital Wrecked by Fanatics—The Place
Re-established—A Visit to the Wards—Gratitude of the Patients—Treatment of
Men Wounded in Action—Confidence in the Surgeon’s Skill—Life in Sherpur—
Freedom of Criticism upon Current Events—The Sherpur Club—Amusements
of the Garrison—The First Theatre—The Pleasures of Skating and Sliding—A
Snow Fight on Bemaru Heights—“How they Live in Cabul”—Zenana Life—
Prevalence of Intrigues—Shopping—A Cabul Interior—A Lady’s Dress—Cabuli
Children—Character of the Citizens of Cabul—The Sirdar—Ambition and
Sensuality—A Sirdar’s House—The Rites of Hospitality—The Cabul Trader—His
Manner of doing Business.

22nd January, 1880.


As there seems to be an impression gaining ground, at least in
England, that our army of occupation have adopted the Russian plan
of settling a country—the institution of a Reign of Terror—it may be
worth while to describe fully the means which we have taken for
drawing the people towards us. After the capture of Cabul in
October, it was found that there was a vast amount of disease and
suffering among the poorer inhabitants of the city, and that native
surgery never attempted to cope with these, except in the rudest
way. With the benevolence which generally characterizes our
commanders in the field, Sir F. Roberts ordered a charitable
dispensary and hospital to be opened in Cabul; and Dr. Owen, Staff
Surgeon, was placed in charge of the institution. The Kotwal’s house,
vacant by reason of the execution of that official for complicity in the
Massacre, was turned into a hospital, and work was begun at once.
The rooms were cleaned and put in order, wards for men and
women arranged, the tottering walls shaken by earthquakes made
safe and sound, and then patients were invited to attend. On
November 21st, Dr. Owen was first “consulted,” twelve wretched
beings, suffering from various ailments, coming to him for
treatment. They were carefully treated, and although, on account of
the scarcity of English drugs in camp, no elaborate prescriptions
could be made up, the best bazaar medicines were freely given. The
news of the Sircar’s latest eccentricity soon began to spread
throughout Cabul, and for several days the place was visited by little
crowds of persons, who were either sick, or had sick friends who
needed treatment. With the suspicion always at work in Afghan
minds, that every act of the stranger has some obscure tendency to
harm them, the citizens were full of mistrust. They could not
appreciate the generosity of their conquerors, and argued that it was
absurd to suppose that men who had come to destroy Cabul would
sink their ideas of vengeance, and, instead of taking life, would save
life and make it worth living. Gradually their ideas changed; they
believed in the disinterestedness of the English hakeem (who, by the
way, was more than once mistaken for Sir Louis Cavagnari, risen to
life again, Dr. Owen slightly resembling our dead Envoy). The
number of patients increased; but, with customary jealousy, no
women were permitted to seek relief: there might be a plot to
invade the sanctity of the Afghan household. But attentions of this
sort were not thrust upon the citizens, and some women also were
found waiting at the hospital doors. A room was set apart for them
in which they could wait without fear of being molested; a middle-
aged woman, a Cabuli, acted as matron, and re-assured them, when
their fears overcame their desire to be made whole.
By the 11th of December the daily attendance had risen to 118, of
whom fully two-thirds were women, and Dr. Owen’s services were
sought after by well-to-do citizens, in whose zenanas were sick
wives or favourite concubines pining under mysterious ailments. Just
when attendances were daily growing more numerous, came the
rush of Mahomed Jan’s host upon Cabul. The city was occupied, and
in the stupid madness which prompted the ghazis to destroy all
marks of our occupation, the dispensary was looted and partly
wrecked. Fortunately, the few cases of instruments, which Dr. Owen
had to leave behind, were taken away by one of the attendants and
buried in a neighbouring house. But the bottles of medicines still on
the shelves were broken; chairs, tables, and partitions smashed to
pieces; and even doors and windows pulled out. This was in the
outer courtyard of the late Kotwal’s house; the rooms grouped about
the inner yard were not much interfered with, as they bore but few
signs of the stranger’s hand. When on Christmas Day, Dr. Owen once
more visited the place, nothing but empty rooms greeted him, and
these so filthy, that they could scarcely be entered. However, those
in the outer courtyard were soon cleaned, and on the following
morning patients were again found waiting at the doors. There were
only eighteen on that particular day; but as peaceful times were
more assured, the list soon grew to its old proportions; and
yesterday, when I visited the hospital, there were 207 patients on
the books. The disease most prevalent in Cabul is ophthalmia,
caused by dirt and exposure; while cataract and other serious
affections of the eye are also only too common. The type is very
much the same as that found in Egypt; and partial, or complete,
blindness from neglect follows almost as a matter of course. Luckily
for the Cabulis, Dr. Owen is a skilled oculist, and already his
operations are bruited about the city as marvels that cannot be
easily understood by the people.
My visit yesterday was made with Dr. Owen a little before noon; a
sharp walk from cantonments, past the ruins of the forts of
Mahomed Sharif and Mahomed Khan and over the Cabul river,
bringing us in a quarter of an hour to the western skirts of the city,
not far from the Bala Hissar. Through a narrow, winding lane, so
filthy and muddy that a Cologne slum could not compare with it, and
then into the Char Chowk Bazaar, just where it tapers off towards
the Peshawur Gate: along this for a few yards, and over a doorway
on the right, a wooden board catches the eye, with the words
“Charitable Dispensary,” painted upon it, with the Persian translation
below. As we passed through the doorway into an open courtyard,
where thirty or forty wretched poshteen-clad men were squatting
under a rude verandah, a Ghoorka guard of four men stood to
attention on the sunny side of the yard. The squatting figures rose
up and made their salaam abjectly, as poverty ever does; they were
the poorest of the poor—Hazara coolies, Mahomedan beggars,
lepers, the blind, the halt, the maimed—all whom wretchedness and
disease have cast out as a hideous fringe upon healthful life. Apart
from the general crowd were solitary men, whose appearance
showed them to belong to the shopkeeping class—an influential
section in the busy life of Cabul. Two or three women, veiled from
head to foot, resembling nothing so much as Sisters of Charity,
followed us in, and, with faces carefully covered by their yashmaks,
passed quickly into a closed room, the door of which opening for an
instant showed other white-robed figures grouped together. There
are three rooms on the right of the courtyard—a small one, in which
stores are kept and an attendant lives; a second, which serves as
dispensary, surgery and consulting-room; and a third, the zenana,
the room in which the women wait in quiet seclusion. Around the
inner yard, which is reached by an open passage, are the wards
proper of the hospital, wherein surgical cases, or those involving
nursing and supervision, are treated. The rooms are warm and
comfortable, and the terraced roof is well adapted for convalescent
patients, who can “sun” themselves in comfort, that process which
does so much to restore strength after a weary illness. A room on
the roof is being fitted up for operations, as it is light and airy, and
the operator will not be liable to be disturbed by the curious crowd
which often collects now in the outer courtyard. Among the in-
patients the most noticeable was a man suffering from severe bullet
wound in the leg. He had been shot by us during the investment of
Sherpur, and now, to his surprise, found himself being treated kindly,
and cured of a wound that, if untended, would have caused his
death. He seemed very grateful for the attention paid to him: to be
given comfortable quarters, food, and a skilful surgeon by the Sircar
against whom he had fought, was so unexpected, that his mind had
not quite grasped the whole idea. No doubt, in time, he will see that
it was done with no more evil intent than to prove that we bear no
malice, and are only anxious to conciliate the people. Other
wounded men have also been treated, and notice has been sent
round to all the villages about that any one suffering from hurts
received in the fighting will be admitted freely into the hospital, and,
when cured, will he allowed to depart without molestation. Our
“Reign of Terror” must surely be of the mildest when our
benevolence plays so chief a part in our policy.
After seeing the wards in which the patients were lying covered
with blankets, and with their feet thrust towards the middle of the
room, where was placed a wooden frame guarding a pan of live
charcoal, the heat of which is retained by thick, wadded quilts placed
over the frame, we returned to the dispensary where the “out
patients” are dealt with. Place aux dames: the women were first
treated, two native doctors (one a Cabuli educated in the Punjab)
taking their tickets and dispensing medicine, while Dr. Owen rapidly
examined them. There were many eye-cases, ophthalmia being most
frequent, and the eagerness with which the women pressed forward
showed their faith in their newly-found friend. They were nearly all
old, wrinkled, and hideous; but their veils were as carefully drawn
until they were face to face with the surgeon, as if they had been
still youthful and attractive. Two or three children were also brought.
One bright-eyed little fellow, with a fractured arm, which had been
set a few days before, crying out with pain until it was found that
the sling in which the limb was carried had been carelessly tied by
his helpless mother, who had not understood the instructions given
to her. In a few minutes all was set right again, and the brave little
man bore the pain without a murmur. When the worst cases had
been seen, Dr. Owen went out to visit one or two patients in the city,
leaving the native doctors to deal with such trifling ailments as were
sought to be relieved. Medicines are given gratuitously; and though
patients with diseases of years’ standing expect to be cured in a few
days, everything done to relieve their suffering is gratefully
accepted, and belief in the hakeem’s skill is a cardinal article of faith
among all of them, as only one death has occurred since the hospital
was opened. Dr. Owen is now freely admitted even to houses where
Afghan exclusiveness is most severe, and thus imperceptibly an
influence is being gained over the minds of the people which cannot
fail to do great good. The jealousy of Mahomedans where their
women are concerned is quite disarmed when they see how entirely
devoted the English surgeon is to his profession, and how little it
affects him whether his patients are street beggars, in the lowest
depths of misery, or ladies of the zenana, surrounded with every
comfort.
I have described one phase of our rule in Cabul, and it will be
seen from it whether our policy, however defective it may be in its
indistinct outlines and indefinite aims, deserves the title of “Russian.”
When wounded ghazis are in our “charitable hospital,” our
vengeance must surely be of the most harmless kind. We have
troubled waters enough in Afghanistan, but we have also our pool of
Siloam.
I give here two articles written a few weeks later, descriptive of
our life in Sherpur, and also of native life in Cabul:—
“How we Live in Sherpur.”
We are a self-contained colony here, and a self-possessed one,
too, for the matter of that, but we are by no means self-satisfied.
Every man among us believes that if his advice had only been asked,
the Afghan difficulty would have been settled months ago, and we
should now be enjoying the delights of furlough in England, or
revelling in the fascinating gaieties of the cold season in the plains. A
Briton without his grumble would be unworthy of his country, and so
we growl and swear against the Powers that be, and ask why, in the
name of all that’s wicked, the wire-pullers in India and England do
not make up their minds to settle the matter. We are so conscious of
our own unrecognized powers as politicians and diplomats, that we
laugh to scorn the idea that affairs cannot be put on a footing that
would satisfy even the staunchest believers in a scientific frontier.
The army in the old days was merely a machine which, once set in
motion by the hand of a minister, ground out its life for years and
years, without anything more than an occasional groan when its
wheels were not properly lubricated. But, now, things are changed:
every soldier is not only a fighting machine, but a thinking machine,
digesting rumours and theories with marvellous voracity, and
reproducing patched and piebald opinions of his own, which will
intrude themselves into prominence. There can be in our ranks no
“mute, inglorious” Wellingtons—or Wolseleys (for, in the eyes of
many purblind people, the terms are synonymous); an officer can
now through many channels criticize and smash up the strategy of a
campaign, and calmly sit upon the heads of his seniors while his
comrades applaud most heartily. Even the private soldier in the ranks
knows full well that if he only pulls the long bow sufficiently in a
letter home, some sympathizing party journal will accept his view of
the situation, and upon it draw with no uncertain hand the outlines
of a new policy. If the flood of criticism which is now surging about
Sherpur could only be collected in one stream, and be poured upon
the devoted heads of the clever politicians who hold our destinies in
their hands, these gentlemen would never stand high and dry again;
they would be overwhelmed once and for all. A shower bath braces
the system; a waterspout drowns all upon whom it falls; and if there
were not a feeling that our blundering along here, without a guiding
light to show General and soldier what to do, were now coming to
an end, such a phenomenon as a waterspout might arise in Sherpur.
But I have before sketched this phase of an existence here: if I said
“life,” my own might be endangered by the indignant army of
Philistines, who only “exist;” and it is useless to revive the cry of
“Loot, Love, and Liberty,” for not one of these blessings is
forthcoming.
And yet from day to day we continue our being, and the days are
not so long as at first sight might be supposed. We have one
panacea for all the evils with which we believe ourselves beset: we
make the best of everything. Given the fine, bright weather which
delighted us only a few days ago, and Gymkhana meets, pony
matches, polo and dog-hunting delight our hearts and strengthen
our digestions. Given a snow-fall and a rapid thaw, when the ground
underfoot is merely a quagmire: our rooms and mess-houses, snug
and warm, seem to invite us to a quiet rubber or an earnest study of
books and papers. And then there is our Club; it is an accomplished
fact, and, what is more, is an “institution.” It was conceived in the
calm which preceded the stirring events of December 11th to 24th,
but its birth came not until a fortnight ago. It is not of the imposing
kind that was first intended, but still it suffices for all our wants, and
is made a rendezvous by all who care for some other society than
the familiars of their own messes. From Bemaru village, where the
Guides are encamped, and the choice spirits of the Transport
Department hold high revel occasionally on that spot sacred to the
memory of that foolish virgin who died be-maru (without husband)—
from Bemaru to the quarters in the western wall is nearly two miles;
and it was not to be wondered at that friends at either end of
cantonments saw little of each other when there was no gathering-
point. One might pay a visit and, after tramping through slush and
snow, find one’s friend absent. To accept an invitation to dinner
meant braving pitfalls and watercourses in the darkness, or
helplessly wandering about in the darkness on the return journey,
uncertain in what direction one’s home lay. But now the Club is a
recognized centre, about which, in the evening, when work is over
and dinner not yet on the table, many of us gather. The excuse is a
“nip” before dinner; the reason our sociable instincts. A witty
Frenchman has said:—“Wherever three or four Englishmen are
congregated, voilà un club!” It is so: there is nothing to be ashamed
of in our love of companionship. And our Club has the charm of
novelty, both in situation and design. It is the first established under
the shadow of the Hindu Kush, on historic ground; and its
architecture is a mixture of the nomadic and Public Works styles. We
pitched a large tent: we were nomads; we took down the canvas
side-walls, and built in their place walls of mud and bricks, pierced
with windows and doors, and with chimneys springing out above the
canvas roof. The structure was complete. From nomads we became
clubmen. Could civilization further go? And here we meet and
exchange views upon things in general and Afghanistan in particular,
subaltern and Colonel shouldering each other in true club style, the
mixed crowd being flavoured generally with a Brigadier or two, while
the darlings of the Staff air their gold-lace in a more congenial
atmosphere than their stuffy quarters, which are office, dining, and
sleeping rooms all in one. Certainly our Club is a success.
In the shape of indoor amusements, Christy minstrel bands are
springing up, and one theatre has already had a short season—three
nights. The 72nd Highlanders have rigged up in the ditch near their
quarters a number of pals resting against the stout mud wall, and in
this a first-class stage has been built with act-drop, scenery,
footlights, and all complete. On the opening night the 5th Ghoorkas,
old friends of the 72nd, felt that their patronage was indispensable;
and when two little “Ghoorkis” struggled into the pit and tried to
peep over the heads of the crowd, a dozen eager hands hoisted
them shoulder-high, and amid great applause they were carried to
the front and placed in the first row. Here they smiled their thanks
as only Ghoorkas can smile—from ear to ear—and when the curtain
rose, they watched the performance critically and with unbounded
satisfaction.
The severe weather that has declared itself during the last few
days has added new sources of amusement. A week ago the owners
of skates were disgusted with the non-appearance of hard frost;
now skating goes on nearly all day long, and the science of sliding is
also being cultivated. Europeans and natives alike indulge in a
“slide;” and to see half a dozen Guides contentedly coming croppers
on the ice, and rising again with immense satisfaction, only to sit
suddenly down the moment afterwards, would make Timour himself
smile benignantly. Once on the slide, every man seems but a child of
larger growth, and right gleefully the game is kept up until tired
nature gives in, and various points of our bodies remind the most
hardy that bruises are painful when excitement dies out. With the
fall of snow on Monday came a battle-royal, which will always live in
the annals of our occupation. To tell the story with due solemnity: at
noon word was brought to the 72nd Highlanders that the enemy
(the 67th Foot and 92nd Gordon Highlanders) had occupied the
strong fort on the eastern end of the Bemaru Heights. Without delay
the regiment fell in 500 strong, and, reinforced by the 9th Lancers
and some artillerymen, marched with banners flying and drums
beating to the attack. (The banners were those lately captured on
the Takht-i-Shah Peak and the Asmai Heights; the drums were
various cooking-pots.) On nearing the enemy’s position, the
attacking force was joined by a detachment of the 5th Ghoorkas
under their British officers; skirmishers were thrown out, and the
bugle sounded the assault. The storming party were headed by the
standard-bearers, the cry of “Ghazis to the front!” being answered
by a rush of these reckless men up the hillside. They were met by
such a terrific fire, the air being darkened by snowballs, that the
assault seemed hopeless. But amid the din the cry of their leader,
“Ghazis to the front!” rang out—

“Ho! Ghazis to the front! Ho! Ghazis bear the brunt


Of the battle waged on snowy Bemaru!
Let not the stinging ball your fiery hearts appal,
But hurl the Kafirs down! Allah-hu!”
The despatch says:—
“A desperate resistance was made, but a bugler with the 72nd
succeeded by a ruse in turning the fortunes of the day. He crept
round in the enemy’s rear and sounded the regimental call of the
92nd, followed by the ‘cease fire’ and ‘retreat;’ the 92nd fell back
and the attacking party carried the position. Many prisoners were
taken and the usual atrocities committed—one gallant Highlander
having three men sitting on his chest at once; while others, equally
gallant, were buried alive in the snow. The conduct of all concerned
fully bore out the estimate previously formed of the splendid fighting
powers of our men, and several 'V.C.s’ are to be awarded. The
number of wounded was unusually great, but all are now doing well.
The defeat of the enemy was so complete that they at once sued for
peace, and a treaty was signed at the Club later in the day by the
principal leaders. In consequence of the ink being frozen, curaçoa
and brandy were substituted.”
It will be seen from the halting sketch here drawn, that with all
our growling discontent at being left in the dark as to the future, we
manage to smooth away the rough edges of our life which so much
gall us, and that our petulance never grows into sulkiness. That we
have to fall back upon rough horse-play occasionally is not
surprising: there is no softening influence to keep our spirits at an
equable temperature. We are a colony of men—chiefly young men;
and Cabul society is so very select that we have not yet gained an
entrance within its sacred limits. If we were to make ceremonial calls
upon the zenanas, we should probably be confronted by some buck-
Afghan, with a knife in his hand and an oath in his mouth. Love and
war do not go hand in hand now in Cabul, although they did forty
years ago; so we must sigh in vain for a glimpse of that beauty
which the yashmaks hide so jealously when the Cabul ladies flit by
us in the narrow streets of the city. When a more than usually
coquettish white-clad figure passes, we turn hastily about; but what
can be seen?—

“Nought but the rippling linen wrapping her about.”


And what is she like in the seclusion of the zenana? Ah, that lies
apart from our life in Sherpur; but perhaps I may be able to partly
answer the question. “How we Live in Sherpur,” can only have as its
companion picture—

“How they Live in Cabul.”


It is not an attractive life, that which we have come upon in Cabul;
but it has its lights and shades and a certain robustness of its own,
which is now more than ever apparent. The reaction after the
excitement of the siege of Sherpur was terribly depressing for a time
in the city, as every Mahomedan citizen felt that a heavy punishment
might fall upon him, and in most cases justly. But these ignorant
fanatics did not know that the Government of England is a limited
monarchy tempered by Exeter Hall. Now they have fully realized that
we were in earnest in offering an amnesty to all who would return
peacefully to their homes, and have renewed their trading with a
vigour which shows their appreciation of our new rupees. As in every
Oriental city, the life led by men and by women runs on very
different lines; the concerns of the bazaar and the affairs of the
zenana are as distinct as day and night; the one is all energy and
strife, the other dulness and monotony. Woman has no place in the
creed of Mahomed beyond the base one of continuing the
Mussulman race; she is an inferior creature, to be shut up and kept
from mischief within the four walls of her master’s harem. If she
loves her lord—or some part of him, as she generally shares his
affection and bodily presence with other wives or slaves—she
dutifully brings forth a son to continue the race, and then her
mission ends. She is a piece of furniture, a belonging of the zenana;
and if nature has not gifted her with a love of intrigue, she must be
content to vegetate in seclusion until, in the ripeness of years, she
drops out of life. She knows she has nothing to expect beyond the
grave; does not her creed teach her that her lord will lie in the lap of
houris steeped in eternal sensual bliss? Perhaps in her wildest flights
of imagination, she may gain hope from some such mad idea as that
she and her fellows will be blended into one great mass, from which
will spring millions of houris to people the heavens, and wait with
open arms for the souls of the faithful. May not she, in houri form,
fall to the lot of the man she loved on earth, who despised her as
something too trivial for much consideration? Such a belief may
comfort her; let us hope it does.
But woman in Cabul has fewer restrictions placed upon her than in
other Oriental cities, and the semi-freedom she enjoys has been the
theme upon which travellers in old days delighted to enlarge. Cabul
is declared by them to be the city of intrigue. This belief arose from
the practice of women, closely veiled from head to foot, being
allowed to pass unmolested along the public streets, unattended and
with no restrictions upon their movements. One enthusiastic writer,
speaking no doubt from experience, asserts that the mind of an
Englishman cannot imagine the extent to which intrigues are carried
on in this forward city. Wife, daughter, or mother, could, according to
his account, pass from the zenana into the narrow thoroughfares
about, and with perfect confidence visit any lover upon whom her
eyes had fallen. Every figure loses its identity in the folds of the
white drapery which completely envelopes a woman from head to
heel, and the yashmak covering the face blots out the features more
thoroughly than a mask. Undoubtedly this freedom of action does
exist, in appearance at least, still; white-robed figures flit about the
bazaars and the by-streets, and no one pays regard thereto; but
they are women of low degree, with no charms to guard, and
probably with but little thought of pleasure in their minds. If finest
linen, a gold embroidered boot, a coquettish mincing step, attract
the attention of a Kafir, the latter will invariably find that the lady is
attended by some duenna, or more probably by two or three male
domestics, who clear a way for their mistress through the motley
crowd. The Afghans are said to be peculiarly jealous of their women:
witness the proclamation issued to our soldiers before Kushi was
left!—and though love laughs at locksmiths, it seems incredible that
any sirdar or well-to-do citizen should allow the inmates of his
zenana liberty to wander about at will, with no eye to watch their
movements. We are rather at a disadvantage in Cabul; for a Kafir to
explore the penetralia of the gloomy high-walled houses is next to
impossible. We have a Club, it is true, but it is not on the deliciously
free principles of the Orleans; and if we were to institute five-o’clock
tea, and send out cards of invitation to Madame Shere Ali and
Madame Yakub Khan, and harem, or any other ladies of distinction in
Cabul, there would be no chance of the invitation being accepted.
The ladies might rise to the occasion, but their grim guardians would
baulk their intentions with a vengeance. To make calls of ceremony
would be equally impossible, for there are no grass-widows in Cabul
with whom to enjoy a cosy tête-à-tête. If, by some lucky
combination of the stars, a Kafir were fortunate enough to gain the
sacred ground of the zenana, its simple-minded inmate would
probably lisp out in fluid, but passionless, Persian:

“I do not seek a lover, thou Christian knight so gay;


Because an article like that has never come my way.”

In fact, a stranger in the harem would be a very indefinite article


indeed in Cabul, for it is not every one who can hope for the good
fortune of a McGahan, who, in the Khanate of Khiva, wandered into
a zenana, and was treated with hospitality and caresses by its
inmates.
But it may be as well to be more definite in dealing with the life of
women in Cabul; and I will endeavour to describe, in all fairness,
what I have personally seen. To take the commonest figures seen in
the bazaar: It is not unusual for women to do their “shopping” in
public, though they lack the confidence of Western ladies, who
parade their men-kind on such important occasions.
A Cabul lady stops before a stall in the bazaar, puts out a small fair
hand, richly ringed, and touches any article she needs: generally a
piece of Bokhara silk or English linen. The shopkeeper, sitting cross-
legged among his goods, names his price; the customer quietly pulls
the silk, say, towards her, bows her head, and, raising her yashmak
an inch, looks critically upon the article. The seller stares over her
head at the busy life about him, says not a word till the examination
is at an end, and finally, after a little bartering, sells the silk, or
throws it back into its place. In either case he cannot have any idea
of the identity of the customer, though from her jewellery he may
make a shrewd guess as to the length of her purse. Not every
woman’s fingers are circled by rings, or her yashmak secured with
loops of gold. And so the lady passes on, pausing, perhaps, at other
stalls, but never for long. To loiter before the goods which may
charm her eye seems no part of her business, even when a more
than usually brilliant display of silk or embroidered shoes attracts
her. Her walk is hurried, her time, perhaps, is precious, and she
glides among the crowd quietly, and as if shunning attention, though
no one, unless he be a Kafir, pays the least regard to her presence.
Finally, she turns off into some side-street, and disappears in a
narrow gateway leading, one supposes, to her home. The majority
of such women shrink from any chance contact with a Kafir of any
kind; though such little bits of comedy have been acted as one of
our gallants peering into doors and gateways only to find an
unveiled face turned towards him, and that face generally very plain
and unprepossessing. Such dames are of an uncertain age, and are
not coy in thus rewarding attention or admiration, though such
reward never goes beyond unveiling for an instant.
I had occasion quite lately to visit the house of a merchant in
Cabul, a Mussulman of some little standing, and by a lucky accident
got a glimpse of the home life of such a woman as I have described
shopping in the bazaar. My companion and guide—who or what he
was matters not—led me through tortuous streets, so filthy, that to
tread them was alone a trial, until at a nail-studded door he stopped
and knocked twice or thrice with the large iron “knocker” on its
centre. All was still and silent inside for a moment, and then a
picturesque-looking ruffian, no doubt the Afghan serving man of the
period, suddenly withdrew a bolt inside, after examining us through
the wicket. We stumbled along a passage dark enough to make the
few holes about more treacherous than holes ever were before, and
then suddenly came a stream of light and we were in an open
courtyard. It was commonplace enough: there were no “murmuring
fountains, orange trees, or shady nooks,” such as Eastern travellers
love to dwell upon; simply a brown square plot of ground with
rooms, two storeys high, surrounding it on all sides. On the left,
facing the south, were the quarters of the owner; his reception-room
and zenana, side by side; with a narrow doorway, screened by a
purdah (in Western phrase, a portière), leading from one to the
other. The rooms were open to the air on the courtyard side,
elaborately-carved woodwork in the shape of sliding panels being
the only screen from the sun. The interior was comfortable enough:
the floors were covered with carpets, over which was laid clean
white linen; the walls were either of carved wood or plaster, painted
in gay colours. The interior of the zenana I could not see while in the
reception-room, but from it presently appeared a bedizened
youngster, who made friends at once. The sound of whispers behind
the purdah came clearly enough into the room; and I would not be
sure that we were not being examined by feminine eyes, while our
host courteously served tea in beautiful little bowls that would have
delighted a china-maniac. In an inner room, divided from the
reception-room by light wooden pillars, were carved recesses, in
which was a wealth of china: teapots from Russia, howls from
Kashgar and China, and others of a nondescript kind, covered with
richly-coloured designs in yellow, green, and chocolate, the three
colours most in favour among Cabulis.
Our visit was a short one, but as the master of the house led the
way to the door, I lingered behind, and was rewarded by a glimpse
into the zenana. It differed but little in appearance from the other
room; the carpets were guiltless of any linen-cover, the walls were
more brilliantly painted, cushions and pillows were scattered about,
and the three inmates were on tiptoe of expectation as we passed.
Two faces I saw; one old and wrinkled, the other young and
pleasing. “An old wife and a younger rival” was the conclusion I
arrived at, and their dress bore out this idea. The elder wore nothing
but pure white; the younger was gorgeous in green and crimson silk.
Just a glance, and it was over: the child I have mentioned was being
caressed by the third wife, whose back was towards her
companions, and another child was lying asleep among the pillows.
But for the presence of the children, it would have seemed dulness
personified, as signs of occupation or amusement there were none.
So much for the bit of quiet home life in Cabul: how monotonous it
must be, none can tell, except, perhaps, those who have to endure
it!
The dress of the Afghan women, especially those whose husbands
have rank or wealth, is extremely picturesque. A short, tightly-fitting
bodice of green, blue, or crimson silk, confines the bust, but buttons
so closely up to the throat, that one can only guess at the
proportions of shoulders and bosom. The bodice is generally
embroidered with gold, and then becomes so stiff and unyielding,
that it is virtually a corset. In this cold weather the short arms of this
sari are continued down to the wrist, and the vest itself is padded
with wool for the sake of warmth. Trousers à la Turc, baggy and
flowing as Fatima’s, and tightly fastened at the ankles with gold or
silver bands, a broad silk kummerbund of almost endless length
about the waist, with the ends so disposed that they become skirts;
dainty white socks and a tiny slipper or shoe, gold-embroidered—
such is the indoor dress of a Cabuli lady; while covering and hiding
all save feet and ankles is the voluminous white garment drawn over
the head and face, and falling to the heels. These veiled beauties
wear jewellery alike about the forehead, hands, wrists, arms, ankles,
and ears; while handsome gold loops secure the yashmak at the
back of the head; the hair being drawn from the forehead and tied
tightly into a knot, Grecian fashion. The length of a silk
kummerbund, which encircles a lady’s waist, is sometimes
astonishing: one I saw must have been 12 yards long by 18 inches
broad, and the end was even then not forthcoming. The slippers and
shoes are of Cabuli make, and are very pretty. On a pale green
ground beautiful patterns are worked with gold and silver thread and
particoloured silk, until the effect is more like that of a fairy slipper
than one for daily use. When a stout leathern sole is put on with
high heels rudely bound with iron, the work of art is complete. The
stalls in which these slippers and shoes are made are the gayest in
the whole bazaar. A Cabuli lady’s foot is small, almost to deformity,
and the baggy trousers by contrast make them appear exceedingly
petite.
From the few faces seen, being chiefly those of old or passée
women, it is difficult to judge of the famed beauty which the Cabulis
are said to boast. The children are certainly, as a whole, the prettiest
I have ever seen. Their complexions are red and white, with a tinge
of olive pervading the skin, eyes black and lustrous, well-shaped
features, teeth to make a Western beauty envious, and bright,
intelligent looks, that sadly belie the race to which they belong. Their
mothers must be beautiful, for their fathers are generally villanous-
looking: the men losing all the pleasing traits which they possessed
as boys. The lady I have described as seen in the zenana for a
moment was certainly handsome, and was far lighter in complexion
than a Spaniard; her eyes were really worthy of the praises sung by
Hafiz, but the sensuous lips were a little too full and pouting. It was
just such a face as one imagines in a harem, and would be in
keeping with the langourous life of a voluptuary, to whom sensuality
is a guiding star. Such faces always lack character, and would soon
prove insipid in the eyes of the West. The Cabuli lady, when
journeying, is either carried in an elaborate wicker-work cage
covered with the inevitable flowing linen, or rides, Amazon-fashion,
on a pony behind her lord. At times she is coquettish enough to
throw warm glances at Kafirs, behind her husband’s back, and is no
doubt delighted at the admiration bestowed upon her daintily-
slippered feet.
What the mission in life is of such women, in such a country as
this, may be summed up in a few words. She must play the part of a
mother, rather than a wife, for her sympathies go all with the
children left to be brought up in the zenana, and not with their
father, whose course lies in different lines in the busy scheming
world outside. That some women of strong character occasionally
share their husband’s ambition, and aid him by advice and
suggestions, is quite true. The mother and wife of Yakub Khan are
both women of exceptional ability, influencing and guiding men, and
well versed in state intrigues. But the exceptions are few, and only
prove the general rule obtaining in all Mahomedan countries, that
woman is a cypher outside the four walls of the zenana.
The life of her master is a most difficult subject. To fathom the
motives of an Afghan, or to explain his actions, would be a task for a
Machiavelli, and I must deal with it in such manner as I can. It has
always been held that the distinguishing features of a Cabuli are
turbulence and treachery, and late events have only confirmed men
in this belief. The arrangement of the city into quarters, each
securely shut off from its neighbours by strong walls and fortified
gateways, the part played by the Bala Hissar as a citadel dominating
the tower below, and affording a refuge for the sovereign during
bloody émeutes, proved to travellers in past days that the life of the
populace was far from a peaceful one. Even now, though the old
subdivisions of the city exist but in name,—except the Kizilbash
quarter, which has still the means of cutting itself off from outside by
strong gateways,—it is apparent that the Amirs never trusted their
lives and property to the tender mercies of their citizen-subjects.
When our army arrived at Cabul, the Bala Hissar was still a fortress
capable of resisting successfully any attack made without artillery,
and within its walls were the palace of the Amir, his harem, and his
arsenal. Our Envoy, too, was lodged in the fortress, as the fanaticism
of the Cabulis might have prompted an attack upon the Residency, if
it had been in the heart of the city, with its bazaars re-echoing to the
prayers of the moollahs and the cries of fakirs. That safety was not
found even in the Bala Hissar, was due rather to the weakness of
Yakub Khan and his contemptuous treatment of an exasperated
soldiery than to any independent action of the populace. It is true
that the city rabble joined in the attack upon the Embassy, but that
was only when military discipline was at an end, and the men who
should have guarded the lives of the Amir’s guests were in the full
cry of mutiny. Again, the building of Sherpur, with its range of
barracks and new fortress upon Bemaru (planned, but never
executed) was due to Shere Ali’s dread of Cabul and its armed mob.
With the Bala Hissar on one side and Sherpur on the other, he was
sanguine enough to hope for peace and quietness in his capital; and
these he would no doubt have secured if he had not foolishly
quarrelled with the Indian Government, whose subsidy gave him the
wherewithal to raise and equip a large army and rear the walls of his
new fortress.
Every Afghan is a soldier, and the Cabulis are no exception to the
rule. Their stalls are to them what homesteads are to the mountain
tribes and peasants; and when extortion or taxation grows in their
opinion excessive, they are ready to turn out armed to the teeth,
and by open menace to intimidate their rulers. A tyrant alone can
hope to keep them in due subjection; and, as a rule, Cabul has been
under the influence of tyranny for many centuries. As a natural
result, when turbulence occasionally subsides, treachery flourishes;
and the history of the city is full of instances of treacherous plots,
and successful if bloody intrigues. Coming as we have done in the
guise of an avenging army, we have greatly modified the normal
appearance of things in the city, our proclamation forbidding the
carrying of arms having destroyed the picturesque ruffianism which
used to stalk through the bazaars armed with gun, shield, and knife,
and ready for all emergencies. Not a weapon now is seen except in
an armourer’s shop, or on the person of some armed retainer of a
Sirdar who has thrown in his lot with the British. It is a change for
the better in our eyes; but when the people see our soldiers passing
along with Martini or Snider slung over the shoulder, they must long
to ruffle it again, and bring out from their hiding-places their own
rifles and matchlocks. But it is not to be yet; though, when we again
leave this “God-governed country” to its own devices, the good
people of Cabul will once more be able to resume their old habits.
The influential citizens of Cabul are broadly divisible into two
representative classes—the Sirdar and the trader; and in taking one
from each of these sections, I shall be able fairly to sketch the
general life led by the more orderly of the Cabulis. There are, of
course, a mass of men: artizans, street-hawkers, retainers, and
hangers-on generally, who furnish the rabble which has often made
mob-law supreme within the walls; but these may be left to
themselves for a little. The Sirdar has always been a prominent
figure in Afghan history; he is to all intents a feudal chief, and
answers very much to the Baron who, in the Dark Ages, had so
much to say in the government of Western countries. He is generally
of royal blood, a cousin (some twenty times removed) of the Amir;
but this relationship with the sovereign is not advantageous if the
Sirdar is at all ambitious of power. There are so many revolutions of
the wheel in the Barakzai dynasty, that the assumption of dignity by
a subordinate is always jealously watched by the Amir, and promptly
nipped in the bud just when it bids fair to become dangerous. Ties
of kin are but little regarded in a country where continually father is
arrayed against son, brother against brother; and where human life
is held so cheaply that scarcely a man reaches middle age without
having blood upon his hands. The Sirdar has either to muzzle his
ambition and wait patiently for a chance of suddenly acquiring
power; or to accept a colourless life of ease, with nothing to trouble
his mind except the caprices of a favourite slave-girl, or the loss of a
valuable horse. It is not surprising, then, that in Cabul there are
Sirdars perfect in dissimulation and adepts in intrigue; and others
mere slaves of their sensuality, to whom the world means merely
pillaus and pillows, cakes and concubines. Such men are those loved
by Cæsar:

... “men that are fat;


Sleek-headed men, and such as sleep o’ nights.”

And the easy-going Sirdar answers so fully to this description, that


it would seem as if the cares of life sat very lightly upon him. Such
men are too characterless to repay observation; and though we see
many of them here, we pass them by contemptuously, except when
a mountain of flesh more than usually formidable looms upon us in
cantonments. They are not men given to fighting or political
intrigue; and such as we have now among us are anxious only as to
their allowances which the “Great British Government” guarantees to
them while they are faithful to its interests. If they are time-servers,
it is simply because they have no idea beyond the present one of
comfort and quietness; if we were defeated they would probably
make their obeisance to the new rulers, and would settle down
calmly to their daily enjoyment of the fat of the land in their well-
stocked harems. There were such men among our own hard-headed
Barons ages ago, who watched their more ambitious compeers make
and ruin dynasties, and lived placidly through all the turmoil without
even being partisans.
But the other type of Sirdar is a very different person: he holds
that to be powerful is the salt of life, and his aim from youth to old
age is to seek power in all its forms. He is generally rich and a lover
of show; valuing money for the advantage to which it can be turned
in many ways, and estimating pomp at its real worth—to impress the
ignorant and humiliate the inferior. His life as now made up is not to
outward seeming one of much importance, but not one of us can
hope to penetrate beneath its surface, and examine the many
schemes which pass through his mind. He lives in one of the large,
high-walled houses which are studded about the city, though he has
a “villa” or two in pleasant Koh-Daman, or one of the near valleys. If
one visits him, the courtesy with which he receives a guest is that of
a polished gentleman, flavoured, perhaps too highly, with the
Eastern affectation of humility. His house is reached through byways
and along covered-in streets, so dark and noisome that one expects
to meet a ghazi at every turn. But all is quiet, and finally a bit of
blue sky is seen overhead, a narrow doorway is passed through, and
the square courtyard of the house gained. A few horses, saddled and
bridled, are standing in a sunny corner; a dozen picturesque-looking
ruffians are lounging about; the great man is at home. We find him
in a long room squatting on an ottoman with a dozen friends and
associates about him, to whom he has doubtless been expounding
some new and brilliant idea that has occurred to him. He is politely
anxious about his visitor’s health, thanking God that it is well with
him, and inquires if “the General” also is well. His conversation is
guarded, but he makes up for his reticence by his hospitality: it
would be derogatory to his dignity if the rite were not duly
honoured; and in a few minutes trays bearing little cups of
sweetened tea, sweetmeats, nuts and grapes, are being handed
round by two or three of the loungers we passed in the courtyard.
This tea is a mystery to me; it is always ready; it is always good, and
one can sip cup after cup with an enjoyment that positively
increases with indulgence. The Sirdar’s friends are mostly notable
men: that grey-bearded old gentleman on his right is a tribal chief of
some importance, who has come from his distant village to see how
things move in Cabul after the late jehad; that dark-visaged man is a
Bokhara trader, whose mind holds news of the White Czar and of the
changing fates of the Central Asian Khanates; while his counterpart
is another trader returned from Hindustan, where he has, perhaps,
seen and learnt much that may shape the Sirdar’s views in future.
Behind the Sirdar is a richly embroidered purdah veiling the entrance
to the zenana, wherein the quiet life of the women slowly moves.
Our conversation is short and purely ornamental, and we take our
leave, pleasantly impressed with the courtesy shown, but pondering
over the depth of Afghan duplicity which is so cunningly hidden. The
Sirdar passes his morning among his friends, and in the afternoon
he will probably visit General Roberts or Major Hastings, the Chief
Political Officer, to learn much, but to impart little. How far he can be
trusted no one knows, not excepting even himself. If by serving us
he can make his position secure, he will “sell” his nearest friends; if
he thinks his interests are safe with men opposing us, he will thwart
our projects with all the skill he possesses. His life now is not so
restless as in old days, as our army has broken up all settled
government, and the prospect is so hazy, that to dabble too openly
in dangerous schemes might land him in distant Calcutta, to bear
Daoud Shah company. Our Sirdar has lakhs of money hidden away in
his house or buried in some secret spot; but he is cunning enough to
swear that he lost greatly when Mahomed Jan held Cabul, and asks
the British Government to recoup him, as he has always been
faithful to its interests. The new influences at work upon his life are
not so welcome to him, as they are novel and not to be easily
understood; and he would far prefer the old order of things, when
he could pit himself against some rival and gain his ends by crooked
ways that he knows we should not countenance. If his chances just
now of being shot or stabbed are not so great as formerly, he does
not, with his fatalistic ideas, appreciate the change; and at times he
grows sullen, and is discontented with our temporary rule.
The trader is a very different personage: he has seen men and
cities, and his chief aim is to amass wealth, which he believes to be
the keystone of happiness. His vocation now in Cabul is to make
fabulous profits out of the British army of occupation which has
invaded the sanctity of the city, and cowed its fanatical populace. In
his heart of hearts the trader hates us sincerely; but he will endure
curses from the Commissariat, or hard words from under-strappers,
for the sake of the few lakhs of rupees he hopes to pocket. He will
take contracts for anything, from sheep to charpoys, and will fleece
everyone dealing with him with such calm self-assurance, that one is
inclined to adopt, once for all, the theory that the Afghans are,
indeed, the lost tribes of Israel. He is a power in the city, for he has
money always at his command; and though he may have suffered
grievously from extortion, he is shrewd enough to know that
complaints are useless. He will visit our friend the Sirdar, and will
gain his countenance and help in some nefarious transaction,
perhaps such as “bearing” the money market, cutting off our sheep
supply, or raising the prices of articles suddenly in demand. He may
play the part of political spy in return for the Sirdar’s help, or
become a principal in some scheme that requires delicate working.
The trader has his house, which also serves as a store-house for his
goods, in some filthy corner of Cabul; and some near relative acts as
a partner, and does the dirty work of retailing his goods from a
narrow stall in the bazaar. Should a big transaction be coming off,
with some merchant from the Khanates, in silks, furs, or precious
stones, the trader has the universal tea-drinking, to which he invites
the stranger, and he spends days in ceaseless chafering until the
prices are duly fixed and the bargain concluded. In the bazaar itself
but little trade on a large scale is carried on, the travelling merchants
storing their goods in one or other of the large serais, while they let
it be known from stall to stall that they have merchandise on sale.
The trader is naturally of a peaceable disposition, and as his house is
usually stored with rich goods, and his hoards of money are buried
beneath the ground in his courtyard, he dreads an outbreak by the
populace, who may levy contributions upon his effects. But he has
within him the Afghan instinct of sturdy resistance to all assailants.
With his iron-studded door closed against intruders, with half a
dozen servants armed à la Cabul with gun pistol, and knife, he is no

You might also like