giuliomoro If your Arduino has 5V signal levels, on the other hand, you need some way of adapting that voltage to Bela's 3.3V.
Also, here you're talking about the digital pins, right? Because I have the following working using the analog input pin with 5v. If you press the button, both LEDs light up at the same time. Is my setup here going to be problematic in the long run?
On the Arduino:
`#include <EasyButton.h>
#define BUTTON_PIN 6
#define LED_PIN 8
#define BELA_PIN 10
#define BAUDRATE 9600
EasyButton button(BUTTON_PIN);
// Callback function to be called when the button is pressed.
void onPressed()
{
Serial.println("Button pressed");
}
void setup()
{
Serial.begin(BAUDRATE);
pinMode(LED_PIN, OUTPUT);
pinMode(BELA_PIN, OUTPUT);
button.begin();
button.onPressed(onPressed);
}
void loop()
{
button.read(); // Continuously read the status of the button.
// light the LED if pressed
if(button.isPressed()){
digitalWrite(LED_PIN, LOW);
digitalWrite(BELA_PIN, HIGH);
} else {
digitalWrite(LED_PIN, HIGH);
digitalWrite(BELA_PIN, LOW);
}
}
`
On the Bela Mini with Pd: