JohnCrow
Posts: 25
Joined: Fri May 25, 2012 5:28 pm
Location: Lincolnshire

Software

Fri Oct 19, 2012 11:55 am

Hi Gert
The user guide says the test programs will also be available in Python.
Any idea when these will be ready?
Thanks
John
1 in 10 people understand binary, the other one doesn't

User avatar
Gert van Loo
Posts: 2487
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: Software

Fri Oct 19, 2012 1:04 pm

No,
I have not had time also because I first have to learn Python.
I think this is a good place where the Raspberry-Pi community could give a helping hand.

JohnCrow
Posts: 25
Joined: Fri May 25, 2012 5:28 pm
Location: Lincolnshire

Re: Software

Fri Oct 19, 2012 5:23 pm

Hopefully I will get my board assembled over the weekend.
Like you Ive been learning Python over the last couple of months, although my C is very rusty, Ill see if I can rewrite some of your programs in Python and post them here if you have no objections.
1 in 10 people understand binary, the other one doesn't

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Software

Mon Oct 22, 2012 4:43 pm

I,ll get you started. Wiringpi for python is my chosen method.

Code: Select all

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Gertboard LED checker
# v1.00
# 22/10/12

import time
import wiringpi

ON = 1
OFF = 0

#gpio's :

LED1  = 6  # gpio pin 25
LED2  = 5  # gpio pin 24
LED3  = 4  # gpio pin 23
LED4  = 3  # gpio pin 22
LED5  = 2  # gpio pin 21
LED6  = 1  # gpio pin 18
LED7  = 0  # gpio pin 17
LED8  = 14  # gpio pin 11
LED9  = 12  # gpio pin 10
LED10  = 13  # gpio pin 9
LED11  = 10  # gpio pin 8
LED12  = 11  # gpio pin 7


def setup():
  # Set pin directions, ON = Output.
  wiringpi.wiringPiSetup()
  for pin in [LED1, LED2, LED3, LED4, LED5, LED6, LED7, LED8, LED9, LED10, LED11, LED12]:
    wiringpi.pinMode(pin, ON)


def main():
  print 'Gertboard LED tester'
  setup()
  for pin in [LED1, LED2, LED3, LED4, LED5, LED6, LED7, LED8, LED9, LED10, LED11, LED12]:
    wiringpi.digitalWrite(pin, ON)
    time.sleep(0.2)
  for pin in [LED1, LED2, LED3, LED4, LED5, LED6, LED7, LED8, LED9, LED10, LED11, LED12]:
    wiringpi.digitalWrite(pin, OFF)
    time.sleep(0.2)

  for pin in [LED1, LED2, LED3, LED4, LED5, LED6, LED7, LED8, LED9, LED10, LED11, LED12]:
    wiringpi.digitalWrite(pin, ON)
    time.sleep(0.3)
    wiringpi.digitalWrite(pin, OFF)
    time.sleep(0.1)

if __name__ == '__main__':
  main()
Note the gertboard needs wiring as per the manual for checking the LED's.
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
wallarug
Posts: 460
Joined: Mon May 14, 2012 8:21 am
Location: Sydney, Australia

Re: Software

Mon Oct 29, 2012 9:11 am

I might be able to help in this area in a few weeks. I am very busy now.

Return to “HATs and other add-ons”