Skip to content
This repository was archived by the owner on Aug 13, 2019. It is now read-only.

Meeting 2

Alex Broaddus edited this page Sep 24, 2018 · 7 revisions

Meeting 2 - 9/24/18

Controls Parts List

  • Pressure Sensor
  • Gyroscope
  • Camera
  • Thermometer
  • Accelerometer
  • Sonar/Lasers
  • Ethernet Tether
  • Raspberry Pi
  • Motors
  • Pump/Plunger
  • Power Cable
  • Motor Controllers
  • Linear Actuator (small)
  • Voltage Regulator
  • LED indicators

Quick Python Overview

# This is a comment! Comments start with a '#' symbol.

x = 5         # This line creates a new variable called 'x' with a value of 5
y = x * 10    # This line creates a new variable called 'y' with a value of 50 (because x = 5 and 5 * 10 = 50)

def say_hello():
    print("Hello!")

say_hello()
# Console will output 'Hello!'

def add_two_numbers(a, b):
    return a + b

z = add_two_numbers(x, y)
# z will equal 55, because x = 5, y = 50, and the add_two_numbers method returns the sum of the two given variables


# Loops

n = 5
while n > 0:
    print(n)
    n-=1

# This will print out:
# 5
# 4
# 3
# 2
# 1

for i in range(5):
    print(i)

# This will print out:
# 0
# 1
# 2
# 3
# 4

Much more in depth overview: https://learnxinyminutes.com/docs/python3/

Raspberry Pi

GPIO Pins allow the raspberry pi to output voltage and read inputs from electronic devices.

GPIO Pins

Example code using gpiozero library

from gpiozero import LED
from time import sleep

led = LED(14)

while True:
    led.on()
    sleep(0.5)
    led.off()
    sleep(0.5)

Clone this wiki locally