If weighted sum >=0 then its output 1 otherwise 0
What actual causes S1 to be either 1 or 0 is all defined by a set of weights w (three for the first neurone, S1, three for S2).
Converting the outputs of the two neurones S1 and S2 into actions is shown below.
The functions for forward, right_turn, etc are defined elsewhere.
At the moment the movement is a bit rough and it is a little simpler to build a version that follows the centre of the line; this approach though, works with thinner lines.
To change the function of the system, change the values in w; for example to produce one that follows the centre of the line just change w (I will leave that to someone to work on). The complete code is shown below.
All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon