Arduino Leonardo как адаптер SegaMegaDrive Gamepad->USB
#include «SMDjoystick.h»
SMDjoystick: SMDjoystick (int upPin, int downPin, int leftPin, int rightPin, int aPin, int selectPin, int startPin): up (upPin), down (downPin), left (leftPin), right (rightPin), a (aPin), select (selectPin), start (startPin){
pinMode (up, INPUT);
pinMode (down, INPUT);
pinMode (left, INPUT);
pinMode (right, INPUT);
pinMode (a, INPUT);
pinMode (start, INPUT);
pinMode (select, OUTPUT);
}
uint16_t SMDjoystick: read (){
uint16_t data=0;
digitalWrite (select, LOW);
data+=! digitalRead (a)<