CAS Educational Manual: errata

Share and discuss resources for use in the classroom

14 posts
by clive » Thu Jan 03, 2013 11:29 am
Please post errors and omissions etc here.

Be clear and concise and refer to page numbers and paragraphs. Make specific suggestions for change, not just say something is wrong or missing. E.g. "P23, para 2, 1st sentence: "welcomoe" should be "welcome".

This thread is for errata only - see the sticky "How to contribute" for general comments and discussion, and individual threads for translations.
User avatar
Posts: 463
Joined: Tue Feb 07, 2012 8:19 pm
by hppnq » Thu Jan 03, 2013 12:12 pm
Page 7, paragraph 1, sentence 1: "Scratch is visual programming environment" should be "Scratch is a visual programming environment".
Posts: 1
Joined: Thu Jan 03, 2013 11:59 am
by croston » Thu Jan 03, 2013 5:15 pm
I am the author of the 'Interfacing' chapter. I wrote this back in Mar/Apr 2012 which was an eternity ago in RPi terms. Since then the distro of choice has changed from Debian Squeeze to Raspbian. Raspbian did not even exist then! There is also the appearance of Revision 2 boards with different pin-outs for the GPIO. I wrote this within a week of getting hold of my first RPi! The RPi.GPIO Python module (of which I am also the author) has changed a little too.
Sorry for these changes being too late to make it into version 1 of the guide. I did submit them before it was published!

GPIO Board pins (Page 130)
The table is for a revision 1 board. For revision 2 board change:
Board pin 0-->2
Board pin 1-->3
Board pin 21-->27

I2C table change:
Code: Select all
Board pin    BCM GPIO number    Function    Description
3*           0-->2              SDA1        Data
5*           1-->3              SCL1        Clock


LED circuit (Page 131)
Should be a 220 ohm resistor, not a 1K resistor.
RPi.GPIO python module is now installed by default in Raspbian - no need to download
New version of RPi.GPIO so code should now be:
Code: Select all
import RPi.GPIO as GPIO

# specify board pin numbering convention
GPIO.setmode(GPIO.BOARD)

# set up pin 11 to output
GPIO.setup(11, GPIO.OUT)

state = False
while 1:
    GPIO.output(11, state)
    command = input("Press return to switch the LED on/off or 'Q' to quit: ")
    if command.strip().upper().startswith('Q'):
        break
    state = not state

GPIO.cleanup()


Push-button circuit (Page 132)
Code: Select all
import threading
import time
import RPi.GPIO as GPIO

class Button(threading.Thread):
    """A thread that monitors a GPIO button"""

    def __init__(self, channel):
        threading.Thread.__init__(self)
        self._pressed = False
        self.channel = channel

        # set up pin as input
        GPIO.setup(self.channel, GPIO.IN)

        # terminate this thread when main program finishes
        self.daemon = True

        # start thread running
        self.start()

    def pressed(self):
        if self._pressed:
            # clear the pressed flag now we have detected it
            self._pressed = False
            return True
        else:
            return False

    def run(self):
        previous = None
        while 1:
            # read GPIO channel
            current = GPIO.input(self.channel)
            time.sleep(0.01) # wait 10 ms

            # detect change from 1 to 0 (a button press)
            if previous == True and current == False:
                self._pressed = True

                # wait for flag to be cleared
                while self._pressed:
                    time.sleep(0.05) # wait 50 ms

            previous = current

def onButtonPress():
    print('Button has been pressed!')

# specify board pin numbering convention
GPIO.setmode(GPIO.BOARD)

# create a button thread for a button on pin 11
button = Button(11)

while True:
    # ask for a name and say hello
    name = input('Enter a name (or Q to quit): ')
    if name.upper() == 'Q':
        break
    print('Hello', name)

    # check if button has been pressed in the meantime
    if button.pressed():
        onButtonPress()

GPIO.cleanup()


