Blinking an LED
This sketch shows the simplest case of digital out.
- Connect an LED in series with a 470ohm resistor between P8_07 and ground.
The led is blinked on and off by setting the digital pin
LOW every interval seconds which is set in
setup() the pin mode must be set to output mode via
pinMode(). For example:
pinMode(context, 0, P8_07, OUTPUT). In
render() the output of the digital pins is set by
digitalWrite(). For example:
digitalWrite(context, n, P8_07, status) where
status can be equal to either
LOW. When set
HIGH the pin will give 3.3V, when set to
Note that there are two ways of specifying the digital pin: using the GPIO label (e.g.
P8_07), or using the digital IO index (e.g. 0)
To keep track of elapsed time we have a sample counter count. When the count reaches a certain limit it switches state to either
LOW depending on its current value. In this case the limit is
context->digitalSampleRate*interval which allows us to write the desired interval in seconds, stored in
Generated on Mon Nov 11 2019 06:29:50 for Bela by 1.8.11