Commit 8d920606 authored by Georges Khaznadar's avatar Georges Khaznadar

New upstream version 4.4.4+dfsg

parent e7df941e
......@@ -4,7 +4,6 @@ SUBDIRS = bin po firmware clib/expeyes-clib microhope \
SUBDIRS_INDEP = expeyes-web eyes17/lang
all:
python setup.py build
python3 setup.py build
for d in $(SUBDIRS); do \
if [ -f $$d/configure.ac ]; then \
......@@ -25,14 +24,11 @@ all_indep:
done
install:
# for python-expeyes
# for python3-expeyes
if grep -Eq "Debian|Ubuntu" /etc/issue; then \
python setup.py install --install-layout=deb \
--root=$(DESTDIR)/ --prefix=/usr; \
python3 setup.py install --install-layout=deb \
--root=$(DESTDIR)/ --prefix=/usr; \
else \
python setup.py install --root=$(DESTDIR)/ --prefix=/usr; \
python3 setup.py install --root=$(DESTDIR)/ --prefix=/usr; \
fi
install -d $(DESTDIR)/lib/udev/rules.d/
......
#!/usr/bin/python
#!/usr/bin/python3
"""
CGI script for setting status for output pins of expEYES Junior connected to server
Copyright 2016, Authors : , Jishnu R(jishnu47@gmail.com), Rakesh K M(rakeshkm2203@gmail.com), Manoj.S.Nair(manojsnair007@gmail.com) [Amrita School of Engineering, Amritapuri Campus, Kollam 690525, Kerala]
......
#!/usr/bin/python
#!/usr/bin/python3
"""
CGI script for reading status of input pins of expEYES Junior connected to server
Copyright 2016, Authors : Manoj.S.Nair(manojsnair007@gmail.com), Jishnu R(jishnu47@gmail.com), Rakesh K M(rakeshkm2203@gmail.com) [Amrita School of Engineering, Amritapuri Campus, Kollam 690525, Kerala]
......
import eyes17.eyes
p = eyes17.eyes.open()
from pylab import *
import eyes17.eyemath17 as em
p.set_sine(1000)
p.set_sqr1(500)
t,v, tt,vv = p.capture2(5000, 20) # captures A1 and A2
xlabel('Freq')
ylabel('Amplitude')
xlim([0,10000])
xa,ya = em.fft(v,20*0.001)
plot(xa,ya, linewidth = 2, color = 'blue')
xa,ya = em.fft(vv, 20*0.001)
plot(xa, ya, linewidth = 2, color = 'red')
show()
import eyes17.eyes
p = eyes17.eyes.open()
from pylab import *
p.set_wave(50,'tria')
p.select_range('A1',4)
p.select_range('A2',4)
t,v, tt,vv = p.capture2(500, 100) # captures A1 and A2
xlabel('Time(mS)')
ylabel('Voltage(V)')
plot([0,1], [0,0], 'black')
ylim([-4,4])
plot(t,v,linewidth = 2, color = 'blue')
plot(tt, vv, linewidth = 2, color = 'red')
show()
import eyes17.eyes
p = eyes17.eyes.open()
from pylab import *
p.set_wave(500,'tria')
p.select_range('A1',4)
p.select_range('A2',4)
t,v, tt,vv = p.capture2(500, 20) # captures A1 and A2
xlabel('Time(mS)')
ylabel('Voltage(V)')
plot([0,10], [0,0], 'black')
ylim([-4,4])
plot(t,v,linewidth = 2, color = 'blue')
plot(tt, vv, linewidth = 2, color = 'red')
show()
import eyes17.eyes
p = eyes17.eyes.open()
from pylab import *
set_sine(200)
set_pv1(1.35) # will clip at 1.35 + diode drop
t,v, tt,vv = capture2(500, 20) # captures A1 and A2
xlabel('Time(mS)')
ylabel('Voltage(V)')
plot([0,10], [0,0], 'black')
ylim([-4,4])
plot(t,v,linewidth = 2, color = 'blue')
plot(tt, vv, linewidth = 2, color = 'red')
show()
import eyes17.eyes
p = eyes17.eyes.open()
from pylab import *
import time
p.set_state(OD1=0) # OD1 to LOW
time.sleep(.5)
t,v = p.capture_action('A1', 100, 5, 'SET_HIGH')
plot(t,v,linewidth = 2, color = 'blue')
p.set_state(OD1=1) # OD1 to LOW
time.sleep(.5)
t,v = p.capture_action('A1', 100, 5, 'SET_LOW')
plot(t,v,linewidth = 2, color = 'red')
show()
import eyes17.eyes
p = eyes17.eyes.open()
from pylab import *
import time
plot([0,.5], [0,0], color='black')
ylim([-5,5])
p.set_state(OD1=1) # OD1 to LOW
time.sleep(.5)
t,v = p.capture_action('A1', 100, 5, 'SET_LOW')
plot(t,v,linewidth = 2, color = 'red')
show()
import eyes17.eyes
p = eyes17.eyes.open()
from pylab import *
x,y = p.capture1('A1',10,10)
plot(x,y)
show()
import eyes17.eyes
p = eyes17.eyes.open()
from pylab import *
p.set_sine(200)
t,v, tt,vv = p.capture2(500, 20) # captures A1 and A2
xlabel('Time(mS)')
ylabel('Voltage(V)')
plot([0,10], [0,0], 'black')
ylim([-4,4])
plot(t,v,linewidth = 2, color = 'blue')
plot(tt, vv, linewidth = 2, color = 'red')
show()
import eyes17.eyes
p = eyes17.eyes.open()
from pylab import *
p.set_sine(200)
res = p.capture4(500, 20) # captures A1, A2,A3 and MIC
plot(res[0], res[1], linewidth = 2, color = 'blue')
plot(res[6], res[7], linewidth = 2, color = 'red')
show()
import eyes17.eyes
p = eyes17.eyes.open()
from pylab import *
p.set_sine(200)
p.set_pv1(1.7) # will clamp at 2.0 + diode drop
maxV = 8
p.select_range('A1', maxV)
p.select_range('A2', maxV)
t,v, tt,vv = p.capture2(500, 20) # captures A1 and A2
xlabel('Time(mS)')
ylabel('Voltage(V)')
plot([0,10], [0,0], 'black')
ylim([-maxV, maxV])
plot(t,v,linewidth = 2, color = 'blue', label='Input')
plot(tt, vv, linewidth = 2, color = 'red', label='Clamped')
legend(framealpha=0.5)
show()
import eyes17.eyes
p = eyes17.eyes.open()
from pylab import *
p.set_sine(200)
p.set_pv1(1.35) # will clip at 1.35 + diode drop
t,v, tt,vv = p.capture2(500, 20) # captures A1 and A2
xlabel('Time(mS)')
ylabel('Voltage(V)')
plot([0,10], [0,0], 'black')
ylim([-4,4])
plot(t,v,linewidth = 2, color = 'blue')
plot(tt, vv, linewidth = 2, color = 'red')
show()
'''
Connect OD1 to A1
'''
from __future__ import print_function
import eyes17.eyes
p = eyes17.eyes.open()
#connect OD1 to A1
p.set_state(OD1 = 1 ) # set OD1 to HIGH
print (p.get_voltage('A1'))
p.set_state(OD1 = 0 ) # set OD1 to HIGH
print (p.get_voltage('A1'))
import eyes17.eyes
p = eyes17.eyes.open()
from pylab import *
voltage = []
current = []
v = 0.0
while v <= 5.0:
va = set_pv1(v)
vd = get_voltage('A1')
i = (va-vd)/1.0 # current in milli Amps
voltage.append(vd)
current.append(i)
v = v + 0.050 # 50 mV step
xlabel('Voltage')
ylabel('Current')
plot(voltage, current, linewidth = 2)
show()
import eyes17.eyes
p = eyes17.eyes.open()
from pylab import *
p.set_sine(200)
res = p.capture4(500, 20) # captures A1 and A2
xlabel('Time(mS)')
ylabel('Voltage(V)')
plot([0,10], [0,0], 'black')
ylim([-4,4])
plot(res[0], res[1], linewidth = 2, color = 'blue')
plot(res[2], res[3], linewidth = 2, color = 'red')
plot(res[4], res[5], linewidth = 2, color = 'magenta')
show()
import eyes17.eyes
p = eyes17.eyes.open()
# Connect WG to A1
from pylab import *
x = arange(-256, 256)
x = abs(x)
p.load_table(x)
p.set_wave(400)
x,y = p.capture1('A1', 500,10)
plot(x,y)
show()
'''
Measures capacitance in the range of pico Farads
'''
from __future__ import print_function
import eyes17.eyes
p = eyes17.eyes.open()
#connect Capacitor from IN1 to GND
print (p.get_capacitance())
#connect an LDR from SEN to GND
print (p.get_resistance())
'''
multi_r2rtime(input, ncycles) returns the microseconds elapsed between two rising edges.
ncycles is the number of cycles to be measured.
'''
from __future__ import print_function
import eyes17.eyes
p = eyes17.eyes.open()
p.set_sqr1(1000) # set 1kHz on SQR1
t = p.multi_r2rtime('IN2') # 6 is the readback of SQR1. Time of 10 cycles
print (t, 'Frequency = ', (1.0/t))
import eyes17.eyes
p = eyes17.eyes.open()
from pylab import *
vcc = p.set_pv1(4.8)
iba = []
ica = []
pv2 = 0.8
while pv2 <= 3:
p.set_pv2(pv2)
a2 = p.get_voltage('A2')
ib = (pv2-a2)/100e3
a1 = p.get_voltage('A1')
ic = (vcc - a1)/1000
iba.append(ib)
ica.append(ic)
print (ib, ic)
pv2 += 1
plot(iba,ica)
show()
'''
r2ftime(in1, in2) returns the microseconds elapsed from a rising edge on input1 to a falling edge of input2,
they could be the same
'''
from __future__ import print_function
import eyes17.eyes
p = eyes17.eyes.open()
p.set_sqr1(1000,30) # set 1kHz squarewave, 30% duty cycle
print (p.r2ftime('IN2', 'IN2'))
p.set_sqr1(1000,60) # set 1kHz squarewave, 60% duty cycle
print (p.r2ftime('IN2', 'IN2'))
import eyes17.eyes
p = eyes17.eyes.open()
print (p.get_voltage('A1'))
print (p.get_voltage('A2'))
print (p.get_voltage('A3'))
import eyes17.eyes
p = eyes17.eyes.open()
# Connect PV1 to A1 and PV2 to A2, using two wires
print (p.set_pv1(2.5))
print (p.set_pv2(1))
print (p.get_voltage('A1'))
print (p.get_voltage('A2'))
import eyes17.eyes
p = eyes17.eyes.open()
# Connect WG to A1
from pylab import *
p.set_wave(100)
x,y = p.capture1('A1', 500,50)
plot(x,y)
p.set_wave(100, 'tria')
x,y = p.capture1('A1', 500,50)
plot(x,y)
show()
import eyes17.eyes
p = eyes17.eyes.open()
# Connect WG to A1
from pylab import *
def f1(x): #
return sin(x) + sin(3*x)/3
p.load_table(abs(arange(-256,256)))
p.set_wave(400)
x,y = p.capture1('A1', 500,10)
plot(x,y)
show()
import eyes17.eyes
p = eyes17.eyes.open()
# Connect WG to A1
from pylab import *
p.set_wave(500,'tria')
x,y = p.capture1('A1', 500,10)
plot(x,y)
show()
......@@ -2994,14 +2994,16 @@ class Interface():
# Need to do this since 'eyes.py' redefines 'open'
if type(filename) == tuple:
filename = filename[0]
print (filename)
f = fileOpen(filename,'w')
for xy in data:
for k in range(len(xy[0])):
f.write('%5.3f %5.3f\n'%(xy[0][k], xy[1][k]))
f.write('\n')
f.close()
# Do not save when filename == "", which can happen if one
# cancels the file save dialog
if filename:
f = fileOpen(filename,'w')
for xy in data:
for k in range(len(xy[0])):
f.write('%5.3f %5.3f\n'%(xy[0][k], xy[1][k]))
f.write('\n')
f.close()
return
if __name__ == "__main__":
print("""this is not an executable file
......
<ul>
<li><p>Write your own Python code to access ExpEYES-17</p></li>
<li><p>Use all function from the eyes17 module</p></li>
</ul>
<p>You can run python code here to access the eyes17 hardware.
But this has restrictions, like the output to the console will
appear only in the end.</p>
<p>To run proper python programs to access eyes17, copy the directory
'/usr/share/eyes17/examples' to the home directory to run the examples.
You should exit this GUI before that, the hardware can be accessed by only one
<<<<<<< HEAD
program at a time. Use python3 to run the code, required modules are installed
only for python3.
example:
$ python3 capture1.py
will capture the input at A1 and plot it using matplotlib
=======
program at a time.</p>
>>>>>>> f627e49e9aa7aa1dccad7ef4cfb11eac5db09a05
......@@ -2,12 +2,12 @@ DESTDIR =
TS_FILES = $(shell ls *.ts)
QM_FILES = $(patsubst %.ts, %.qm, $(TS_FILES))
SOURCES = $(shell ls ../*py ../code/*.py)
PYLUPDATE ?= pylupdate4
PYLUPDATE ?= pylupdate5
all: $(QM_FILES)
$(QM_FILES): $(TS_FILES)
lrelease-qt4 eyes17.pro
lrelease eyes17.pro
$(TS_FILES): eyes17.pro
$(PYLUPDATE) eyes17.pro
......
......@@ -136,7 +136,6 @@ class helpWin(QWebView):
hit during the search defines the file to open.
"""
QWebView.__init__(self)
print("GRRRR, type(name[1])", type(name[1]), name[1])
if type(name[1]) is str:
fn = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'html', name[1]+'.html')
else:
......@@ -165,7 +164,6 @@ class helpWin(QWebView):
"/usr/share/eyes17/html", # packaged environment, plain HTML files
os.path.join(os.path.dirname(os.path.abspath(__file__)), 'html'), # development environment, plain HTML files (must be last to let /usr/share/eyes17/main.py find help files in rst/**/)
]
print("GRRRR dirs=", dirs)
for directory in dirs:
for f in htmlFiles:
target= os.path.join(directory,f)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment