Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
garubi authored Mar 4, 2021
1 parent 527c2f9 commit a6fbf14
Show file tree
Hide file tree
Showing 7 changed files with 529 additions and 0 deletions.
106 changes: 106 additions & 0 deletions arduino/push-push/push-push.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// https://www.instructables.com/id/USB-Pedal-HID-Keyboard-With-Arduino-Leonardo/
// https://www.arduino.cc/reference/en/language/functions/usb/keyboard/
// https://www.arduino.cc/reference/en/language/functions/usb/keyboard/keyboardmodifiers/
// KEY_UP_ARROW
// KEY_DOWN_ARROW
// KEY_LEFT_ARROW
// KEY_RIGHT_ARROW
// KEY_ESC
// KEY_PAGE_DOWN

#include "Keyboard.h"
#include <Bounce2.h>

//Pulsanti
const byte PEDALNEXT_PIN = 2;
const byte PEDALPREV_PIN = 3;

//Led
const byte PEDALNEXT_LED = 9;
const byte PEDALPREV_LED = 8;

//Tasti da emulare
const byte PEDALNEXT_KEY = KEY_PAGE_DOWN;
const byte PEDALPREV_KEY = KEY_PAGE_UP;


const byte PED_NEXT = PEDALNEXT_PIN;
const byte PED_PREV = PEDALPREV_PIN;

// Instantiate a Bounce object
Bounce ped_next = Bounce();
// Instantiate another Bounce object
Bounce ped_prev = Bounce();

static void SendKey( byte pedal ){
switch( pedal ){
case PED_NEXT:
Keyboard.press(PEDALNEXT_KEY);
break;
case PED_PREV:
Keyboard.press(PEDALPREV_KEY);
break;
}
delay(100);
Keyboard.releaseAll();
}

void setup(void)
{
Keyboard.begin();

// Set pin to input
pinMode(PEDALNEXT_PIN, INPUT_PULLUP);
// Enable pullup resistor
//digitalWrite(PEDALNEXT_PIN, HIGH);
// After setting up the button, setup the Bounce instance :
ped_next.attach(PEDALNEXT_PIN);
// ped_next.interval(5); // interval in ms

// Set pin to input
pinMode(PEDALPREV_PIN, INPUT_PULLUP);
// Enable pullup resistor
//digitalWrite(PEDALPREV_PIN, HIGH);
ped_prev.attach(PEDALPREV_PIN);
// ped_prev.interval(5); // interval in ms

pinMode(PEDALNEXT_LED, OUTPUT);
pinMode(PEDALPREV_LED, OUTPUT);
}

