Coder Social home page Coder Social logo

nrf52_busyboard's Introduction

Button demo

Overview

A simple button demo showcasing the use of GPIO input with interrupts.

Requirements

The demo assumes that a push button is connected to one of GPIO lines. The sample code is configured to work on boards with user defined buttons and that have defined the SW0_* variable in board.h

To use this sample, you will require a board that defines the user switch in its header file. The :file:`board.h` must define the following variables:

  • SW0_GPIO_NAME
  • SW0_GPIO_PIN

The following boards currently define the above variables:

  • bbc_microbit
  • cc3220sf_launchxl
  • frdm_k64f
  • nrf51_pca10028
  • nrf52840_pca10056
  • nrf52_pca10040
  • nucleo_f103rb
  • :ref:`quark_d2000_devboard`
  • quark_se_c1000_devboard
  • quark_se_c1000_ss_devboard

Building and Running

This sample can be built for multiple boards, in this example we will build it for the nucleo_f103rb board:

$ cd samples/basic/button
$ make BOARD=nucleo_f103rb

After startup, the program looks up a predefined GPIO device, and configures the pin in input mode, enabling interrupt generation on falling edge. During each iteration of the main loop, the state of GPIO line is monitored and printed to the serial console. When the input button gets pressed, the interrupt handler will print an information about this event along with its timestamp.

nrf52_busyboard's People

Contributors

linhdnguyen avatar

Stargazers

Satyam Tiwary avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.