Tell us about yourself!

Complete Your Profile
  • BillG40 commented on vanceg's instructable Build MIDI Bass Pedals for About $1507 months ago
    Build MIDI Bass Pedals for About $150

    https://www.arduino.cc/en/Reference/MIDIUSB

    This is all the code I use. The features:LCD - displays values for Volume, program number (least useful), MIDI transmit channel and the note assigned to the lowest pedal. Scroll button - scrolls LCD cursor through four parameters, Up and Down buttons - adjust four parameters, Panic Button - silences stuck notes (very useful).

    View Instructable »
  • BillG40 commented on vanceg's instructable Build MIDI Bass Pedals for About $1509 months ago
    Build MIDI Bass Pedals for About $150

    Hi, finally got on the right computer to copy my Arduino code. I nested a loop within the main loop to reduce latency. It actually worked. Here you go:#include <arduino2.h>#include <pins2_arduino.h>/* 4/2/16 this works with no delay LiquidCrystal Library - setCursorLiquidCrystal declaration:LiquidCrystal lcd(RS,Enable,D4,D5,D6,D7)The circuit:1 Ground2 5 Volts (VCC)3 Display Contrast (VO) - to 10kohm potentiometer wiper (pin 2)4 Register Select (RS) - controls whether writing to data register or instruction register. Command (0) or Character (1). Attached to digital pin (see above).5 Read/Write (RW) - Selects reading mode or writing mode. optional, can attach to ground per LiquidCrystal() description on Arduino.cc and Wikipedia. Write (0) or Read (1). Attached...

    see more »

    Hi, finally got on the right computer to copy my Arduino code. I nested a loop within the main loop to reduce latency. It actually worked. Here you go:#include <arduino2.h>#include <pins2_arduino.h>/* 4/2/16 this works with no delay LiquidCrystal Library - setCursorLiquidCrystal declaration:LiquidCrystal lcd(RS,Enable,D4,D5,D6,D7)The circuit:1 Ground2 5 Volts (VCC)3 Display Contrast (VO) - to 10kohm potentiometer wiper (pin 2)4 Register Select (RS) - controls whether writing to data register or instruction register. Command (0) or Character (1). Attached to digital pin (see above).5 Read/Write (RW) - Selects reading mode or writing mode. optional, can attach to ground per LiquidCrystal() description on Arduino.cc and Wikipedia. Write (0) or Read (1). Attached to ground.6 Enable (E) Attached to digital pin (see above).7 Data Bit 0 (Not used in 4-bit operation) Open8 Data Bit 1 (Not used in 4-bit operation) Open9 Data Bit 2 (Not used in 4-bit operation) Open10 Data Bit 3 (Not used in 4-bit operation) Open11 Data Bit 4 attached to digital pin (see above)12 Data Bit 5 attached to digital pin (see above)13 Data Bit 6 attached to digital pin (see above)14 Data Bit 7 attached to digital pin (see above)15 LED Backlight Anode + to 220ohm resistor to 5 Volt16 LED Backlight Cathode - to GroundThe Pot: (front view?) O1 2 31 goes to ground2 (wiper) goes to VO3 goes to 5V(hopefully this is not reversed) MIDI Female output from inside: O14253 * MIDI jack pin 4 connected to +5V through 220-ohm resistor * MIDI jack pin 2 connected to ground * MIDI jack pin 5 to digital in 1 connected */#include <LiquidCrystal.h>//Pedals: Low C through High C#define SWITCH1 30#define SWITCH2 31#define SWITCH3 32#define SWITCH4 33#define SWITCH5 34#define SWITCH6 35#define SWITCH7 36#define SWITCH8 37#define SWITCH9 38#define SWITCH10 39#define SWITCH11 40#define SWITCH12 41#define SWITCH13 42#define PEDALBOUNCE 20//Buttons will be: Select_Panic, SELECT_RIGHT, SELECT_UP, SELECT_DOWN#define Select_Panic A0#define Select_Right A1#define Select_Up A2#define Select_Down A3#define BUTTONBOUNCE 300int Buttons[17] = {SWITCH1, SWITCH2, SWITCH3, SWITCH4, SWITCH5, SWITCH6, SWITCH7, SWITCH8, SWITCH9, SWITCH10, SWITCH11, SWITCH12, SWITCH13, Select_Panic, Select_Right, Select_Up, Select_Down};int ButtonState[17] = {HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH};int currentButton = 0;int currentButtonState;int TriggeredNote[13] = {36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48};unsigned long stopTime;boolean breakLoop;//string arraysconst String LCDNoteName[12] = {"C ", "C#", "D ", "D#", "E ", "F ", "F#", "G ", "G#", "A ", "A#", "B "};const String LCDNoteOctave[11] = {" 0", "1 ", "2 ", "3 ", "4 ", "5 ", "6 ", "7 ", "8 ", "9 ", "10"};//LCD Initial Values: Volume - 0-127, Program - 0-127, Channel - 1-16, LowNote - 000(C0)-127(GC10)byte Volume = 100;byte Program = 0;byte Channel = 0;byte LowNote = 24; //C2byte LowNoteName = 0; //C or LowNote%12byte LowNoteOctave = 2; //Octave 2 or LowNote/12// LCD dimensionsconst int numRows = 2;const int numCols = 16;//Cursor Position: 1-Volume 2-Program 3-Channel 4-Low Noteint CursorPosition = 1;// initialize the LCD library with the numbers of the interface pinsLiquidCrystal lcd(14,15,16,17,18,19);void Right() { switch (CursorPosition) { case 1: lcd.setCursor(4, 1); CursorPosition = 2; break; case 2: lcd.setCursor(8, 1); CursorPosition = 3; break; case 3: lcd.setCursor(12, 1); CursorPosition = 4; break; case 4: lcd.setCursor(0, 1); CursorPosition = 1; break; }}void Up() { switch (CursorPosition) { case 1: if (Volume < 127) Volume += 1; if (Volume < 10) { lcd.print("00"); } else { if (Volume < 100) { lcd.print("0"); } } lcd.print(Volume, DEC); lcd.setCursor(0, 1); break; case 2: if (Program < 127) Program += 1; if (Program < 10) { lcd.print("00"); } else { if (Program < 100) { lcd.print("0"); } } lcd.print(Program, DEC); lcd.setCursor(4, 1); Serial.write(0xc0 + Channel); Serial.write(Program); break; case 3: if (Channel < 15) Channel += 1; lcd.print("0"); if (Channel < 9) { lcd.print("0"); } lcd.print(Channel + 1, DEC); lcd.setCursor(8, 1); break; case 4: if (LowNote < 127) LowNote += 1; for (int Counter = 0; Counter <= 13; Counter++) { TriggeredNote[Counter]++; } LowNoteName = LowNote % 12; LowNoteOctave = LowNote / 12; lcd.print (LCDNoteName[LowNoteName] + LCDNoteOctave[LowNoteOctave]); lcd.setCursor(12, 1); break; }}void Down() { switch (CursorPosition) { case 1: if (Volume > 0) Volume -= 1; if (Volume < 10) { lcd.print("00"); } else { if (Volume < 100) { lcd.print("0"); } } lcd.print(Volume, DEC); lcd.setCursor(0, 1); break; case 2: if (Program > 0) Program -= 1; if (Program < 10) { lcd.print("00"); } else { if (Program < 100) { lcd.print("0"); } } lcd.print(Program, DEC); lcd.setCursor(4, 1); Serial.write(0xc0 + Channel); Serial.write(Program); break; case 3: if (Channel > 0) Channel -= 1; lcd.print("0"); if (Channel < 9) { lcd.print("0"); } lcd.print(Channel + 1, DEC); lcd.setCursor(8, 1); break; case 4: if (LowNote > 0) LowNote -= 1; for (int Counter = 0; Counter <= 13; Counter++) { TriggeredNote[Counter]--; } LowNoteName = LowNote % 12; LowNoteOctave = LowNote / 12; lcd.print (LCDNoteName[LowNoteName] + LCDNoteOctave[LowNoteOctave]); lcd.setCursor(12, 1); break; }}void Panic(){ for (int Counter = 0; Counter <= 15; Counter++) { Serial.write(176 + Counter); Serial.write(123); Serial.write(0); }}void noteOn(int cmd, int pitch, int velocity) { Serial.write(cmd); Serial.write(pitch); Serial.write(velocity);}void setup() { // Set MIDI baud rate: Serial.begin(31250); // set up the LCD's number of columns and rows: lcd.begin(numCols, numRows); lcd.setCursor(0, 0); lcd.print("VOL PRG CHN LOW"); lcd.setCursor(0, 1); lcd.print("100 000 001 C 2"); lcd.setCursor(0, 1); lcd.cursor(); //set up buttons for ( currentButton = 0; currentButton < 17; currentButton++ ) { pinMode2( Buttons[currentButton], INPUT ); // Set pin for switch digitalWrite2( Buttons[currentButton], HIGH ); // Turn on internal pullup }}void loop() { while (true) { breakLoop = false; while (breakLoop == false) { for ( currentButton = 0; currentButton < 17; currentButton++ ) { currentButtonState = digitalRead2(Buttons[currentButton]); if (currentButton < 13) { { if (currentButtonState != ButtonState[currentButton] ) { if ( ButtonState[currentButton] == LOW ) { noteOn(0x80 + Channel, TriggeredNote[currentButton], 0x00); ButtonState[currentButton] = HIGH; } else { noteOn(0x90 + Channel, TriggeredNote[currentButton], Volume); ButtonState[currentButton] = LOW; } stopTime = millis() + PEDALBOUNCE; while (millis() < stopTime) {}; } } if (currentButton == 13 && currentButtonState == LOW) { Panic(); stopTime = millis() + BUTTONBOUNCE; while (millis() < stopTime) {}; } if (currentButton > 13 && currentButtonState == LOW) { breakLoop = true; stopTime = millis() + BUTTONBOUNCE; while (millis() < stopTime) {}; } } } breakLoop = false; while (breakLoop == false) { for ( currentButton = 0; currentButton < 17; currentButton++ ) { currentButtonState = digitalRead2(Buttons[currentButton]); if (currentButton < 13 && currentButtonState == LOW) { breakLoop = true; stopTime = millis() + PEDALBOUNCE; while (millis() < stopTime) {}; } if (currentButton == 13 && currentButtonState == LOW) { Panic(); stopTime = millis() + BUTTONBOUNCE; while (millis() < stopTime) {}; } if (currentButton == 14 && currentButtonState == LOW) { Right(); stopTime = millis() + BUTTONBOUNCE; while (millis() < stopTime) {}; } if (currentButton == 15 && currentButtonState == LOW) { Up(); stopTime = millis() + BUTTONBOUNCE; while (millis() < stopTime) {}; } if (currentButton == 16 && currentButtonState == LOW) { Down(); stopTime = millis() + BUTTONBOUNCE; while (millis() < stopTime) {}; } } } } }}

    View Instructable »
  • BillG40 commented on vanceg's instructable Build MIDI Bass Pedals for About $15010 months ago
    Build MIDI Bass Pedals for About $150

    Sorry to be slow. I ended up figuring it out myself (I was a programmer briefly in a former life). At some point as I was adding features, the latency delay between stepping on the pedal and hearing the note was too long to be useful, so I had to find my way around that as well. If this is still of interest, let me know and I'll post the current version of my code somewhere.

    I saved a lot by just using a MIDI female jack (many configurations for cheap on ebay). In fact, I tried it for free first by cutting the bad end off of an old MIDI cable. You hook it to the ground, 5V and the transmit jack on the Arduino. An app to test this is built into the Arduino suite of test programs. I tried that before I moved on to this project. Also, I save a lot by getting my knock-off MEGA from MicroCenter for $10.00 (!!!). An added benefit of buying several connections on the cheap is that you can use the extras for other projects, or to rebuild your project using lessons learned during the first attempt.

    View Instructable »
  • BillG40 commented on vanceg's instructable Build MIDI Bass Pedals for About $1501 year ago
    Build MIDI Bass Pedals for About $150

    Thank you for the nice work. It would be nice to know a couple of other ways to customize the programming and wiring:1. Octave Up/Down buttons2. MIDI channel Up/Down buttons3. LED/LCD display of MIDI channel, Octave

    View Instructable »