File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 34
34
for _ in enumerate (range (5 )):
35
35
time .sleep (ConversionTime .get_seconds (ina260 .current_conversion_time ))
36
36
print (
37
- "Current: %.2f mA Voltage: %.2f V Power:%.2f mW"
38
- % (ina260 .current , ina260 .voltage , ina260 .power )
37
+ f"Current: { ina260 .current :.2f} mA, "
38
+ f"Voltage: { ina260 .voltage :.2f} V, "
39
+ f"Power: { ina260 .power :.2f} mW"
39
40
)
40
41
41
42
# supposing meanwhile the alert limit was exceeded, setting an higher limit
44
45
ina260 .alert_limit = 0x0100
45
46
46
47
# alert function flag bit should be true if alert threshold was exceeded
47
- print ("Alert function flag: {}" . format ( ina260 .alert_function_flag ) )
48
+ print ("Alert function flag: " , ina260 .alert_function_flag )
48
49
49
50
# in latch mode, reading the register clears the ALERT & alert function flag
50
- print ("MASK register: {}" . format ( ina260 .mask_enable ) )
51
+ print ("MASK register:" , ina260 .mask_enable )
51
52
52
53
# reset the whole chip and wait 2 sec
53
54
ina260 .reset_bit = True
54
55
time .sleep (2 )
55
- print (
56
- "MASK_REGISTER check, must be 0x0000 after reset: {}" .format (ina260 .mask_enable )
57
- )
56
+ print ("MASK_REGISTER check, must be 0x0000 after reset:" , ina260 .mask_enable )
You can’t perform that action at this time.
0 commit comments