Show Posts
Pages: 1 [2] 3 4 ... 8
16  Using Arduino / Motors, Mechanics, and Power / advice needed for linear actuator control on: October 18, 2012, 10:10:15 am
hi

i am currently researching a few different options for a project i am working on, which invloves controlling 12 linear actuators using an arduino Mega, I have a load of these half h-bridge drivers :

http://uk.farnell.com/jsp/search/productdetail.jsp?sku=9592997

and I am hoping to use them to control the following 12v linear actuators:

http://www.ebay.co.uk/itm/12-volt-linear-actuator-with-electromechanical-clutch-/280986828141?

is this possible or should i be looking at some different h-bridge motor drivers?

i am hoping to be able to control the electromagnetic clutch on these actuators and was wondering if there was a way to do that with the EN pins on the above mentioned h-bridge driver..

any help would be greatly appreciated

17  Using Arduino / Networking, Protocols, and Devices / Re: ardOSC and WIFI library help on: September 12, 2012, 06:24:08 am
oh.. that is a shame, as it seems like a natural progression to allow for wireless control with the same capabilities as the wired option, the OSC protocol is so well suited for realtime sequencing and performance environments, i have been using the ethernet shields with great success and was really excited about the prospect of making my projects go wirelessly, the osc protocol works really well wirelessly and there are some great apps that allow for building great interfaces.. the wifi shield i am using is this one: http://arduino.cc/en/Main/ArduinoWiFiShield
which i think does support TCP/IP but again sadly this is a bit above my technical knowledge, it is frustrating knowing that there has to be a solution out there to a problem but not having the necessary skill set to realise it
18  Using Arduino / Networking, Protocols, and Devices / Re: ardOSC and WIFI library help on: September 12, 2012, 06:02:20 am
hi paul

i haven't as yet tried to resolve it - i have used this library before with the ethernet shield and it never came up with any error messages when compiling, so not really sure where to start with it. but guessing it is to do with some function of the ethernet library that it wants to connect to, i thought that is why i needed to include the SPI.h library..
19  Using Arduino / Networking, Protocols, and Devices / ardOSC and WIFI library help on: September 12, 2012, 05:36:23 am
hello

i am trying to get the ardosc library working with the wifi library to allow for some great realtime wireless control. The ArdOSC library work really well with the ethernet library and i was hoping it was going to be a straight forward port across to the wifi option (using the new arduino wifi shields) however i get some errors compiling which i am not sure how to fix. digging around online, it seems that the ardosc library uses some deep rooted functions of the ethernet library, but alas that is a bit out of my technical knowledge..

the code i have so far is this - which would just in theory allow for a fading control of an led over a wifi network using the OSC protocol:

Code:
/*
 
 This example connects to an unencrypted Wifi network.
 Then it prints the  MAC address of the Wifi shield,
 the IP address obtained, and other network details.

 Circuit:
 * WiFi shield attached
 
 created 13 July 2010
 by dlf (Metodo2 srl)
 modified 31 May 2012
 by Tom Igoe
 */
 #include <SPI.h>
#include <ArdOSC.h>
#include <WiFi.h>

char ssid[] = "kazimier_workshop";     //  your network SSID (name)
char pass[] = "password";  // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status


int serverPort  = 9000;
int destPort=12000;

long val1 = 0;


OSCServer server;
OSCClient client;
int led1 = 6;

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
 
  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while(true);
  }
 
 // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network:   
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  }
   
  // you're connected now, so print out the data:
  Serial.print("You're connected to the network");
 
  server.begin(serverPort);
 
   server.addCallback("/1/light1",&func1);
}

void loop() {
  // check the network connection once every 10 seconds:
    if(server.aviableCheck()>0){
  Serial.println("alive! ");
  }
  analogWrite(led1, val1);
}


void func1(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val1 = (long)(value*255);
  Serial.println(val1);
}

when i try to compile i get the following messages:

