Week 8 in ScratchPiBot Club

Previous Weeks

Eureka!  We have 2 ‘bots that can follow a line for 3 metres!

The boys managed to get theirs to do it first as myself and the girls were embarking on raising the height of their ‘bots IR Sensors as when they got too close to the ground – they gave faulty line detection results.

Once we done this (and made our turning strategy quite aggressive!) the girls ‘bot zig-zagged its way down their track as well.

Boys Code Girls Code
boys girls

So we should be ready to have a set of races next week and see who can push their ‘bot the fastest without losing its way.

As not everyone can be programming the computers at the same time, the other club members have grabbed some flip cams and started filming the runs so hopefully we will have some video to show you next week.

One thought on “Week 8 in ScratchPiBot Club

  1. Simon, if you release the SPI pins you can do ‘proper’ a to d from scratch with an mcp3002/8 chip.
    # Scratch client test program

    from array import array
    import spidev
    import time
    import os
    import RPi.GPIO as GPIO
    import eeml
    import socket

    HOST = ‘’
    PORT = 42001
    spi = spidev.SpiDev()

    def readadc(adcnum):
    r = spi.xfer2([1,(8+adcnum)<<4,0])
    got_it = ((r[1]&3) << 8) + r[2]

    return got_it

    def work_out(adcnum):
    got_it = 0
    a = 0
    while a > 24) & 0xFF))
    a.append(chr((n >> 16) & 0xFF))
    a.append(chr((n >> 8) & 0xFF))
    a.append(chr(n & 0xFF))
    scratchSock.send(a.tostring() + cmd)

    scratchSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    scratchSock.connect((HOST, PORT))
    while 1:
    i = work_out(0)
    data = scratchSock.recv(1024)
    if not data: break
    if “temperature” in data:
    sendScratchCommand(‘sensor-update temperature ‘ + str(i))

    print(“closing socket…”)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s