Show Posts
Pages: [1] 2
1  Using Arduino / Installation & Troubleshooting / Re: Can no longer upload from my MacBook Pro, can upload from another on: February 15, 2013, 02:32:29 pm
Hm. No, I am not. I just successfully uploaded to both Leonardo and Uno... But I am not sure what changed to allow me to upload now when I couldn't before.
Here's hoping I can keep it!

Thanks all.
2  Using Arduino / Installation & Troubleshooting / Re: Can no longer upload from my MacBook Pro, can upload from another on: February 15, 2013, 08:37:32 am
Thanks for your reply paparomeo. In fact I have already tried different USB cables and it is no help. In fact, I can successfully upload using any USB cable from a different computer but that same cable still will not work from my own.
3  Using Arduino / Installation & Troubleshooting / Re: Can no longer upload from my MacBook Pro, can upload from another on: February 14, 2013, 10:41:02 pm
Yes, how embarrassing. I had already made such confirmations on my way through the troubleshooting guide but neglected to do so when I returned to the upload attempt so I could capture that text.

I have now double checked port and board assignments are correct. I have updated and edited the verbose report from the Leonardo above, and omitted the Uno report, because I was having difficulty keeping the post under the max character restriction. An attachment to the original post includes the full text which exceeds 9500 characters.
4  Using Arduino / Installation & Troubleshooting / Re: Can no longer upload from my MacBook Pro, can upload from another on: February 14, 2013, 09:13:45 pm
I should add that I have also read a number of other threads on this forum relating to avrdude and have not found a solution even when other posters have. And, man, there sure are a lot of avrdude posts on this board!
5  Using Arduino / Installation & Troubleshooting / Can no longer upload from my MacBook Pro, can upload from another on: February 14, 2013, 09:11:46 pm
Mac 10.7.5
Leonardo and Uno
I was able to upload from my computer until recently. Changes since my last Arduino project that may have effect: recent update to Java, and installation of Emacs for a course I enrolled in and subsequently dropped. I removed Emacs with AppCleaner with no change.

I have tried the troubleshooting steps from the Guide. I can see my Arduino on the serial port, and it gets power and the L LED is lit. I tried a Loop-back test and, believing I did it right, it passed. (During the Loop-back test, I observed the Tx and Rx LEDs on the board lighting up every time I pressed a key, and with the Terminal screen split, I saw the letters typed appear in the second pane.)

I am able to successfully upload a sketch from another MacBook with the same OS version. I have tried rebooting and repairing permissions on my own MacBook Pro with no change. I don't know how to see what if anything is holding on to my serial port, if that is what is keeping the Arduino from responding.

With thanks in advance, can someone help me get my upload functionality back?

verbose output from Leonardo:
Code:
Binary sketch size: 6,064 bytes (of a 28,672 byte maximum)
Forcing reset using 1200bps open/close on port /dev/cu.usbmodemfa131
PORTS {/dev/tty.usbmodemfa131, /dev/cu.usbmodemfa131, /dev/tty.Bluetooth-Modem, /dev/cu.Bluetooth-Modem, /dev/tty.GavinsiPhone-WirelessiAP, /dev/cu.GavinsiPhone-WirelessiAP, /dev/tty.Bluetooth-PDA-Sync, /dev/cu.Bluetooth-PDA-Sync, } / {/dev/tty.usbmodemfa131, /dev/cu.usbmodemfa131, /dev/tty.Bluetooth-Modem, /dev/cu.Bluetooth-Modem, /dev/tty.GavinsiPhone-WirelessiAP, /dev/cu.GavinsiPhone-WirelessiAP, /dev/tty.Bluetooth-PDA-Sync, /dev/cu.Bluetooth-PDA-Sync, } => {}
PORTS {/dev/tty.usbmodemfa131, /dev/cu.usbmodemfa131, /dev/tty.Bluetooth-Modem, /dev/cu.Bluetooth-Modem, /dev/tty.GavinsiPhone-WirelessiAP, /dev/cu.GavinsiPhone-WirelessiAP, /dev/tty.Bluetooth-PDA-Sync, /dev/cu.Bluetooth-PDA-Sync, } / {/dev/tty.usbmodemfa131, /dev/cu.usbmodemfa131, /dev/tty.Bluetooth-Modem, /dev/cu.Bluetooth-Modem, /dev/tty.GavinsiPhone-WirelessiAP, /dev/cu.GavinsiPhone-WirelessiAP, /dev/tty.Bluetooth-PDA-Sync, /dev/cu.Bluetooth-PDA-Sync, } => {}
Uploading using selected port: /dev/cu.usbmodemfa131
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega32u4 -cavr109 -P/dev/cu.usbmodemfa131 -b57600 -D -Uflash:w:/var/folders/v3/t3w8h12n7d11rxr23js97_5c0000gn/T/build2180696007194724475.tmp/MIDI_STEPPER_SANDBOX_V6.cpp.hex:i

avrdude: Version 5.11, compiled on Sep  2 2011 at 18:52:52
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/gavin/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.usbmodemfa131
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

...much of this report has been edited for brevity due to character restrictions on the post. All text preserved in the attachement.....

avrdude: verifying ...
avrdude: 6064 bytes of flash verified
avrdude: Send: L [4c]
avrdude: Recv: . [0d]
avrdude: Send: E [45]
avrdude: Recv: . [0d]

avrdude done.  Thank you.

6  Using Arduino / Project Guidance / Re: Sparkfun Ardumoto and Pololu 1208 stepper motor on: February 14, 2013, 08:12:20 am
Update: I picked up an EasyDriver and my sketches are working now that I have abandoned the Ardumoto.
7  Using Arduino / Project Guidance / Re: Sparkfun Ardumoto and Pololu 1208 stepper motor on: February 11, 2013, 09:34:49 am
*crickets*
8  Using Arduino / Project Guidance / Sparkfun Ardumoto and Pololu 1208 stepper motor on: February 08, 2013, 04:10:28 pm
(Yesterday, I posted this on the Sparkfun forum but have not had much come from that. Since I TIA for any guidance you can give.)

I am unable to control my stepper motor and have tried every possible wiring combination to the Ardumoto.
I have tried a number of sketch examples including the sparkfun example sketch, those included in the Arduino Stepper library and the Arduino tutorial, and the stepper motor sketch from the Arduino Cookbook. In every case I have confirmed that I am setting 200 steps if the sketch isn't already written for that number.

When I run a sketch, if wired certain ways, I get no apparent activity but can feel tension on the rod. I suspect this means that the motor is powered and using current just to stay in place. If I wire other ways, I get a very choppy movement, almost as though the rod is going back and forth very quickly. I thought this might mean too little current or a phase issue but the guy at my electronics store suggested that my 12V 3A power supply is sufficient, and changing the wiring configuration doesn't provide any other result.

Does anyone have any insight into this problem?
Can someone confirm which colour wire should be connected to A(1, 2) and B(3, 4) on the Ardumoto?


Arduino Uno w/ external power 9V 500mA
Ardumoto w/ external power 12V 3A
Pololu 1208 bipolar stepper motor (10V, 500mA per coil, 200steps)

9  Using Arduino / Project Guidance / Re: Send once [Uno + Sparkfun MIDI Breakout] on: October 30, 2012, 12:20:40 pm
I re-read the Bounce documentation which allowed me a more comprehensive understanding of what that library can do for me, and I think that I have found a more elegant way to program this sketch by using Bounce to tidy up some redundancies in my sketch.

That said, I am still frequently recording more than one MIDI message per button contact. I am going to try to some different buttons when I can get some later in the week, but if there is any further wisdom on this problem it would be much appreciated!

I have tried bounce values as small as 5 ms and as great as 1000 ms with this code:
Also, further to a comment from Nick Gammon earlier in this thread, the buttons are on pull-down, not pull-up. (Is pull-up better and why?)


Code:
#include <MIDI.h>
#include <Bounce.h>

// set the pins:
const int buttonStop = 2;
const int buttonGo = 3;
const int buttonLast = 4;
const int buttonNext = 5;   

// debounce the pushbuttons at 500 milliseconds:
Bounce bounceStop = Bounce(buttonStop, 5);
Bounce bounceGo = Bounce(buttonGo, 5);
Bounce bounceLast = Bounce(buttonLast, 5);
Bounce bounceNext = Bounce(buttonNext, 5);

void setup() {
 
  MIDI.begin();   
   
  // initialize the pushbutton pin as an input:
  pinMode(buttonStop, INPUT); 
  pinMode(buttonGo, INPUT);
  pinMode(buttonLast, INPUT);
  pinMode(buttonNext, INPUT); 
}

void loop(){

// check to see if the state of the buttons has changed. if a button has been pushed, send a MIDI message:
    if (bounceStop.update() && bounceStop.read() == HIGH) {   
     MIDI.sendNoteOn(1,127,5);
     Bounce bounceStop = Bounce(buttonStop, 100);
  }
 
    if (bounceGo.update() && bounceGo.read() == HIGH) {       
       MIDI.sendNoteOn(2,127,5);
       Bounce bounceGo = Bounce(buttonGo, 100);
    }
 
    if (bounceLast.update() && (bounceLast.read() == HIGH)) {       
       MIDI.sendNoteOn(3,127,5); 
       Bounce bounceLast = Bounce(buttonLast, 100);
    }
 
    if (bounceNext.update() && bounceNext.read() == HIGH) {       
       MIDI.sendNoteOn(4,127,5);
       Bounce bounceNext = Bounce(buttonNext, 100);
    }
 
}

I am immensely grateful for your help and guidance.
10  Using Arduino / Project Guidance / Re: Send once [Uno + Sparkfun MIDI Breakout] on: October 29, 2012, 06:08:14 pm
Indeed, I will hope to do something that doesn't involve a delay, because as I understand it, while the delay is counted, the sketch is essentially paused. This is why I included the bounce library; so that the sketch will remain active.
11  Using Arduino / Project Guidance / Re: Send once [Uno + Sparkfun MIDI Breakout] on: October 29, 2012, 10:42:20 am
Ah! Thanks so much. This is getting me closer and I am seeing the logic now.

Some experiementation yet... It looks like I might have to fuss with debounce times or something because I am not yet recording 100% consistent results with button pushes but I am definitely seeing considerable progress, thanks to your help!
12  Using Arduino / Project Guidance / Re: Send once [Uno + Sparkfun MIDI Breakout] on: October 28, 2012, 05:55:13 pm
I guess I am not sure how to do that. Tomorrow I am going to simplify my code to have just one button until I get this working properly, and then add the other buttons back after I am successful. In the meantime, I have tried creating a variable that will hold the last value recorded by the digitalRead and then use it to compare the states required in the if statements, but I am not quite making the jump in logic necessary. You can see two of my attempts below, marked by comments. I tried a couple of other things but forget what they were exactly but they produced no MIDI message.

Code:
void loop(){
 
  // read the state of the pushbutton value:
  stopState = digitalRead(buttonStop);
  goState = digitalRead(buttonGo);
  lastState = digitalRead(buttonLast);
  nextState = digitalRead(buttonNext);
 
  stopwas = stopState;
  gowas = goState;
  lastwas = lastState;
  nextwas = nextState;
 
  // update the debouncer:
  bounceStop.update ( );
  bounceGo.update ( );
  bounceLast.update ( );
  bounceNext.update ( );

  // get the update value:
 int valueStop = bounceStop.read();
 int valueGo = bounceGo.read();
 int valueLast = bounceLast.read();
 int valueNext = bounceNext.read();


  // if a button is pressed, send a MIDI message:
  if (stopwas != stopState) {                                          // here I just tried to succeed by comparing the difference in variables
    MIDI.sendNoteOn(1,127,5);                                       // this MIDI message never fires under these conditions.
    Bounce bounceStop = Bounce(buttonStop,5);
  }
 
    if (gowas == LOW && goState == HIGH) {                  // another way of comparing the variables
    MIDI.sendNoteOn(2,127,5);                                      // again, this MIDI message never fires under these conditions.
    Bounce bounceGo = Bounce(buttonGo,5); 
  }
 
    if (lastwas == LOW && lastState == HIGH) {     
    MIDI.sendNoteOn(3,127,5); 
    Bounce bounceLast = Bounce(buttonLast,5);
  }
 
    if (nextwas == LOW && nextState == HIGH) {     
    MIDI.sendNoteOn(4,127,5);
    Bounce bounceNext = Bounce(buttonNext,5);
  }
 
}

Note: I have changed the title of the thread to 'Send Once' rather than 'Run Once' because, of course, I want the sketch to continue running, but only send the MIDI command once when a button is pushed.
13  Using Arduino / Project Guidance / Send once [Uno + Sparkfun MIDI Breakout] on: October 27, 2012, 04:59:00 pm
// If you are new to this thread, it might save you time to skip to a point of some changes: Reply #8 http://arduino.cc/forum/index.php/topic,129428.msg977188.html#msg977188

