forked from ekmmetering/ekmmeters
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
75 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
""" Simple example read | ||
(c) 2016 EKM Metering. | ||
""" | ||
from ekmmeters import * | ||
|
||
my_port_name = "COM3" | ||
my_meter_address = "10001438" | ||
|
||
ekm_set_log(ekm_no_log) | ||
port = SerialPort(my_port_name) | ||
|
||
if (port.initPort() == True): | ||
my_meter = V4Meter(my_meter_address) | ||
my_meter.attachPort(port) | ||
else: | ||
print "Cannot open port" | ||
exit() | ||
|
||
for i in range(1000): | ||
if my_meter.request(): | ||
my_read_buffer = my_meter.getReadBuffer() | ||
# you can also traverse the buffer yourself, | ||
#but this is the simplest way to get it all. | ||
print "*------" | ||
print my_meter.getField(Field.Power_Factor_Ln_1) | ||
print my_meter.getField(Field.Cos_Theta_Ln_1) | ||
|
||
|
||
port.closePort() |