Skip to content

Instantly share code, notes, and snippets.

@bertoort
Created January 19, 2019 22:30
Show Gist options
  • Save bertoort/2617810b2b242939a7371ebd763bd662 to your computer and use it in GitHub Desktop.
Save bertoort/2617810b2b242939a7371ebd763bd662 to your computer and use it in GitHub Desktop.
Friend Beacon Notes

Friendship Beacon

Hardware

  • Pi3 with charging cable, sd card, and initial monitor and keyboard to set up
  • miniboard
  • 4 cables with pointy end and receiving end
  • two resistors
  • button
  • led

Steps

  • Set up pi with shell os to ssh
  • ssh into pi and create file
  • execute file
import RPi.GPIO as GPIO

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(10, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(32, GPIO.OUT)

while True: # Run forever
    if GPIO.input(10) == GPIO.HIGH:
       print("Button was pushed!")
       GPIO.output(32, GPIO.HIGH)
    else:
       GPIO.output(32, GPIO.LOW)

Commands

  • username: pi
  • password: raspberry
  • raspi-config to setup wifi and enable ssh
  • ifconfig to look up ip address
  • sudo apt-get install python-rpi.gpio python3-rpi.gpio

Tutorials and links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment