Page 24

 

Create a folder on the local machine to act as the top level project folder – all of your C projects will be stored in sub-folders of this one. Within your top-level folder, create a folder called .json and create a custom settings.json file. This contains the details of the remote machine and the folders you want to use on the remote:

change .json to:.vscode

Create a folder on the local machine to act as the top level project folder – all of your C projects will be stored in sub-folders of this one. Within your top-level folder, create a folder called .vscode if you need to, and create a custom settings.json file. This contains the details of the remote machine and the folders you want to use on the remote:

Page 132

 

The number of different duty cycles you can achieve depends on the number of clock pulses in the total period. At 10MHz there are just two clock pulses and so just four duty cycles 0%, 50% and 100%.

change four to three

The number of different duty cycles you can achieve depends on the number of clock pulses in the total period. At 10MHz there are just two clock pulses and so just three duty cycles 0%, 50% and 100%.

The table on this page should read:

PWM Frequency

Number of clock pulses

Number of different duty cycles

Resolution in bits

10MHz

2

3

1.6

5MHz

4

5

2.3

2.5MHz

8

9

3.2

1.25MHz

16

17

4.1

625kHz

32

33

5.0

312.5kHz

64

65

6.0

156.25kHz

128

129

7.0

nkHz

20000/n

20000/n - 1

Log2(20000/n -1)

In many applications 8-bit resolution for the duty cycle is considered the minimum acceptable and this sets the highest frequency to about 75kHz, which is high enough for most things.

For example, if you want to control a servo motor, see later, then you need a PWM signal with a frequency of 50Hz and at this frequency you can specify the duty cycle down to about 25 bits or around 40 million increments – more than enough for any real servo motor.

 

 

Page 148

The number of SPI buses a Raspberry Pi has depends on its model. The PiZero and Pi 3 have three SPI devices, but only SP0 and SP1 are available on the GPIO connector:

change SP0 and SP1 to SPI0 and SPI1 

The number of SPI buses a Raspberry Pi has depends on its model. The PiZero and Pi 3 have three SPI devices, but only SPI0 and SPI1 are available on the GPIO connector:

Page 153

First connect pin 19 to pin 20 using a jumper wire and start a new project. The program is very simple. First we check that the SPI bus is loaded:

change 20 to 21

First connect pin 19 to pin 21 using a jumper wire and start a new project. The program is very simple. First we check that the SPI bus is loaded:

Page 242

Change

struct sockaddr_nl sa;
sa.nl_family = AF_NETLINK;
sa.nl_pid = getpid();
sa.nl_groups = 0;

change sa.nl_pid = getpid();  to sa.nl_pid = 0;

struct sockaddr_nl sa;
sa.nl_family = AF_NETLINK;
sa.nl_pid = 0;
sa.nl_groups = 0;

WIthout this change the program doesn't work but returns no error

Page 248 (Same error as page 242)

Change

struct sockaddr_nl sa;
sa.nl_family = AF_NETLINK;
sa.nl_pid = getpid();
sa.nl_groups = 0;

change sa.nl_pid = getpid();  to sa.nl_pid = 0;

struct sockaddr_nl sa;
sa.nl_family = AF_NETLINK;
sa.nl_pid = 0;
sa.nl_groups = 0;