Recipe to Blink an Arduino's LEDArduinos have a built in LED connected to digital pin 13. On many Arduino sites, there are Arduino example programs which blink this LED. Instead of writing an Arduino program to blink its LED, this Script blinks the Arduino's LED using Virtual Wiring. In this example, we use an Oscillator Device with a user defined period to blink the LED. Any device with an on/off kind of output terminal could be virtuallly wired to the Arduino LED with the same effect. IngredientsFor this recipe, you will need:
ScriptYou can find the Script in the Scripts "examples" area. The Script is called "blinking_led.script". The Script is as follows:
To run this Script, you need 2 parameters: the arduino_port and osc_period parameters. The arduino_port parameter is the name of the USB port where the Arduino is plugged in. On *nix hosts, the USB port name is in the "/dev" directory. To see the devices in order of their creation, type "ls -lrt /dev" at a shell prompt and look near the bottom of the list for your Arduino's USB port. The osc_period parameter sets the blink period in seconds. It has a default value of 1 second (1Hz). As an example, for an Arduino at USB port "/dev/ttyUSB0" with a blink frequency of 2Hz, the Script parameters are:
Running the ScriptRun the Script above with your own parameters. The LED on your Arduino board should start blinking. Restart the system and try running the system with different blink periods. |