Tell us about yourself!

Complete Your Profile
  • Pedro HenriqueS5 commented on ArtieJ's instructable MIDI Pod-Pal1 year ago
    MIDI Pod-Pal

    ArtieJ my code is quite simple, I make using Att85/Digispark AT85, here my code, I'm going back to desk to add the new code. Thanks//Arduino IDE Code for sending up/down MIDI signals to a Line 6 POD 2.0 with an ATTiny85//tested but offered 'as is' without support//SoftSerial instead SoftwareSerial only if using Digispark#include <SoftSerial.h> //Microcontroller is an ATiny85 so using the SoftwareSerial librarySoftSerial mySerial(2,3); //RX =2, TX = ATTiny85 pin 2, PB3; MIDI transmit pinbyte status_byte = B11000000; //Status number 192 for program\bank change, hex = C0byte count_val = 38; // Set a start variable at 38 to avoid 'rollover' error when moving down\up patches// MIDI send functionvoid send_byte(byte value) {byte patch_value = value % 37; // Set patch_value= 0 to 36 (0 i...

    see more »

    ArtieJ my code is quite simple, I make using Att85/Digispark AT85, here my code, I'm going back to desk to add the new code. Thanks//Arduino IDE Code for sending up/down MIDI signals to a Line 6 POD 2.0 with an ATTiny85//tested but offered 'as is' without support//SoftSerial instead SoftwareSerial only if using Digispark#include <SoftSerial.h> //Microcontroller is an ATiny85 so using the SoftwareSerial librarySoftSerial mySerial(2,3); //RX =2, TX = ATTiny85 pin 2, PB3; MIDI transmit pinbyte status_byte = B11000000; //Status number 192 for program\bank change, hex = C0byte count_val = 38; // Set a start variable at 38 to avoid 'rollover' error when moving down\up patches// MIDI send functionvoid send_byte(byte value) {byte patch_value = value % 37; // Set patch_value= 0 to 36 (0 is manual)// Re: Rollover, Byte type is unsigned, Binary 0 minus 1 is B11111111(255), and 255 mod 37 is 33. Hence the following count value resetif(patch_value == 1) count_val = 38; //reset count_val to avoid rollover errormySerial.write(status_byte); //send status bytemySerial.write(patch_value); //send patch value bytedelay(500); //wait (simple debounce and pause)}void setup() {DDRB = B00001000; //Set PortB direction, in on PB0 and PB1 out on PB3PORTB = B00000011; //Switch on internal pull up resistorsmySerial.begin(31250); //set MIDI baud rate (NB: Microcontroller fuses set to 8Mhz internal clock)send_byte(count_val); //Send an initial start value, = Patch A1}void loop() {byte readpins = PINB | B11111100; //read pins once per loop, unpressed switch with pullups = 1 so bitmask applied to unused bits will always TRUE if (~readpins){ //Switches have pull-ups, ~readpins will return TRUE when one is pushedbyte switch_val=~readpins; //inverse of inputsswitch (switch_val) { case B01: //Switch PB0 on {count_val-- ; send_byte(count_val);} break; case B10: //Switch PB1 on {count_val++ ; send_byte(count_val);} break;}}}

    View Instructable »