Voss Connection Detection  1
Detect a connector click using realtime code on Bela hardware
pedal.cpp
Go to the documentation of this file.
1 #include "pedal.h"
2 
3 Pedal::Pedal(BelaContext* ctx) {
4 
5  // Set pin 3 to input
6  pinMode(ctx, 0, INPUT_PIN_PEDAL, INPUT);
7 }
8 
9 bool Pedal::get(BelaContext* ctx, us frameno) const {
10 
11  pinMode(ctx, frameno, INPUT_PIN_PEDAL, INPUT);
12  int pedal_val = digitalRead(ctx, frameno, INPUT_PIN_PEDAL);
13  return (bool) pedal_val;
14 
15 }
pedal.h
Pedal::Pedal
Pedal(BelaContext *ctx)
Definition: pedal.cpp:3
INPUT_PIN_PEDAL
const int INPUT_PIN_PEDAL
The digital pin number on which the pedal is read.
Definition: config.h:74
Pedal::get
bool get(BelaContext *ctx, us frameno) const
Get the state of the pedal. True means it is pressed.
Definition: pedal.cpp:9
us
unsigned int us
Used to much to not abbreviate.
Definition: config.h:38