I've been having alot of trouble setting this up, I'm trying to use an arduino uno as a controller for my rasperry pi 3. I just want to wire 5 buttons and a joystick. Does anyone know how I should go about this? Any help would be appreciated!
How is the Arduino communicating the button and joystick values to the Pi ?
Please attach wiring diagram and code for the UNO and its buttons. Take a look at "How to use Forum", how to attach info the best way.
Heres everything I have, the arduino then connects to the pi from the usb port
const int ResetPin = 5;
const int APin = 2;
const int BPin = 3;
const int StartPin = 4;
void setup() {
// put your setup code here, to run once:
#include <Keyboard.h>
pinMode(BPin, INPUT);
pinMode(APin, INPUT);
pinMode(ResetPin, INPUT);
pinMode(StartPin, INPUT);
Keyboard.begin();
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(2) == LOW){
Keyboard.write('A')
delay(10);
}
if(digitalRead(3) == LOW){
keyboard.write('B')
delay(10);
}
if(digitalRead(2) == LOW){
keyboard.write('A')
delay(10);
}
if(digitalRead(4) == LOW){
keyboard.write('M')
delay(10);
}
}
If You use code tags, </>, top, left in the reply menu, more helpers will read Your code.
The button is pulled up by a resistor and that's okey, You can declare the input as INPUT_PULLUP and use the internal pullup resistor in the UNO.
Describe what You want to happend and what actually does happend.