Code:
/Applications/Arduino.app/Contents/Resources/Java/libraries/ArdOSC/OSCClient.cpp:22:27: error: utility/w5100.h: No such file or directory
/Applications/Arduino.app/Contents/Resources/Java/libraries/ArdOSC/OSCClient.cpp: In member function 'int16_t OSCClient::sockOpen()':
/Applications/Arduino.app/Contents/Resources/Java/libraries/ArdOSC/OSCClient.cpp:39: error: 'W5100' was not declared in this scope
/Applications/Arduino.app/Contents/Resources/Java/libraries/ArdOSC/OSCClient.cpp:40: error: 'SnSR' has not been declared
/Applications/Arduino.app/Contents/Resources/Java/libraries/ArdOSC/OSCClient.cpp:40: error: 'SnSR' has not been declared
/Applications/Arduino.app/Contents/Resources/Java/libraries/ArdOSC/OSCClient.cpp:48: error: 'SnMR' has not been declared

does anyone have any suggestions? or any experience with this?

all help greatly appreciated -

20  Community / Exhibition / Gallery / Re: Multi Stepper OSC controlled Bird boxes on: August 16, 2012, 04:05:48 am
we do actually have a lot of seagulls around here.. and yes they were a bit confused for a while especially when the birds of prey sounds come on...
21  Community / Exhibition / Gallery / Multi Stepper OSC controlled Bird boxes on: August 15, 2012, 09:37:43 am
Hello
Just wanted to write about a little project I recently completed for a pop-up outdoor garden space we have set up here in liverpool. The devices comprise of 4 wooden birdboxes equipped with speakers, stepper motors and LEDs. The devices are controlled through an Arduino Mega running the AccelStepper library and an ethernet shield. The stepper positions and led brightness is sequnced live using OSC over an ethernet shield using the wonderful ArdOSC library, the advantage being that we were able to talk to the birdboxes directly out of Ableton Live and easily address all the different parameters as well as use touchOSC for realtime control. The whole system is synced live using Ableton.


a short video of them in action:









below is the code used for the motors:

Code:
#include <SPI.h>
#include <Ethernet.h>
#include <ArdOSC.h>
#include <AccelStepper.h>

byte myMac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte myIp[]  = { 192, 168, 1, 100 };
int serverPort  = 10000;
int destPort=12000;
// int ledPin =  12;

int flag=0;

OSCServer server;
OSCClient client;
AccelStepper stepper1(4,2,3,56,5);
AccelStepper stepper2(4,6,7,8,9);
AccelStepper stepper3(4,12,13,54,55);
AccelStepper stepper4(4,14,15,16,17);
AccelStepper stepper5(4,18,19,20,21);
AccelStepper stepper6(4,22,23,24,25);
AccelStepper stepper7(4,26,27,28,29);
// initialize the stepper library on pins 8 through 11:


long val1 = 0;
long val2 = 0;
long val3 = 0;
long val4 = 0;
long val5 = 0;
long val6 = 0;
long val7 = 0;



void setup(){
  
 Serial.begin(9600);
 
 Ethernet.begin(myMac ,myIp);
 server.begin(serverPort);
 
 //set callback function & oscaddress
 server.addCallback("/1/fader1",&func1);
 server.addCallback("/1/fader2",&func2);
  server.addCallback("/1/fader3",&func3);
   server.addCallback("/1/fader4",&func4);
    server.addCallback("/1/fader5",&func5);
     server.addCallback("/1/fader6",&func6);
      server.addCallback("/1/fader7",&func7);
 
 // pinMode(ledPin, OUTPUT);  
 // stepper.setSpeed(50);
 stepper1.setMaxSpeed(100.0);
 stepper1.setAcceleration(50.0);
 stepper2.setMaxSpeed(150.0);
 stepper2.setAcceleration(100.0);
  stepper3.setMaxSpeed(200.0);
 stepper3.setAcceleration(150.0);
  stepper4.setMaxSpeed(250.0);
 stepper4.setAcceleration(200.0);
  stepper5.setMaxSpeed(300.0);
 stepper5.setAcceleration(250.0);
  stepper6.setMaxSpeed(350.0);
 stepper6.setAcceleration(300.0);
  stepper7.setMaxSpeed(400.0);
 stepper7.setAcceleration(350.0);
 
}
  
void loop(){
  
  if(server.aviableCheck()>0){
 //    Serial.println("alive! ");
  }
  stepper1.moveTo(val1);
  stepper1.run();
  stepper2.moveTo(val2);
  stepper2.run();
   stepper3.moveTo(val3);
  stepper3.run();
   stepper4.moveTo(val4);
  stepper4.run();
   stepper5.moveTo(val5);
  stepper5.run();
   stepper6.moveTo(val6);
  stepper6.run();
   stepper7.moveTo(val7);
  stepper7.run();
  
  pinMode(54, OUTPUT);
  pinMode(55, OUTPUT);
  pinMode(56, OUTPUT);
  pinMode(57, OUTPUT);
  
}


void func1(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val1 = (long)(value*200);
  Serial.println(val1);
}

void func2(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val2 = (long)(value*200);
  Serial.println(val2);
}

void func3(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val3 = (long)(value*200);
  Serial.println(val3);
}

void func4(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val4 = (long)(value*200);
  Serial.println(val4);
}

void func5(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val5 = (long)(value*200);
  Serial.println(val5);
}

void func6(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val6 = (long)(value*200);
  Serial.println(val6);
}

void func7(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val7 = (long)(value*200);
  Serial.println(val7);
}


code used for controlling LED's

Code:
#include <SPI.h>
#include <Ethernet.h>
#include <ArdOSC.h>


byte myMac[] = { 0xDA, 0xFE, 0xBA, 0xEE, 0xEF, 0xDE };
byte myIp[]  = { 192, 168, 1, 200 };
int serverPort  = 9000;
int destPort=12000;
// int ledPin =  12;

//int flag=0;

OSCServer server;
OSCClient client;
int led1 = 3;
int led2 = 5;
int led3 = 6;
int led4 = 9;
int led5 = 10;
int led6 = 14;


// initialize the stepper library on pins 8 through 11:


long val1 = 0;
long val2 = 0;
long val3 = 0;
long val4 = 0;
long val5 = 0;
long val6 = 0;




void setup(){
  
 Serial.begin(9600);
 
 Ethernet.begin(myMac ,myIp);
 server.begin(serverPort);
 
 //set callback function & oscaddress
 server.addCallback("/1/light1",&func1);
 server.addCallback("/1/light2",&func2);
  server.addCallback("/1/light3",&func3);
   server.addCallback("/1/light4",&func4);
    server.addCallback("/1/light5",&func5);
     server.addCallback("/1/light6",&func6);
 
 pinMode(led6, OUTPUT);    
 
 // pinMode(ledPin, OUTPUT);  
 // stepper.setSpeed(50);

 
}
  
void loop(){
  
  if(server.aviableCheck()>0){
 //    Serial.println("alive! ");
  }
  analogWrite(led1, val1);
  analogWrite(led2, val2);
  analogWrite(led3, val3);
  analogWrite(led4, val4);
  analogWrite(led5, val5);
  analogWrite(led6, val6);

  
}


void func1(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val1 = (long)(value*255);
  //Serial.println(val1);
}

void func2(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val2 = (long)(value*255);
  //Serial.println(val2);
}

void func3(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val3 = (long)(value*255);
  //Serial.println(val3);
}

void func4(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val4 = (long)(value*255);
  //Serial.println(val4);
}

void func5(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val5 = (long)(value*255);
  //Serial.println(val5);
}

void func6(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val6 = (long)(value*255);
  //Serial.println(val6);
}




22  Using Arduino / Programming Questions / Re: multi stepper motor control question on: May 22, 2012, 09:13:07 am
hi paul - thanks for your reply and apologies for my clunky language.
trying to identify a way of telling the stepper that more than one rotation is required is exactly the problem. I had an idea of mapping  the osc data to a larger number of steps for example 10000 which would give me up to a maximum of 5 revolutions, but it just doesn't seem like the ideal solution. The OSC data is very precise, and can have as many decimal places as needed to increase accuracy, but being able to draw out interesting movement patterns in a sequencing software would become a lot more cumbersome. There is no way to have a value higher than 1 within OSC as far as I am aware..

with regards to being able to loop the motor - i guess what i was trying to say if there was a way to tell the motor that once it has gone past step 200 it is in effect back at step 0, and therefore able to begin the next rotational cycle without having to go backwards back to 0 which is what it currently has to do.
23  Using Arduino / Programming Questions / multi stepper motor control question on: May 22, 2012, 08:37:17 am
hello

I have been working for a bit of time on building a multi-stepper OSC controlled system. with some pretty good results, the code below gives me realtime control of multiple stepper motors using OSC ( i have been using Ableton Live for sequencing movement patters). However there is a limitation with the code I currently have, the OSC data coming in ranges from 0 - 1 this is in turn converted into 0-200 steps for the motors to move (the steppers I use have 1.8 degree incrementation). At the moment I can essentially control one rotation of the motor, I am keen to figure out a way where as the motor can be wound on multiple times, i.e. be able to turn it 5 rotations ... i guess this could be viewed as step 1000.. or if there was a way to send information in such a way that the motor can loop on itself. This way using audio sequencing software the motors would behave almost like musical loops, just continually looping for the duration of the track and at the same time completely indexable within the loop. I am not sure if I am doing a good job of explaining the problem.. but any help or advice is greatly appreciated.

Code:
#include <SPI.h>
#include <Ethernet.h>
#include <ArdOSC.h>
#include <AccelStepper.h>

byte myMac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte myIp[]  = { 192, 168, 1, 100 };
int serverPort  = 10000;
int destPort=12000;


int flag=0;

OSCServer server;
OSCClient client;
AccelStepper stepper1(4,2,3,56,5);
AccelStepper stepper2(4,6,7,8,9);
AccelStepper stepper3(4,12,13,54,55);
AccelStepper stepper4(4,14,15,16,17);
AccelStepper stepper5(4,18,19,20,21);
AccelStepper stepper6(4,22,23,24,25);
AccelStepper stepper7(4,26,27,28,29);



long val1 = 0;
long val2 = 0;
long val3 = 0;
long val4 = 0;
long val5 = 0;
long val6 = 0;
long val7 = 0;



void setup(){
 
 Serial.begin(9600);
 
 Ethernet.begin(myMac ,myIp);
 server.begin(serverPort);
 
 //set callback function & oscaddress
 server.addCallback("/1/fader1",&func1);
 server.addCallback("/1/fader2",&func2);
  server.addCallback("/1/fader3",&func3);
   server.addCallback("/1/fader4",&func4);
    server.addCallback("/1/fader5",&func5);
     server.addCallback("/1/fader6",&func6);
      server.addCallback("/1/fader7",&func7);
 

 stepper1.setMaxSpeed(300.0);
 stepper1.setAcceleration(200.0);
 stepper2.setMaxSpeed(300.0);
 stepper2.setAcceleration(200.0);
  stepper3.setMaxSpeed(300.0);
 stepper3.setAcceleration(200.0);
  stepper4.setMaxSpeed(300.0);
 stepper4.setAcceleration(200.0);
  stepper5.setMaxSpeed(300.0);
 stepper5.setAcceleration(200.0);
  stepper6.setMaxSpeed(300.0);
 stepper6.setAcceleration(200.0);
  stepper7.setMaxSpeed(300.0);
 stepper7.setAcceleration(200.0);
 
}
 
void loop(){
 
  if(server.aviableCheck()>0){
 //    Serial.println("alive! ");
  }
  stepper1.moveTo(val1);
  stepper1.run();
  stepper2.moveTo(val2);
  stepper2.run();
   stepper3.moveTo(val3);
  stepper3.run();
   stepper4.moveTo(val4);
  stepper4.run();
   stepper5.moveTo(val5);
  stepper5.run();
   stepper6.moveTo(val6);
  stepper6.run();
   stepper7.moveTo(val7);
  stepper7.run();
 
  pinMode(54, OUTPUT);
  pinMode(55, OUTPUT);
  pinMode(56, OUTPUT);
  pinMode(57, OUTPUT);
 
}


void func1(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val1 = (long)(value*200);
  Serial.println(val1);
}

