You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These graphs will only serve as an endpoint for our execution functions. One thing to notice is that you can only turn on the device once. There is no possibility of turning the device again while it is already turned on.
59
+
These graphs will only serve as an endpoint for our execution functions. One thing to notice is that you can only turn on the device once. There is no possibility of turning the device on again while it is already in that state.
60
60
<br>Since the default state for LED light is to always be on we will set it to be on while starting.
61
61
62
62
Now let's draw the behaviour of our components.
@@ -87,7 +87,6 @@ You can check the code in the [example4.py][pycode] script.
87
87
- First let's take care of importing everything we will need:
88
88
```python
89
89
from automatabpp import*
90
-
from comparisons importCOMPARISONS# a helper class for comparison lambda functions
91
90
import math, time # we'll use this to simulate our readings
92
91
```
93
92
@@ -166,9 +165,15 @@ You can check the code in the [example4.py][pycode] script.
166
165
temp =round(simulate_temperature_reading(i), 2) # simulate reading the temperature sensor
167
166
print("\t\t|\t{}V\t|\t{}°C".format(volt, temp))
168
167
OPERATION.run_fsm() # run commands left in the CommandQueue
169
-
time.sleep(1)
168
+
time.sleep(2)
170
169
```
171
170
171
+
Run the script and check how our simulated device behaves. Is the behaviour the same as in the requirements?
172
+
173
+
```console
174
+
user@computer:~$ python example4.py
175
+
```
176
+
172
177
The rest of the code doesn't ever need to care about the behaviour of our components. The only thing that we need to do is read the sensor from time to time and run the commands left in the CommandQueue and the automatabpp will take care of everything else.
173
178
<br>Our code has just gotten a lot simpler after this and we can take care of whichever other things we want to do in the application.
0 commit comments