| 123456789101112131415161718192021222324252627282930313233 |
- include "primitives.alh"
- include "services.alh"
- include "modelling.alh"
- include "object_operations.alh"
- Boolean function main(model : Element):
- String port
- String the_input
- String devs_model
- port = comm_connect("pypdevs_simulator")
-
- log(dict_to_string(model))
-
- log("Sending model...")
- comm_set(port, read_attribute(model, set_pop(allInstances(model, "MyString/MyString")), "value"))
- log(port)
-
- while (True):
- if (comm_hasInput(port)):
- log(cast_v2s(has_input()))
- the_input = comm_get(port)
- log("Got input from simulator!")
- log(the_input)
- output(the_input)
- if (has_input()):
- the_input = input()
- log("Got input from console!")
- log(cast_v2s(the_input))
- if (is_physical_string(the_input)):
- comm_set(port, the_input)
- else:
- comm_set(port, cast_v2s(the_input))
- sleep(0.05)
|