Giter Club home page Giter Club logo

raspberrypi_cookbook_ed2's People

Contributors

simonmonk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raspberrypi_cookbook_ed2's Issues

whats wrong with line 16 on pot_step.py

import RPi.GPIO as GPIO
import time, math

C = 0.33 # uF
R1 = 1000 # Ohms

GPIO.setmode(GPIO.BCM)

Pin a charges the capacitor through a fixed 1k resistor and the thermistor in series

pin b discharges the capacitor through a fixed 1k resistor

a_pin = 18
b_pin = 23

empty the capacitor ready to start filling it up

def discharge():
GPIO.setup(a_pin, GPIO.IN)
GPIO.setup(b_pin, GPIO.OUT)
GPIO.output(b_pin, False)
time.sleep(0.1)

return the time taken (uS) for the voltage on the capacitor to count as a digital input HIGH

than means around 1.65V

def charge_time():
GPIO.setup(b_pin, GPIO.IN)
GPIO.setup(a_pin, GPIO.OUT)
GPIO.output(a_pin, True)
t1 = time.time()
while not GPIO.input(b_pin):
pass
t2 = time.time()
return (t2 - t1) * 1000000

Take an analog reading as the time taken to charge after first discharging the capacitor

def analog_read():
discharge()
t = charge_time()
discharge()
return t

Convert the time taken to charge the cpacitor into a value of resistance

To reduce errors, do it 100 times and take the average.

def read_resistance():
n = 10
total = 0;
for i in range(1, n):
total = total + analog_read()
t = total / float(n)
T = t * 0.632 * 3.3
r = (T / C) - R1
return r
try:
while True:
print(read_resistance())
time.sleep(0.5)
finally:
GPIO.cleanup()

Missing Coding Examples and myserver.py

Sorry if this is not the correct place to post this but can't find another option,

I found the reference on page 78 of how to pull down source code examples from GIT. What I can't find are coding examples such the one for my_server on page 80.

Related, I did not see anywhere to download the referenced myserver.py. I'm Raspbian GNU/Linux 8 (jessie) and Python 2.7.9.

What am I missing?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.