void func2(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val2 = (long)(value*200);
  Serial.println(val2);
}

void func3(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val3 = (long)(value*200);
  Serial.println(val3);
}

void func4(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val4 = (long)(value*200);
  Serial.println(val4);
}

void func5(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val5 = (long)(value*200);
  Serial.println(val5);
}

void func6(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val6 = (long)(value*200);
  Serial.println(val6);
}

void func7(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  val7 = (long)(value*200);
  Serial.println(val7);
}
24  Using Arduino / Programming Questions / AccelStepper problem on: May 08, 2012, 02:43:10 am
hi

not sure if this should go in programming or general electronics... trying to get the AccelStepper library to work and just not making any headway. I have the hardware setup exactly as in the tutorial for MotorKnob from the stepper library (http://arduino.cc/it/Tutorial/MotorKnob) with the  SN754410NE H-Bridge chip to drive it. When I run the example stepper code on it - all works fine :(i have my stepper plugged in on pins 14,15,16,17)

Code:
#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 100

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 14, 15, 16, 17);

// the previous reading from the analog input
int previous = 0;

void setup()
{
  // set the speed of the motor to 30 RPMs
  stepper.setSpeed(30);
}

void loop()
{
  // get the sensor value
  int val = analogRead(0);

  // move a number of steps equal to the change in the
  // sensor reading
  stepper.step(val - previous);

  // remember the previous value of the sensor
  previous = val;
}

but when i try to run on the same setup the basic AccelStepper code :

Code:
// ConstantSpeed.pde
// -*- mode: C++ -*-
//
// Shows how to run AccelStepper in the simplest,
// fixed speed mode with no accelerations
/// \author  Mike McCauley (mikem@open.com.au)
// Copyright (C) 2009 Mike McCauley
// $Id: ConstantSpeed.pde,v 1.1 2011/01/05 01:51:01 mikem Exp mikem $

#include <AccelStepper.h>

AccelStepper stepper(14, 15, 16, 17);

void setup()

   stepper.setMaxSpeed(1000);
   stepper.setSpeed(50);
}

void loop()

   stepper.runSpeed();
}

I get nothing- the stepper just does not move at all. As far as I could tell from my research online I was under the impression that the code should work with the same schematic as for the stepper library and with that H-bridge. I know that the hardware does work and there is no fault there.. but something just doesn't add up.

Was wondering if anyone had much experience with the AccelStepper library and had any working examples?

thank you for your time..
25  Using Arduino / General Electronics / Re: 2 metre range sensor question on: April 26, 2012, 06:34:15 am
thanks again -
i actually managed to get the desired result by using a much more powerful IR led - seems to work - it is just real fidgety aligning the two over such a distance..
26  Using Arduino / General Electronics / Re: 2 metre range sensor question on: April 25, 2012, 12:02:26 pm
hey mike

thanks for your reply - sensor looks great but uses 3 pins.. it is really annoying trying to find a 2 pin solution to this problem - hence been looking at solutions like this: http://www.optekinc.com/datasheets/OPB100Z.pdf but the range is just not there / and not consistent..
will keep looking
27  Using Arduino / General Electronics / 2 metre range sensor question on: April 25, 2012, 11:53:07 am
hello

quick question - was wondering if anyone had much experience getting a good infra red signal working over a 2 metre range... need to build a circuit using ideally an infra-red emitter and receiver that can work across a 2 metre range and give an interrupt every time the beam is broken, i have done this kind of project before but never across such a long distance and am having problems getting a consistent result. I have played with the sonar sensors which work well across this range but annoyingly enough i need to retrofit this into a door frame which has a pair of  2 core cable running to either side, so need to use some kind of transmitter / receiver setup which only uses 2 wires for each one. any ideas?

thanks in advance
28  Forum 2005-2010 (read only) / Syntax & Programs / Re: slowing down a rotary encoder data output on: September 30, 2010, 11:06:54 am
hey korman

