A keyboard without function!


The great escape!


The day I lost control!

Controlling a 7 segment 4 digit display with a Raspberry Pi

http://www.instructables.com/id/Controlling-a-7-segment-4-digit-display-with-a-Ras/
http://www.raspberrypi.org/forums/viewtopic.php?f=37&t=91796
This instructable I made shows how to control a display.
Here is how:
Wiring:
The pins are connected to the Pi through a resistor and some directly.
See the diagram for details and pin positionnement above.



The python modules; time and RPI.GPIO are required for this code.





Code:

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(7, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
segments = (24,12,19,21,23,22,15,11)
for segment in segments:
GPIO.setup(segment, GPIO.OUT)
GPIO.output(segment, 0)
digits = (26,18,16,13)
for digit in digits:
GPIO.setup(digit, GPIO.OUT)
GPIO.output(digit, 1)
num = {' ':(0,0,0,0,0,0,0),
'0':(1,1,1,1,1,1,0),
'1':(0,1,1,0,0,0,0),
'2':(1,1,0,1,1,0,1),
'3':(1,1,1,1,0,0,1),
'4':(0,1,1,0,0,1,1),
'5':(1,0,1,1,0,1,1),
'6':(1,0,1,1,1,1,1),
'7':(1,1,1,0,0,0,0),
'8':(1,1,1,1,1,1,1),
'9':(1,1,1,1,0,1,1)}
try:
while True:
n = time.ctime()[11:13]+time.ctime()[14:16]
s = str(n).rjust(4)
for digit in range(4):
for loop in range(0,7):
GPIO.output(segments[loop], num[s[digit]][loop])
if (int(time.ctime()[18:19])%2 == 0) and (digit == 1)
GPIO.output(11, 1)
else:
GPIO.output(11, 0)
GPIO.output(digits[digit], 0)
time.sleep(0.001)
GPIO.output(digits[digit], 1)
except KeyboardInterrupt:
GPIO.cleanup()

And we are done!
This will be a clock.
Have fun!

Brython

Today I came upon Brython.
Which is python on web browsers.
This is python 3.
This is similar to codeskulptor (see codeskulptor testing)
To embed a console on a page use this script:
<iframe src="http://brython.info/console.html" width=800 height=400></iframe>
I hope you enjoy this.
Here is a console:

Minecraft Pi with stepper motor...

I am trying to do a minecraft program to turn the stepper motor (http://www.techni.ca/2013/10/stepper-motor-controller.html) so that I import that module as motor and call motor.clockwise(1, 500) or motor.anticlockwise(1, 500) when you move side to side.
Maybe something like this http://www.stuffaboutcode.com/2013/03/raspberry-pi-minecraft-snake.html.
I appreciate all help :)
And one more thing... IN PYTHON.

Python in HTML

<html>

<head>
<title>Python in HTML</title>
</head>
<body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js" type="text/javascript"></script>
<script src="http://www.skulpt.org/static/skulpt.min.js" type="text/javascript"></script>
<script src="http://www.skulpt.org/static/skulpt-stdlib.js" type="text/javascript"></script>

<script type="text/javascript">
// output functions are configurable.  This one just appends some text
// to a pre element.
function outf(text) {
var mypre = document.getElementById("output");
mypre.innerHTML = mypre.innerHTML   text;
}
function builtinRead(x) {
if (Sk.builtinFiles === undefined || Sk.builtinFiles["files"][x] === undefined)
throw "File not found: '"   x   "'";
return Sk.builtinFiles["files"][x];
}

// Here's everything you need to run a python program in skulpt
// grab the code from your textarea
// get a reference to your pre element for output
// configure the output function
// call Sk.importMainWithBody()
function runit() {
var prog = document.getElementById("yourcode").value;
var mypre = document.getElementById("output");
mypre.innerHTML = '';
Sk.canvas = "mycanvas";
Sk.pre = "output";
Sk.configure({output:outf, read:builtinRead});
eval(Sk.importMainWithBody("<stdin>",false,prog));
}
</script>

<h3>Write Python!</h3>
<form>
<textarea id="yourcode" cols="40" rows="10">
#Type your code here
</textarea><br />
<button type="button" onclick="runit()">Run</button>
</form>
<pre id="output" ></pre>
<!-- If you want turtle graphics include a canvas -->
<canvas id="mycanvas" ></canvas>
</body>
</html>

Above is the code for putting python in html.
Copy-Paste this into a text edit program and save it as a .html file then oepn it in a browser.

Vote for me please

Please vote for me on instructables at this link:
http://www.instructables.com/id/Controlling-a-stepper-motor-with-the-Raspberry-Pi-/