Difference between revisions of "Ultrasonic Sensor (HC-SR04) + Raspberry Pi"

From ESE205 Wiki
Jump to navigation Jump to search
Line 11: Line 11:
 
===Python===
 
===Python===
 
# '''Create a new script'''
 
# '''Create a new script'''
 +
[[File:newscript.png]]
 
# '''Save your script as ultrasonic_distance.py in the ~/pythonpractice folder'''
 
# '''Save your script as ultrasonic_distance.py in the ~/pythonpractice folder'''
 
# '''Open up the terminal'''
 
# '''Open up the terminal'''

Revision as of 16:59, 2 May 2017

Hardware

  • Raspberry pi 3
  • Ultrasonic Sensor - HC-SR04
  • A set of resistors for each sensor you are connecting
    • 330Ω and 470Ω
  • Jumper wires to connect the sensor(s) to the pi

Wire setup

Software

Python

  1. Create a new script
Newscript.png
  1. Save your script as ultrasonic_distance.py in the ~/pythonpractice folder
  2. Open up the terminal
  3. Type cd ~/pythonpractice to change directory to your pythonpractice folder, and hit Enter
  4. Type ./hello.py and hit Enter to run your program


TroubleShooting the pi