[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

[pi8] How to blink an LED with S8

To blink the LED we instantiate a CylonRobot instance an send it the message #start (to start work, blinking loop).

| robot |
robot := Cylon robot:
	#connections -> (
		#raspi -> (#adaptor -> #raspi)
	)
	,(#devices -> (
		#led -> (#driver -> #led ,(#pin ->3))
	))
	,(#work -> [:my| # #every: 1 second do: my#led#toggle ]).
robot start
Note that the code we suggest here is written
to match as much as possible the recommended code of javascript sample

Check the console

If your robot is working, the LED should be blinking and the console reports the following lines
<datetime> : [Robot 1] - Starting connections.
<datetime> : [Robot 1] - Starting connection 'raspi'.
<datetime> : [Robot 1] - Starting devices.
<datetime> : [Robot 1] - Starting device 'led' on pin 3.
<datetime> : [Robot 1] - Working.