Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
test_environmental_sensor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fischertechnik examples
TXT 4.0 Controller
test_environmental_sensor
Commits
c47e3491
Commit
c47e3491
authored
4 years ago
by
ft-Demo
Browse files
Options
Downloads
Patches
Plain Diff
commit by robo pro coding
parent
71e988d3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.blockly
+214
-154
214 additions, 154 deletions
main.blockly
main.py
+17
-6
17 additions, 6 deletions
main.py
with
231 additions
and
160 deletions
main.blockly
+
214
−
154
View file @
c47e3491
This diff is collapsed.
Click to expand it.
main.py
+
17
−
6
View file @
c47e3491
...
...
@@ -2,18 +2,29 @@ import ftgui
from
controller
import
*
import
time
t
=
None
h
=
None
p
=
None
iaq
=
None
gui
=
ftgui
.
fttxt2_gui_connector
(
"
app
"
)
gui
.
run
()
while
True
:
t
=
TXT_I2C_1_environment_sensor
.
get_temperature
()
h
=
TXT_I2C_1_environment_sensor
.
get_humidity
()
p
=
TXT_I2C_1_environment_sensor
.
get_pressure
()
if
TXT_I2C_1_environment_sensor
.
needs_calibration
():
gui
.
exec_script
(
"
txt_status_indicator.active=
"
+
str
(
False
).
lower
())
iaq
=
0
TXT_I2C_1_environment_sensor
.
calibrate
()
else
:
gui
.
exec_script
(
"
txt_status_indicator.active=
"
+
str
(
True
).
lower
())
gui
.
exec_script
(
"
txt_label_t.text=
'
%s
'"
%
str
(
''
.
join
([
str
(
x
)
for
x
in
[
'
t:
'
,
TXT_I2C_1_environment_sensor
.
get_temperature
(),
'
°C
'
]])))
gui
.
exec_script
(
"
txt_label_h.text=
'
%s
'"
%
str
(
''
.
join
([
str
(
x2
)
for
x2
in
[
'
h:
'
,
TXT_I2C_1_environment_sensor
.
get_humidity
(),
'
%rH
'
]])))
gui
.
exec_script
(
"
txt_label_p.text=
'
%s
'"
%
str
(
''
.
join
([
str
(
x3
)
for
x3
in
[
'
p:
'
,
TXT_I2C_1_environment_sensor
.
get_pressure
(),
'
hPa
'
]])))
gui
.
exec_script
(
"
txt_label_iaq.text=
'
%s
'"
%
str
(
'
iaq:
'
+
str
(
TXT_I2C_1_environment_sensor
.
get_indoor_air_quality_as_number
())))
print
(
''
.
join
([
str
(
x4
)
for
x4
in
[
'
t:
'
,
TXT_I2C_1_environment_sensor
.
get_temperature
(),
'
°C
'
,
'
h:
'
,
TXT_I2C_1_environment_sensor
.
get_humidity
(),
'
%rH
'
,
'
p:
'
,
TXT_I2C_1_environment_sensor
.
get_pressure
(),
'
hPa
'
,
'
iaq:
'
,
TXT_I2C_1_environment_sensor
.
get_indoor_air_quality_as_number
()]]))
time
.
sleep
(
1
)
iaq
=
TXT_I2C_1_environment_sensor
.
get_indoor_air_quality_as_number
()
gui
.
exec_script
(
"
txt_label_t.text=
'
%s
'"
%
str
(
''
.
join
([
str
(
x
)
for
x
in
[
'
t:
'
,
t
,
'
°C
'
]])))
gui
.
exec_script
(
"
txt_label_h.text=
'
%s
'"
%
str
(
''
.
join
([
str
(
x2
)
for
x2
in
[
'
h:
'
,
h
,
'
%rH
'
]])))
gui
.
exec_script
(
"
txt_label_p.text=
'
%s
'"
%
str
(
''
.
join
([
str
(
x3
)
for
x3
in
[
'
p:
'
,
p
,
'
hPa
'
]])))
gui
.
exec_script
(
"
txt_label_iaq.text=
'
%s
'"
%
str
(
'
iaq:
'
+
str
(
iaq
)))
print
(
''
.
join
([
str
(
x4
)
for
x4
in
[
'
t:
'
,
t
,
'
°C
'
,
'
h:
'
,
h
,
'
%rH
'
,
'
p:
'
,
p
,
'
hPa
'
,
'
iaq:
'
,
iaq
]]))
time
.
sleep
(
3
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment