Change to Ultrasonic behaviour

Dev Version only

My ultrasonic handling code now runs in its own separate thread and defaults to returning an update distance measurement every 1 sec.

This can be change by creating an UltraDelay variable and using

set UltraDelay to xxx

If xxx = 0 then it will run as fast as possible which is currently about 5 times/sec or equivalent to xxx =0.2

 

You can also use

Broadcast UltraDelayxxx

if you prefer

Raspberry Pi SID testing using LAN->Laptop cable

Today I took my 6 Pi into one of my schools and connected them up to the school Win7 Pro laptops using a direct CAT5 cable and powered them from USB charger batteries.

They all performed fine technically and it was a great success (if I say so myself) 🙂

[I could only get 5 to work in the lesson as the last SD card imaging took over and hour instead of the usual 15 mins but that’s a separate issue ]

By connecting them direct to laptops via cat5 cable means they didn’t need WiFi adaptors and therefore no configuring of the laptop was needed.

This is because I used this post to set up the Pi to automatically try and use an IP addressing the same range that Windows machines default to (169.254.0.0 to 169.254.255.255).

The reason for doing it this way is that I only have 1 school left with pupil desktop machines – all the rest use laptops/net-books/IPads so there is no chance of plugin any Pi into any monitors/main network ports.

The Pi are also set up to be SIDs  and therefore for the pupils to get controlling the addon boards plugged into them (mixture of PiDie,Pibrella,PiStep and Ladderboards) all they had to do was run the Handshake.py program (which I’ve wrapped up into a windows .exe file), saved it to a network folder and stuck a shortcut toit on the desktop.

Once they’d handshaked with SID running on their Pi, They simply loaded their normal Windows Scratch 1.4 and loaded in a basic script to switch all the LEDs off and On to test that everythgin was working.

From the start of a 1 hours lesson (and considering this was the first time we’d done it) 3 out of the 5 groups (only a 15 intake class luckily) had got a full Traffic Light –  Green/Amber/Red/Red and Amber/Green sequence going.

Lessons Learnt

All the AddOns responded to LED1..n On/Off commands except for the PiStep (as its normally used as a stepper) and that group needed to use Pin11,12 and 13 and it meant separate instructions for them so better to make sure all boards can respond to same commands of make sure individual help-sheets for each board are printed out.

Once group didn’t push their CAT5 cable in until it clicked (obviously as a tech I knew this and didn’t bother telling them – so I’ll make sure that’s in the instructions next time)

Also, I’m going to make a tick sheet of plug in sequence just to make sure its all done in a good order.

Laptop on and logged in, cat 4 plugged into laptop,cat 5 into Pi, power lead into Pi (this is the fiddly bit they found) and then power lead into battery supply.

 

LMC Emulator in Scratch

Updated 14May14 to combine instruction and data in one array value

There is a basic microprocessor concept called the LMC http://www.yorku.ca/sychen/research/LMC/ which introduces the concepts of basic assembly language programming using only 10 instructions.

I’ve made a Scratch version that is a working copy of the simulator.

The way to use it is to enter your instructions into the list called Memory and then press the run button.

The main difference between this version and the original LMC is in he entering of pure data.  To just enter a number into memory you would use:

DAT23

The LMC computer will then ignore the DAT instruction and move the program counter to the next instruction

The INP instruction will pause and let you enter a value into accumulator.

The OUT instruction will cause the cat to say the value of the accumulator

All other LMC instructions (LDA,STA,ADD,SUB,BRA,BRZ,BRP and HLT ) should work the same as the original simulator.

The simulator is available here

Any feedback greatly appreciated 🙂