2

I am using a Raspberry Pi 2 Model B v1.1. I have looked at the GPIO file in /sys but I don't understand how I actually turn on/ turn off GPIO ports or I set them to read in/read out, I am trying to do a project for college using my Raspberry PI and LISP but without this knowledge I am unable to do this, this is the library that is written for NewLIsp: https://github.com/gatesphere/raspi-gpio-newlisp/blob/master/raspi-gpio.lsp Some clarification of what actually needs to be written and where it needs to be written to send out/read in values on the GPIO ports is need, any help will be greatly appreciated.

Floofk
  • 23
  • 3

2 Answers2

0

This is clearly and simply documented in the kernel docs. I will not bother to regurgitate it here.

Note that you can't use sudo with echo > because of redirection, but that does not impact what you are trying to do.

Anecdotely I'd say using if using high level stream functions doesn't work on sys/proc nodes, use lower level methods. I don't speak lisp so I don't know how relevant that is.

goldilocks
  • 60,325
  • 17
  • 117
  • 234
0

Here are some chunks of a program that might help - the whole thing is too big

import sys

sys.path.insert(0, '/home/pi/pgms')

import RPi.GPIO as GPIO import time import datetime from datetime import timedelta import os import subprocess import glob import suntime

GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) ## Use board pin numbering

dirarr=["off","on"] pinarr=[7,8,10,11,12,13]

for i in range(0,6): ## Print current pin usage
fno = GPIO.gpio_function(pinarr[i]) ## get function number print ("Pin " + str(pinarr[i]) + " usage is " + pin_use[fno])

for i in range(0,2):
print (" " )

print ("Python version is %s " % str(sys.version[0:6]))

print ("GPIO version is %s " % GPIO.VERSION)

print ("Board revision is %s " % getbr()[:4])

print ("Program name is %s " % sys.argv[0])

print("System path is ",sys.path)

for i in range(len(pinarr)): GPIO.setup((pinarr[i]), GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

dogsled
  • 63
  • 7