Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
darcato committed Jan 20, 2023
1 parent b65e908 commit 2eede52
Showing 1 changed file with 1 addition and 37 deletions.
38 changes: 1 addition & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,40 +44,4 @@ Docs" are required to build the documentation.

## Example

``` python
#! /usr/bin/python
from smlib import fsmBase, loader

# FSM definition
class exampleFsm(fsmBase):
def __init__(self, name, *args, **kwargs):
super(exampleFsm, self).__init__(name, **kwargs)

self.counter = self.connect("testcounter") # connect to PV "testcounter"
self.mirror = self.connect("testmirror")
self.enable = self.connect("testenable")

self.gotoState('idle')

# idle state
def idle_eval(self):
if self.enable.rising():
self.gotoState("mirroring")

# mirroring state
def mirroring_eval(self):
if self.enable.falling():
self.gotoState("idle")
elif self.counter.changing():
readValue = self.counter.val()
self.mirror.put(readValue)

# Main
if __name__ == '__main__':
# load the fsm
l = loader()
l.load(exampleFsm, "myFirstFsm")

# start execution
l.start()
```
![Examples can be found on the examples folder.](examples/example.png "Title")

0 comments on commit 2eede52

Please sign in to comment.