Shop OBEX P1 Docs P2 Docs Learn Events
P1<--Raspberry Pi - Page 2 — Parallax Forums

P1<--Raspberry Pi

2»

Comments

  • RsadeikaRsadeika Posts: 3,837
    edited 2013-12-31 05:52
    Below I thought I would show the small Python program that would access the Activity Board. Once you develop the support programs in Python and PropGCC, everything else is very easy.

    It seems like gaining access to the Propeller via the RPi is relatively easy, but it is limited to what the Propeller Board has to offer. For example, if you were to use a GG PPUSB board, basically you have access to 32 bare pins. With an Activity Board you get more stuff that you can play with, as long as you have the drivers for the items.

    I have been giving the use of COGs some more thought, which will be a difficult concept to deal with, and how to use it in Python, maybe threads. Maybe have a COG that is part of a Python thread, I know that would be an interesting coding challenge on the PropGCC side. But it seems like the most logical way of gaining use of the possible seven COGs that are available.

    Happy New Year Everybody

    Ray
    #!/usr/bin/env python3
    # sbrds_IO.py
    
    #import RPi.GPIO as GPIO
    import Prop1_IO  # Need to have an Activity Board .../ttyUSB0.
    import extgpio   # Need connection to GPIO.
    
    # Setup for GPIO usage
    extgpio.setboard()
    
    # Setup GPIO pin(s)
    extgpio.pinout(11)
    
    def menu():
    	print("Menu - help, quit, onLED1, offLED1")
    	print("       onLED26, offLED26, onLED27, offLED27")
    	
    
    print("Type help")
    
    while True:
    	reply = input('>')
    	if reply == 'quit': break
    	if reply == 'onLED1':
    		extgpio.high(11)
    	if reply == 'offLED1':
    		extgpio.low(11)
    	if reply == 'onLED26':  # Activity Board
    		Prop1_IO.high(26)
    	if reply == 'offLED26': # Activity Board
    		Prop1_IO.low(26)
    	if reply == 'onLED27':  # Activity Board
    		Prop1_IO.high(27)
    	if reply == 'offLED27': # Activity Board
    		Prop1_IO.low(27)
    	if reply == 'help':
    		menu()
    	
    print("GoodBye")
    Prop1_IO.closeP1()
    extgpio.clean()
    
    
Sign In or Register to comment.