I am developing an Arduino MIDI controller for theatrical playback software: a set of pushbuttons that send a MIDI command to an audio playback application. Stop, Go, Previous-cue-in-list, and Next-cue-in-list are the desired commands, which take the form of Note On messages in the playback application.

I have made extensive use of the MIDI, Debounce, and Pushbutton tutorials.

The problem at hand is that I only want the MIDI Note On sent a single time with each button push. As I have it programmed now, it is being read by MIDI Monitor for the entire duration that the button is pressed. Any thoughts?


Code:
#include <MIDI.h>
#include <Bounce.h>

// set the pins:

const int buttonStop = 2;
const int buttonGo = 3;
const int buttonLast = 4;
const int buttonNext = 5;  

// variables for reading the pushbutton status:

int stopState = 0;        
int goState = 0;  
int lastState = 0;  
int nextState = 0;

// debounce the pushbuttons at 5ms:
Bounce bounceStop = Bounce(buttonStop,5);
Bounce bounceGo = Bounce(buttonGo,5);
Bounce bounceLast = Bounce(buttonLast,5);
Bounce bounceNext = Bounce(buttonNext,5);

void setup() {
  
  // start MIDI with input channel set to 4
  MIDI.begin(4);            
  
  // initialize the pushbutton pin as an input:
  pinMode(buttonStop, INPUT);  
  pinMode(buttonGo, INPUT);
  pinMode(buttonLast, INPUT);
  pinMode(buttonNext, INPUT);  
}

void loop(){
  
  // read the state of the pushbutton value:
  stopState = digitalRead(buttonStop);
  goState = digitalRead(buttonGo);
  lastState = digitalRead(buttonLast);
  nextState = digitalRead(buttonNext);
  
  // update the debouncer:
  bounceStop.update ( );
  bounceGo.update ( );
  bounceLast.update ( );
  bounceNext.update ( );

  // get the update value:
 int valueStop = bounceStop.read();
 int valueGo = bounceGo.read();
 int valueLast = bounceLast.read();
 int valueNext = bounceNext.read();


  // if a button is pressed, send a MIDI message:
  if (stopState == HIGH) {    
    MIDI.sendNoteOn(1,127,5);
  }
  
    if (goState == HIGH) {    
    MIDI.sendNoteOn(2,127,5);
  }
  
    if (lastState == HIGH) {    
    MIDI.sendNoteOn(3,127,5);  
  }
  
    if (nextState == HIGH) {    
    MIDI.sendNoteOn(4,127,5);
  }
 
}

I have tried removing all the debounce programming from my sketch. No change.
I have tried increasing my debounce interval to as much as 1 second. No change.
I have tried setting the button status back to 0 after the NoteOn, like this:

Code:
 if (stopState == HIGH) {    
    MIDI.sendNoteOn(1,127,5);
    stopState = 0;  
  }

I have tried the code with the 'if' statements changed to 'switch/case' e.g. in the place of:

Code:
 if (stopState == HIGH) {    
    MIDI.sendNoteOn(1,127,5);
  }

I tried:

Code:
   switch (stopState) {    
      case HIGH:
      MIDI.sendNoteOn(1,127,5);
      break;
  }


Thanks in advance for anything you might offer.

14  Using Arduino / Project Guidance / Re: Arduino won't power on with jumper cables patched [Uno + Sparkfun MIDI shield] on: October 27, 2012, 04:38:55 pm
Not that I particularly *wanted* to revive a thread that is nearly a year old, but a few months went by before I finally had a chance to push forward on the problem described above, and thought I would offer my findings in case it might help someone else later on.

