Saturday, 26 November 2016
Polyfusion - Sound A Round
Thursday, 17 November 2016
LED blink Program using interrupts
* This is a interrupt version of the classic blink LED sketch
*/
// pins
const int led_pin = PB5; // PB5 is the same as pin 13
void setup() {
// set LED pin to be a output
DDRB |=(1<< led_pin);// using port B
}
void loop() {
PORTB ^= (1<< led_pin);
delay(200); // turns LED on/off
}
Port registers allow for lower-level and faster manipulation of the i/o pins of the microcontroller on an Arduino board. The chips used on the Arduino board (the ATmega8 and ATmega168) have three ports:
- B (digital pin 8 to 13)
- C (analog input pins)
- D (digital pins 0 to 7)
Each port is controlled by three registers, which are also defined variables in the arduino language.
Tuesday, 15 November 2016
Arduino Binary Counters & MIDI - Super basic program
MIDI commands are further broken down by the following system:
The
first half of the MIDI command byte (the three bits following the MSB)
sets the type of command. More info about the meaning on each of these
commands is here.
10000000 = note off
10010000 = note on
10100000 = aftertouch
10110000 = continuous controller
11000000 = patch change
11010000 = channel pressure
11100000 = pitch bend
11110000 = non-musical commands
The last half of the command byte sets the MIDI channel. All the bytes listed above would be in channel 0, command bytes ending in 0001 would be for MIDI channel 1, and so on.
All MIDI messages start with a command byte, some messages contain one data byte, others contain two or more (see image above). For example, a note on command byte is followed by two data bytes: note and velocity.
int pin2=2;
int pin3=3;
int pin4=4;
int pin5=5;
void setup()
{
// commands
pinMode(pin2, OUTPUT);
pinMode(pin3, OUTPUT);
pinMode(pin4, OUTPUT);
pinMode(pin5, OUTPUT);
}
void loop()
{
// I want to step through each number from zero to 15
// then I want to repeat
digitalWrite(pin2, HIGH);
digitalWrite(pin3, HIGH);
digitalWrite(pin4, HIGH);
digitalWrite(pin5, HIGH);
}
int pin2=2;
int pin3=3;
int pin4=4;
int pin5=5;
int waitTime=100;
void setup()
{
// commands
pinMode(pin2, OUTPUT);
pinMode(pin3, OUTPUT);
pinMode(pin4, OUTPUT);
pinMode(pin5, OUTPUT);
}
void loop()
{
// I want to step through each number from zero to 15
// then I want to repeat
//0
digitalWrite(pin2, LOW);
digitalWrite(pin3, LOW);
digitalWrite(pin4, LOW);
digitalWrite(pin5, LOW);
delay(waitTime);
//1
digitalWrite(pin2, LOW);
digitalWrite(pin3, LOW);
digitalWrite(pin4, LOW);
digitalWrite(pin5, HIGH);
delay(waitTime);
//2
digitalWrite(pin2, LOW);
digitalWrite(pin3, LOW);
digitalWrite(pin4, LOW);
digitalWrite(pin5, LOW);
delay(waitTime);
//3
digitalWrite(pin2, LOW);
digitalWrite(pin3, LOW);
digitalWrite(pin4, HIGH);
digitalWrite(pin5, HIGH);
delay(waitTime);
//4
digitalWrite(pin2, LOW);
digitalWrite(pin3, HIGH);
digitalWrite(pin4, LOW);
digitalWrite(pin5, LOW);
delay(waitTime);
//5
digitalWrite(pin2, LOW);
digitalWrite(pin3, HIGH);
digitalWrite(pin4, LOW);
digitalWrite(pin5, HIGH);
delay(waitTime);
//6
digitalWrite(pin2, LOW);
digitalWrite(pin3, HIGH);
digitalWrite(pin4, HIGH);
digitalWrite(pin5, LOW);
delay(waitTime);
//7
digitalWrite(pin2, LOW);
digitalWrite(pin3, HIGH);
digitalWrite(pin4, HIGH);
digitalWrite(pin5, HIGH);
delay(waitTime);
//8
digitalWrite(pin2, HIGH);
digitalWrite(pin3, LOW);
digitalWrite(pin4, LOW);
digitalWrite(pin5, LOW);
delay(waitTime);
//9
digitalWrite(pin2, HIGH);
digitalWrite(pin3, LOW);
digitalWrite(pin4, LOW);
digitalWrite(pin5, HIGH);
delay(waitTime);
//10
digitalWrite(pin2, HIGH);
digitalWrite(pin3, LOW);
digitalWrite(pin4, HIGH);
digitalWrite(pin5, LOW);
delay(waitTime);
//11
digitalWrite(pin2, HIGH);
digitalWrite(pin3, LOW);
digitalWrite(pin4, HIGH);
digitalWrite(pin5, HIGH);
delay(waitTime);
//12
digitalWrite(pin2, HIGH);
digitalWrite(pin3, HIGH);
digitalWrite(pin4, LOW);
digitalWrite(pin5, LOW);
delay(waitTime);
//13
digitalWrite(pin2, HIGH);
digitalWrite(pin3, HIGH);
digitalWrite(pin4, LOW);
digitalWrite(pin5, HIGH);
delay(waitTime);
//14
digitalWrite(pin2, HIGH);
digitalWrite(pin3, HIGH);
digitalWrite(pin4, HIGH);
digitalWrite(pin5, LOW);
delay(waitTime);
//15
digitalWrite(pin2, HIGH);
digitalWrite(pin3, HIGH);
digitalWrite(pin4, HIGH);
digitalWrite(pin5, HIGH);
delay(waitTime);
}
Monday, 14 November 2016
3trins to banana breakout box
The 3trins mini patchbay is wonderful but at times difficult to see (esp in low light).
And I'm a big fan of bananas. .. they are stackable and fast.
My initial attempts were to build a permanent panel.
Soon ditched this in favour of one that I can plug in and remove when I like.
I'm using mini bananas:
Links:
https://www.muffwiggler.com/forum/viewtopic.php?p=2387506#2387506
Sunday, 13 November 2016
Step Edit - Electribe 2 (blue/grey)
Friday, 4 November 2016
TM1637 4-digit 7-segment display
// Include the library #include <TM1637Display.h>
// include the grove.seeedstudio library #include <TM1637.h> // Define the connections pins
#define CLK 2
#define DIO 3 TM1637Display(). TM1637 tm(2, 3);
TM1637Display display = TM1637Display(CLK, DIO);OR TM1637 tm(2, 3);
The code depends on the type of display you have.Before you buy it, research what library it needs. The main functions include:
- setSegments() – Set the raw value of the segments of each digit
- showNumberDec() – Display a decimal number
- showNumberDecEx() – Display a decimal number with decimal points or colon
- setBrightness() – Set the brightness of the display
- clear() – Clear the display
Here is a simple display sketch.It's actually the basic example in the ARDUINO IDE. These TM1637 Driver examples work well.They all use the#include <TM1637.h>
//************************** code 1This refers to displays that use the #include <TM1637.h> libraryTo set the brightness, pass in a value between 0-7 into tm.setBrightness(); tm.display(); will display a character on the display. You are restricted to just 4 characters. Simply type in any alpha-numeric characters you wish.
//*******************#include <TM1637.h>
// Instantiation and pins configurations
// Pin 3 - > DIO
// Pin 2 - > CLK
TM1637 tm(2, 3);
void setup()
{
tm.begin();
tm.setBrightness(4);
}
void loop()
{
// Display Integers:
tm.display(1234);
delay(1000);
// Display float:
tm.display(29.65);
delay(1000);
// Display String:
tm.display("PLAY");
delay(1000);
tm.display("STOP");
delay(1000);
}
//******************************************************* Monday, 31 October 2016
3trinsRGB+1c to LZX
They plug in here:
Links:
Muffs - cortex with 3ins
LZX
Muffs - discrete RGB output signals
......to be continued.