void loop(void)
{
static uint8_t pedalNEXTStateLast = 0;
static uint8_t pedalPREVStateLast = 0;
uint8_t pedalState;
ped_next.update();
ped_prev.update();

pedalState = ped_next.read();
if (pedalState != pedalNEXTStateLast) {
pedalNEXTStateLast = pedalState;

if (pedalState == LOW ) {
SendKey( PED_NEXT );
digitalWrite(PEDALNEXT_LED, HIGH );
}
else{
digitalWrite(PEDALNEXT_LED, LOW );
}
}

pedalState = ped_prev.read();
if (pedalState != pedalPREVStateLast) {
pedalPREVStateLast = pedalState;

if (pedalState == LOW ) {
SendKey( PED_PREV );
digitalWrite(PEDALPREV_LED, HIGH );
}
else{
digitalWrite(PEDALPREV_LED, LOW );
}
}

delay(50);
}
1 change: 1 addition & 0 deletions schematics/push-push/fp-info-cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
108 changes: 108 additions & 0 deletions schematics/push-push/push.push-cache.lib
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# Device_LED
#
DEF Device_LED D 0 40 N N 1 F N
F0 "D" 0 100 50 H V C CNN
F1 "Device_LED" 0 -100 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
LED*
LED_SMD:*
LED_THT:*
$ENDFPLIST
DRAW
P 2 0 1 8 -50 -50 -50 50 N
P 2 0 1 0 -50 0 50 0 N
P 4 0 1 8 50 -50 50 50 -50 0 50 -50 N
P 5 0 1 0 -120 -30 -180 -90 -150 -90 -180 -90 -180 -60 N
P 5 0 1 0 -70 -30 -130 -90 -100 -90 -130 -90 -130 -60 N
X K 1 -150 0 100 R 50 50 1 1 P
X A 2 150 0 100 L 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_R
#
DEF Device_R R 0 0 N Y 1 F N
F0 "R" 80 0 50 V V C CNN
F1 "Device_R" 0 0 50 V V C CNN
F2 "" -70 0 50 V I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
R_*
$ENDFPLIST
DRAW
S -40 -100 40 100 0 1 10 N
X ~ 1 0 150 50 D 50 50 1 1 P
X ~ 2 0 -150 50 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# MCU_Module_Arduino_Leonardo
#
DEF MCU_Module_Arduino_Leonardo A 0 40 Y Y 1 F N
F0 "A" -200 1050 50 H V R CNN
F1 "MCU_Module_Arduino_Leonardo" -200 950 50 H V R CNN
F2 "Module:Arduino_UNO_R3" 150 -1050 50 H I L CNN
F3 "" -200 1050 50 H I C CNN
$FPLIST
Arduino*UNO*R3*
$ENDFPLIST
DRAW
S -400 900 400 -1000 0 1 10 f
X NC 1 -500 -800 100 R 50 50 1 1 N N
X A1 10 500 -100 100 L 50 50 1 1 B
X A2 11 500 -200 100 L 50 50 1 1 B
X A3 12 500 -300 100 L 50 50 1 1 B
X A4 13 500 -400 100 L 50 50 1 1 B
X A5 14 500 -500 100 L 50 50 1 1 B
X D0/RX 15 -500 600 100 R 50 50 1 1 B
X D1/TX 16 -500 500 100 R 50 50 1 1 B
X D2/SDA 17 -500 400 100 R 50 50 1 1 B
X D3/SCL 18 -500 300 100 R 50 50 1 1 B
X D4 19 -500 200 100 R 50 50 1 1 B
X IOREF 2 500 400 100 L 50 50 1 1 O
X D5 20 -500 100 100 R 50 50 1 1 B
X D6 21 -500 0 100 R 50 50 1 1 B
X D7 22 -500 -100 100 R 50 50 1 1 B
X D8 23 -500 -200 100 R 50 50 1 1 B
X D9 24 -500 -300 100 R 50 50 1 1 B
X D10 25 -500 -400 100 R 50 50 1 1 B
X D11 26 -500 -500 100 R 50 50 1 1 B
X D12 27 -500 -600 100 R 50 50 1 1 B
X D13 28 -500 -700 100 R 50 50 1 1 B
X GND 29 -100 -1100 100 U 50 50 1 1 W
X RESET 3 500 600 100 L 50 50 1 1 I
X AREF 30 500 200 100 L 50 50 1 1 I
X SDA 31 500 -700 100 L 50 50 1 1 B
X SCL 32 500 -800 100 L 50 50 1 1 B
X 3V3 4 100 1000 100 D 50 50 1 1 w
X +5V 5 200 1000 100 D 50 50 1 1 w
X GND 6 0 -1100 100 U 50 50 1 1 W
X GND 7 100 -1100 100 U 50 50 1 1 W
X VIN 8 -100 1000 100 D 50 50 1 1 W
X A0 9 500 0 100 L 50 50 1 1 B
ENDDRAW
ENDDEF
#
# Switch_SW_Push
#
DEF Switch_SW_Push SW 0 40 N N 1 F N
F0 "SW" 50 100 50 H V L CNN
F1 "Switch_SW_Push" 0 -60 50 H V C CNN
F2 "" 0 200 50 H I C CNN
F3 "" 0 200 50 H I C CNN
DRAW
C -80 0 20 0 1 0 N
C 80 0 20 0 1 0 N
P 2 0 1 0 0 50 0 120 N
P 2 0 1 0 100 50 -100 50 N
X 1 1 -200 0 100 R 50 50 0 1 P
X 2 2 200 0 100 L 50 50 0 1 P
ENDDRAW
ENDDEF
#
#End Library
135 changes: 135 additions & 0 deletions schematics/push-push/push.push.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
EESchema Schematic File Version 4
LIBS:pipresents-pedalboard-1-cache
EELAYER 29 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title "Pipresents Pedalboard"
Date "2020-02-29"
Rev "2.0"
Comp "UBI Stage"
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Comp
L Switch:SW_Push SW1
U 1 1 5DD7D5B1
P 3950 3200
F 0 "SW1" H 3950 3485 50 0000 C CNN
F 1 "Pedal Next" H 3950 3394 50 0000 C CNN
F 2 "" H 3950 3400 50 0001 C CNN
F 3 "~" H 3950 3400 50 0001 C CNN
1 3950 3200
1 0 0 -1
$EndComp
$Comp
L Switch:SW_Push SW2
U 1 1 5DD7E343
P 3950 3600
F 0 "SW2" H 3950 3885 50 0000 C CNN
F 1 "Pedal Prev" H 3950 3794 50 0000 C CNN
F 2 "" H 3950 3800 50 0001 C CNN
F 3 "~" H 3950 3800 50 0001 C CNN
1 3950 3600
1 0 0 -1
$EndComp
Wire Wire Line
4200 3600 4150 3600
Wire Wire Line
5400 3200 4150 3200
Wire Wire Line
5800 4700 4250 4700
$Comp
L MCU_Module:Arduino_Leonardo A1
U 1 1 5DD7BDC3
P 5900 3600
F 0 "A1" H 5900 4781 50 0000 C CNN
F 1 "Arduino_Leonardo" H 5900 4690 50 0000 C CNN
F 2 "Module:Arduino_UNO_R3" H 6050 2550 50 0001 L CNN
F 3 "https://www.arduino.cc/en/Main/ArduinoBoardLeonardo" H 5700 4650 50 0001 C CNN
1 5900 3600
1 0 0 -1
$EndComp
$Comp
L Device:LED D2
U 1 1 5DD83151
P 4600 4300
F 0 "D2" H 4593 4516 50 0000 C CNN
F 1 "Pedal next LED" H 4593 4425 50 0000 C CNN
F 2 "" H 4600 4300 50 0001 C CNN
F 3 "~" H 4600 4300 50 0001 C CNN
1 4600 4300
1 0 0 -1
$EndComp
$Comp
L Device:LED D1
U 1 1 5DD84091
P 4600 3800
F 0 "D1" H 4593 4016 50 0000 C CNN
F 1 "Pedal Prev LED" H 4593 3925 50 0000 C CNN
F 2 "" H 4600 3800 50 0001 C CNN
F 3 "~" H 4600 3800 50 0001 C CNN
1 4600 3800
1 0 0 -1
$EndComp
$Comp
L Device:R R1
U 1 1 5DD97240
P 5050 3800
F 0 "R1" V 4843 3800 50 0000 C CNN
F 1 "47K" V 4934 3800 50 0000 C CNN
F 2 "" V 4980 3800 50 0001 C CNN
F 3 "~" H 5050 3800 50 0001 C CNN
1 5050 3800
0 1 1 0
$EndComp
$Comp
L Device:R R2
U 1 1 5DD98F3D
P 5050 4300
F 0 "R2" V 4843 4300 50 0000 C CNN
F 1 "470" V 4934 4300 50 0000 C CNN
F 2 "" V 4980 4300 50 0001 C CNN
F 3 "~" H 5050 4300 50 0001 C CNN
1 5050 4300
0 1 1 0
$EndComp
Wire Wire Line
5200 3800 5400 3800
Wire Wire Line
5400 3900 5200 3900
Wire Wire Line
4250 4700 3450 4700
Wire Wire Line
3450 4700 3450 3600
Wire Wire Line
3450 3200 3750 3200
Connection ~ 4250 4700
Wire Wire Line
3750 3600 3450 3600
Connection ~ 3450 3600
Wire Wire Line
3450 3600 3450 3200
Wire Wire Line
4200 3300 5400 3300
Wire Wire Line
4200 3600 4200 3300
Wire Wire Line
5200 3900 5200 4300
Wire Wire Line
4250 3800 4250 4300
Wire Wire Line
4750 4300 4900 4300
Wire Wire Line
4450 4300 4250 4300
Connection ~ 4250 4300
Wire Wire Line
4250 4300 4250 4700
Wire Wire Line
4750 3800 4900 3800
Wire Wire Line
4450 3800 4250 3800
$EndSCHEMATC
1 change: 1 addition & 0 deletions schematics/push-push/push.push.kicad_pcb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(kicad_pcb (version 4) (host kicad "dummy file") )
43 changes: 43 additions & 0 deletions schematics/push-push/push.push.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
update=22/11/2019 16:46:52
version=1
last_client=kicad
[general]
version=1
RootSch=
BoardNm=
[pcbnew]
version=1
LastNetListRead=
UseCmpFile=1
PadDrill=0.600000000000
PadDrillOvalY=0.600000000000
PadSizeH=1.500000000000
PadSizeV=1.500000000000
PcbTextSizeV=1.500000000000
PcbTextSizeH=1.500000000000
PcbTextThickness=0.300000000000
ModuleTextSizeV=1.000000000000
ModuleTextSizeH=1.000000000000
ModuleTextSizeThickness=0.150000000000
SolderMaskClearance=0.000000000000
SolderMaskMinWidth=0.000000000000
DrawSegmentWidth=0.200000000000
BoardOutlineThickness=0.100000000000
ModuleOutlineThickness=0.150000000000
[cvpcb]
version=1
NetIExt=net
[eeschema]
version=1
LibDir=
[eeschema/libraries]
[schematic_editor]
version=1
PageLayoutDescrFile=
PlotDirectoryName=
SubpartIdSeparator=0
SubpartFirstId=65
NetFmtName=
SpiceAjustPassiveValues=0
LabSize=50
ERC_TestSimilarLabels=1
Loading

0 comments on commit a6fbf14

Please sign in to comment.