コード例 #1
0
import numpy as np
from matplotlib import pyplot as plt
import math
import sys
import struct
import pickle

play = True
use_psi = False

home = 1500  # so that this is 14psi, and 3000 can be a bit higher.

plt.ion()

pressure = Pressure()
C = pressure.calibrate(1800, 3000)

lsteps = C[2]
hsteps = C[3]
lowp = C[0]
highp = C[1]
print("C=", C)
prange = highp - lowp
steprange = hsteps - lsteps

runs = 1


def psi_to_steps(psi):
    s = lsteps + ((psi - lowp) / prange * steprange)
    return s
コード例 #2
0
from finger import Pressure
import time
import numpy as np
from matplotlib import pyplot as plt
import math

play = True

plt.ion()

pressure = Pressure()
pressure.calibrate()

w = 2.0 * math.pi
A = pressure.steps / 4

i = 0
t = 0
dt = 20e-3
ts = []
ys = []
while (t <= 2.0):
    ts.append(t)
    y = pressure.steps / 2 + A * math.sin(0.5 * w * t)
    print(y)
    ys.append(int(y))
    t = t + dt

maxstep = 0
for i in range(len(ys) - 1):
    ds = abs(ys[i + 1] - ys[i])
コード例 #3
0
from finger import Pressure
import time
import numpy as np
from matplotlib import pyplot as plt

plt.ion()

pressure = Pressure()

i = 0

before = time.time()
threshold = before + 10.0
t = []
w = pressure.calibrate(1200, 2800)
print(w)
コード例 #4
0
import numpy as np
from matplotlib import pyplot as plt
import math
import sys
import struct
import pickle

play = True
psi = False

home = 100  # so that this is 14psi, and 3000 can be a bit higher.

plt.ion()

pressure = Pressure()
C = pressure.calibrate(2200, 2900)

lsteps = C[2]
hsteps = C[3]
lowp = C[0]
highp = C[1]
print("C=", C)
prange = highp - lowp
steprange = hsteps - lsteps

print("prange=%d" % prange)
print("stepsrange=%d" % steprange)

atmospheric = 14.0

runs = 1