Logo
0.0.6-beta
  • Support
  • Contribution

Boards

  • BeagleBone Black
  • BeagleBone AI-64
  • PocketBeagle
  • BeagleBone Blue
  • BeagleConnect

Projects

  • simpPRU
    • simpPRU Basics
    • Build from source
    • Install
    • Language Syntax
    • IO Functions
    • Usage(simppru)
    • Usage(simppru-console)
    • simpPRU Examples
      • Delay example
      • Digital read example
      • Digital write example
      • HCSR04 Distance Sensor example (sending distance data to ARM using RPMSG)
      • Ultrasonic range sensor example
      • Sending state of button using RPMSG
      • LED blink on button press example
        • Code
        • Explaination
      • LED blink using for loop example
      • LED blink using while loop example
      • LED blink example
      • Read hardware counter example
      • Using RPMSG to communicate with ARM core
      • Using RPMSG to implement a simple calculator on PRU

Books

  • BeagleBone Cookbook
BeagleBoard Docs
  • »
  • simpPRU »
  • simpPRU Examples »
  • LED blink on button press example
  • Edit on GitLab

LED blink on button press example¶

LED blink on button press example

Code¶

while : true {
    if : digital_read(P1_29) {
        digital_write(P1_31, false);
    }
    else {
        digital_write(P1_31, true);
    }
}
  • Following code works on PocketBeagle, to use on other boards, please change the pins accordingly.

Explaination¶

This code runs a never ending loop, since it is while : true. Inside while if header pin P1_29 is HIGH, then header pin P1_31 is set to HIGH, waits for 1000ms, then sets header pin P1_31 to LOW, then again it waits for 1000ms. This loop runs endlessly as long as header pin P1_29 is HIGH, so we get a Blinking output if one connects a LED to output pin.


© Copyright 2022, BeagleBoard.org Foundation. Last updated on Aug 10, 2022.

BeagleBoard Project v: latest
Document Release Versions
latest
Downloads
PDF
BeagleBoard.org Links
Docs Source