It turns out that there was a short in the connector at the other end of my signal cable; so yes, PeterH, my circuit was causing the problem. Replacing the connector at that end allowed me to run the sketch.  Thank you for your help.
15  Using Arduino / Programming Questions / Re: MIDI through on Sparkfun MIDI shield on: January 17, 2012, 12:05:57 pm
Pardon me.
I copied the wrong code. This includes MIDI.h from the Playground (http://arduino.cc/playground/Main/MIDILibrary) at the top of the sketch, which I thought would provide MIDI through.

I see now on the Playground page that I "must call the MIDI.begin method" so I tried adding "MIDI.begin;" immediately before "Serial.begin(31250);" but got "error: statement cannot resolve address of overloaded function" when compiling.

Indeed I am not at all clear on how to arrive at mirroring signal in to out so if there is a better, simpler, or smarter way to do this with the MIDI Shield then I am entirely grateful.

(I would post MIDI.h code but it exceeds the maximum allowable of characters per post.)

Code:
/* Midi In Basic  0.2 // kuki 8.2007
 *
 * -----------------
 * listen for midi serial data, and light leds for individual notes

 IMPORTANT:
 your arduino might not start if it receives data directly after a reset, because the bootloader thinks you want to uplad a new progam.
 you might need to unplug the midi-hardware until the board is running your program. that is when that statusLed turns on.

#####################################################################################################################################################
SOMETHING ABOUT MIDI MESSAGES
 midi messages start with one status byte followed by 1 _or_ 2 data bytes, depending on the command

 example midi message: 144-36-100
   the status byte "144" tells us what to do. "144" means "note on".
   in this case the second bytes tells us which note to play (36=middle C)
   the third byte is the velocity for that note (that is how powerful the note was struck= 100)
 
 example midi message: 128-36
   this message is a "note off" message (status byte = 128). it is followed by the note (data byte = 36)
   since "note off" messages don't need a velocity value (it's just OFF) there will be no third byte in this case
   NOTE: some midi keyboards will never send a "note off" message, but rather a "note on with zero velocity"
 
 do a web search for midi messages to learn more about aftertouch, poly-pressure, midi time code, midi clock and more interesting things.
#####################################################################################################################################################

HARDWARE NOTE:
The Midi Socket is connected to arduino RX through an opto-isolator to invert the midi signal and seperate the circuits of individual instruments.
connect 8 leds to pin2-pin9 on your arduino.

####################################################################################################################################################


 */

//variables setup

byte incomingByte;
byte note;
byte velocity;


int statusLed = 13;   // select the pin for the LED

int action=2; //0 =note off ; 1=note on ; 2= nada


//setup: declaring iputs and outputs and begin serial
void setup() {
 
  #include <MIDI.h>
 
  pinMode(statusLed,OUTPUT);   // declare the LED's pin as output
  pinMode(2,OUTPUT);
  pinMode(3,OUTPUT);
  pinMode(4,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
  pinMode(8,OUTPUT);
  pinMode(9,OUTPUT);
 

 
  //start serial with midi baudrate 31250 or 38400 for debugging

  Serial.begin(31250);
  digitalWrite(statusLed,HIGH); 
}

//loop: wait for serial data, and interpret the message
void loop () {
  if (Serial.available() > 0) {
    // read the incoming byte:
    incomingByte = Serial.read();

    // wait for as status-byte, channel 1, note on or off
    if (incomingByte== 144){ // note on message starting starting
      action=1;
    }else if (incomingByte== 128){ // note off message starting
      action=0;
    }else if (incomingByte== 208){ // aftertouch message starting
       //not implemented yet
    }else if (incomingByte== 160){ // polypressure message starting
       //not implemented yet
    }else if ( (action==0)&&(note==0) ){ // if we received a "note off", we wait for which note (databyte)
      note=incomingByte;
      playNote(note, 0);
      note=0;
      velocity=0;
      action=2;
    }else if ( (action==1)&&(note==0) ){ // if we received a "note on", we wait for the note (databyte)
      note=incomingByte;
    }else if ( (action==1)&&(note!=0) ){ // ...and then the velocity
      velocity=incomingByte;
      playNote(note, velocity);
      note=0;
      velocity=0;
      action=0;
    }else{
      //nada
    }
  }
}

void blink(){
  digitalWrite(statusLed, HIGH);
  delay(100);
  digitalWrite(statusLed, LOW);
  delay(100);
}


void playNote(byte note, byte velocity){
  int value=LOW;
  if (velocity >10){
      value=HIGH;
  }else{
   value=LOW;
  }

 //since we don't want to "play" all notes we wait for a note between 36 & 44
 if(note>=36 && note<44){
   byte myPin=note-34; // to get a pinnumber between 2 and 9
   digitalWrite(myPin, value);
 }

}


Pages: [1] 2