()
| 40 | print(sensor.voltage[0]) |
| 41 | |
| 42 | def test_experiment(): |
| 43 | import time |
| 44 | actuator = LantzSignalGeneratorTCP(host='localhost', port=5678) |
| 45 | sensor = LantzVoltmeterTCP(host='localhost', port=5679) |
| 46 | actuator.initialize() |
| 47 | sensor.initialize() |
| 48 | |
| 49 | actuator.amplitude = 3 * volt |
| 50 | actuator.offset = 500 * milivolt |
| 51 | actuator.frequency = 1 * Hz |
| 52 | actuator.output_enabled = True |
| 53 | actuator.waveform = 'sine' |
| 54 | sensor.range[0] = 10 |
| 55 | sensor.range[1] = 10 |
| 56 | |
| 57 | data = [] |
| 58 | start_time = time.time() |
| 59 | try: |
| 60 | lantz.log.log_to_screen(lantz.log.ERROR) |
| 61 | while time.time() - start_time < 10: |
| 62 | datapoint = (time.time()-start_time, |
| 63 | sensor.voltage[0], |
| 64 | sensor.voltage[1]) |
| 65 | data.append(datapoint) |
| 66 | print(data) |
| 67 | except KeyboardInterrupt: |
| 68 | print('Ending ') |
| 69 | finally: |
| 70 | actuator.finalize() |
| 71 | sensor.finalize() |
| 72 | |
| 73 | |
| 74 | if __name__ == '__main__': |
no test coverage detected