Arduino interface (Page 134)
The Python modules are available in Raspbian, no need to manually download and install them from a website!
Code: Select all
sudo apt-get install python3-serial
sudo apt-get install arduino
User avatar
Posts: 420
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
by time » Fri Jan 04, 2013 7:39 am
Page 25, Section "Inputting the numbers" states that the teacher has set you four sums and then cite the four sums, however, there is only one "sum" followed by one difference, one product and one division problem. This is probably a small thing, but if we're going to be using this to educate children, it is probably best to avoid these kind of incorrect labels on conceptual matters.

Thanks for the awesome tool! I plan to use this with a group of 8-13 year olds who've been learning Scratch in our schools 4H program.

Best regards,
Tim
Posts: 1
Joined: Fri Jan 04, 2013 7:33 am
by recantha2 » Fri Jan 04, 2013 10:53 am
Page 5 (introduction) last paragraph
You may finish this manual and decide you want to be next Tim Berners Lee
should read
You may finish this manual and decide you want to be **the** next Tim Berners**-**Lee
--
Michael Horne - @recantha
Pi blog - http://www.recantha.co.uk/blog

Cambridge Raspberry Jam
Website: http://camjam.me
Facebook: https://www.facebook.com/cambridgeraspberryjam
Follow the Cambridge Raspberry Jam on Twitter - @cambridgejam
Posts: 184
Joined: Wed Nov 14, 2012 9:34 am
by clive » Fri Jan 04, 2013 12:27 pm
Page 155, Where it says;

The horizontal line “|” is used to denote “or”.

Horizontal should say Vertical.

[thanks Brian!]
User avatar
Posts: 463
Joined: Tue Feb 07, 2012 8:19 pm
by keybeeper » Sun Jan 06, 2013 12:23 pm
Above page numbers 76 and 77: The footer should be 'Experiments in Python', not 'A beginner's guide to Scratch'

Page 80, next-to-last paragraph: should say 'different from' not 'different to'

Page 83, 'Bits and bytes' section, paragraph one: 'from the right the numbers are units...' should be something like 'from the right the digits represent how many units...' also 'the right-most numbers is a unit...' should be something like 'from the right the digits represent how many units...'

Page 83, 'Bits and bytes' section, paragraph two: (electrically, “on” or “off”; logically, “true” or “false”) should be (electrically, “off” or “on”; logically, “false” or “true”)

Page 89, last paragraph: 'data is stored' should be 'data are stored'

Page 90, blue text box, paragraph three: 'compared to' should be 'compared with'

Page 95, line one: 'has been printed' should be 'have been printed'

page 101, paragraph three: 'races passed' should be 'races past'

Page 104, 'skiWorld' section, paragraph one: 'check if' should be 'check whether'

Page 107, line one: 'data is' should be 'data are'

Page 117, 'Over to you' section, line one: 'try and think' should be 'try to think'

Page 129, paragraph three: 'http://www.aurduino.cc' should be ' http://www.arduino.cc'

Page 172, 'Beyond online learning' section, paragraph two: 'try and improve it' should be 'try to improve it'
Page 172, 'Beyond online learning' section, paragraph two: 'try and work out' should be 'try to work out'
No Microsoft products were used in the creation of this message
Posts: 22
Joined: Wed Aug 08, 2012 10:15 am
by danpeirce » Sun Jan 06, 2013 7:02 pm
On page 73 one is directed to use Idle3 which is fine for that page but when one continues to page 74 the import pygame produces an error.
The simple solution is to exit from the python shell and this time use Idle (without the 3). Now the pygame examples work.
Note that I tried doing an upgrade on python-pygame but that made no difference.
Using the Rasbian image.
User avatar
Posts: 88
Joined: Thu May 10, 2012 8:32 am
Location: Richmond & Surrey BC Canada
by danpeirce » Tue Jan 08, 2013 3:12 pm
danpeirce wrote:On page 73 one is directed to use Idle3 which is fine for that page but when one continues to page 74 the import pygame produces an error.
The simple solution is to exit from the python shell and this time use Idle (without the 3). Now the pygame examples work.
Note that I tried doing an upgrade on python-pygame but that made no difference.
Using the Rasbian image.

Just thought I would add this cross reference
viewtopic.php?p=254499#p254499
User avatar
Posts: 88
Joined: Thu May 10, 2012 8:32 am
Location: Richmond & Surrey BC Canada
by brianjester » Sun Jan 13, 2013 5:26 am
Croston,

Thank you for the update, I was about to submit the fix for the "LED circuit", as:
Code: Select all
GPIO.setmode(GPIO.BCM)

But I'll try your snippet:
Code: Select all
GPIO.setmode(GPIO.BOARD)

Brian Jester
Brian Jester
Posts: 6
Joined: Wed Jan 09, 2013 5:51 pm
Location: Alaska
by brianjester » Sun Jan 13, 2013 6:40 am
I can only run the LED circuit Python program led.py with:
Code: Select all
sudo python3 led.py

It throws the following exception if I run it with
Code: Select all
sudo python led.py

Here's the output as soon as I hit Enter (return):
Code: Select all
Traceback (most recent call last):
  File 'led.py', line 10 in <module>
    command = input("Press return to switch the LED on/off or 'Q' to quit: ")
  File <strings>, line 0

    ^
SyntaxError: unexpected EOF while parsing
Brian Jester
Posts: 6
Joined: Wed Jan 09, 2013 5:51 pm
Location: Alaska
by pbhj » Tue Jan 29, 2013 9:43 pm
I'm not working on the project in any way (don't have a rpi board) but it seems perverse to be using a forum thread to post errata in this way.

Why isn't the manual in Latex or PostScript or similar (human readable 'markup') with a github-like repo so people can issue pull requests for alterations, typos and such. You could still do the images in InDesign if you needed too. Then a bleeding edge manual could be maintained with just a little scripting (/bin/make I expect).

I've got to admit I thought you'd be using Scribus/Inkscape/Sk1/GIMP et cetera - FOSS in other words - for crowd supported publications.

Sorry if this is too meta or OT.
Posts: 2
Joined: Tue Jan 29, 2013 8:20 pm
by keybeeper » Wed Jan 30, 2013 8:22 pm
I agree entirely with pbhj. It seems as if this document was written several months ago in the early days of the R-Pi and either forgotten about or put on the back burner. It doesn't seem to get much publicity but deserves to be more widely known. Something like this should be included with the Rasbian download.
No Microsoft products were used in the creation of this message
Posts: 22
Joined: Wed Aug 08, 2012 10:15 am
by rastacalavera » Thu Feb 14, 2013 3:59 pm
Hello!

I saw a post about IDLE 3 and import pygame error so I won't mention that bit again but will move on to some other errors I came across as I worked through the python module.

First, there should be something about how to change the keyboard layout to USA style for those of us across the pond (I have experience with a European keyboard so it wasn't too much of a hassle to adapt to # and " but i know others would quite in frustration)

On page 65 it says that you can type Alt-F2 and use "LXTerminal" to bring up a terminal. I had to do everything lowercase to get it to perform properly "lxterminal"

Also, I got my image of Wheezy from the Raspberry Pi page and it did not have Python 3.2.2, not that it really matters but you should mention how this could be different so that users don't freak out.

On page 66, when running python factors.py I keep getting a Syntax error for line 3 for print(nunmber, end=" : ") and have no idea why.....

On page 67 for the mastermind game the code does not give the player a chance to guess again but instead gives the answer. There should be a modification before the print("You got the answer : ", secret) line

On page 70 for Roman Numerals, it never really gave a correct answer...if I wanted 45 if would simply print XL instead of XLV or for 4000 it would only print M instead of MMMM. I think I am correct in my logic (new to programming) that this is incorrect output for the query. Also, upon entering a number, after an output is given, the user cannot ask it again, the program seems to terminate and return to a python promt.

On page 73 for the movie sort on line with open ("filmlist", "r") as file: the filmlist should be filmlist.py otherwise it will read that there is no such file or directory.

These are issues that I have found so far in the python section. It would be nice to have some "practice" problems where you ask the user to try something (like to sort by date and then alphabetical order) on their own and then provide a solution somewhere else to the task. This would be more helpful than simply saying "ok now try some tweaks" because it gives them a goal and there is a reference incase they get stuck and frustrated.

Thanks for the hard work and keep it up!

Cheers
Posts: 1
Joined: Thu Feb 14, 2013 3:37 pm