thanks for that - and the explanation. it works perfectly.
will get a video of it up next week once we set it all up in the space
thanks again for all your help
29  Forum 2005-2010 (read only) / Syntax & Programs / Re: slowing down a rotary encoder data output on: September 30, 2010, 06:13:16 am
hi Mike - sorry i didn't notice your suggestion.
I just tried it and it does loop the counter however the counter only goes up to 42 when using this method. the reset function seems to do it - but i am not sure if this is the most appropriate way of solving the problem.
this is for an evening we are hosting in Manchester on the 7th of October as part of the A.N.D festival. the event itself will take place in St Peter's church in ancoats.
here is a bit more information about it - if you fancy coming down:
http://www.thekazimier.co.uk/factum_libero.htm
30  Forum 2005-2010 (read only) / Syntax & Programs / Re: slowing down a rotary encoder data output on: September 30, 2010, 05:13:13 am
quick update - i introduced the reset function into the code and it loops pretty cleanly now, which is great. the only downside of this solution is that the rotation only resets in one way i.e. the crank has to be turned in one direction for the counter to reset itself (the reset function is called when the printing_byte reaches 127). for the purpose of this project + time scale this will do but the ability to rotate the crank in both directions would be preferable, not really sure how to implement that though..

here is how the code looks now:
Code:

/* Rotary encoder read example */

#define ENC_A 14
#define ENC_B 15
#define ENC_PORT PINC
 byte printing_byte = 0;
 byte incomingByte;
byte note;
byte velocity;
int pot;

int strobe1 = 3;
int strobe2 = 4;
int strobe3 = 5;
int strobe4 = 6;
byte byte1;
byte byte2;
byte byte3;
void(* resetFunc) (void) = 0;

static int counter = 0;
int8_t tmpdata;
const int WheelSpeed = 3;


void setup()
{
  /* Setup encoder pins as inputs */
  pinMode(ENC_A, INPUT);
  digitalWrite(ENC_A, HIGH);
  pinMode(ENC_B, INPUT);
  digitalWrite(ENC_B, HIGH);
  pinMode(strobe1, OUTPUT);
  pinMode(strobe2, OUTPUT);
  pinMode(strobe3, OUTPUT);
  pinMode(strobe4, OUTPUT);
  Serial.begin (31250);

}
 
void loop()
{
 static int counter = 0;      //this variable will be changed by encoder input      
 int8_t tmpdata;
 /**/
  tmpdata = read_encoder();
  if( tmpdata ) {
    counter += tmpdata;
// Constrain counter. I assume 127 is the maximum you need for output.
   counter = constrain (counter, 0, 127 * WheelSpeed);
   printing_byte = counter / WheelSpeed;
   if(printing_byte == 127){
     resetFunc();}
    Midi_Send(0xB0, 10, printing_byte);
  if((printing_byte >= 3) && (printing_byte < 6)){
    digitalWrite(strobe1, HIGH);
  }
    else{
      digitalWrite(strobe1, LOW);
    }
    
     if((printing_byte >= 33) && (printing_byte < 36)){
    digitalWrite(strobe2, HIGH);
  }
    else{
      digitalWrite(strobe2, LOW);
    }
    
     if((printing_byte >= 63) && (printing_byte < 66)){
    digitalWrite(strobe3, HIGH);
  }
    else{
      digitalWrite(strobe3, LOW);
    }
      if((printing_byte >= 96) && (printing_byte < 99)){
    digitalWrite(strobe4, HIGH);
  }
    else{
      digitalWrite(strobe4, LOW);
    }
}
  
}
 
/* returns change in encoder state (-1,0,1) */
int8_t read_encoder()
{
  int8_t enc_states[] = {0,-1,1,0,1,0,0,-1,-1,0,0,1,0,1,-1,0};
  static uint8_t old_AB = 0;
  /**/
  old_AB <<= 2;                   //remember previous state
  old_AB |= ( ENC_PORT & 0x03 );  //add current state
  return ( enc_states[( old_AB & 0x0f )]);  
  int8_t tmpdata;
 
}

void Midi_Send(byte cmd, byte data1, byte data2) {
  Serial.print(cmd, BYTE);
  Serial.print(data1, BYTE);
  Serial.print(data2, BYTE);

}
Pages: 1 [2] 3 4 ... 8