Show Posts
Pages: 1 ... 13 14 [15] 16 17 ... 30
211  Using Arduino / General Electronics / Re: Audio switching on: January 25, 2013, 11:45:54 am
Not really, we are talking a hifi audio level signal.
212  Using Arduino / General Electronics / Audio switching on: January 25, 2013, 11:33:17 am
I need to switch multiple audio signals to multiple locations ie (A to B), (A to C) or (A to B & C) plus (D to E), (D to F) or (D to E & F) so basically multiple inputs which get switched to either 1 of 2 outputs, neither or both.

Just wondering what technique people would use to do this.....  The actual switching logic is a high pin from the arduino, a low pin would be off so basically A comes in and if pin 10 is high it goes to B and if pin 11 is high it also goes to C, either being low will turn that output off.  I would prefer to keep the audio signals isolated from the data board so would prefer not to connect the audio ground to the data board's ground and then switch the signal pins using transistors but would this be best?  What do people think.....  This is effectively like a computerised source switch for an amplifier.

The actual signal is an audio signal either un-amplified, line level or headphone level (I will not know before hand). 
213  Using Arduino / Project Guidance / Re: Using additional serial ports of 2560 for USB keyboard and MIDI control on: January 20, 2013, 03:00:35 pm
Hmmm....

What about plan D......

Active USB to PS2 keyboard adapter then emulate PS2 keyboard........  That is just serial data isn't it?  Will check library smiley-grin
214  Using Arduino / Project Guidance / Re: Using additional serial ports of 2560 for USB keyboard and MIDI control on: January 19, 2013, 05:37:08 pm
As this is a one off build for my own use and not to build for other people or several times I have decided on using a 2560 as the main controller which will be connected to the desktop computer, GLCD, SD card reader etc etc with a Leonardo as an add on board controlling the keyboard I/O..... Probably not the most elegant solution but at least it will work.
215  Using Arduino / Project Guidance / Re: Using additional serial ports of 2560 for USB keyboard and MIDI control on: January 19, 2013, 05:25:37 pm
Quote
reverting to plan B
That being a Leonardo?

No plan B was using a USB keyboard and messing with the mapping but since typing "plan B" I have just starting on "plan C" and I am searching on ebay for a Leonardo smiley
216  Using Arduino / Project Guidance / Re: Using additional serial ports of 2560 for USB keyboard and MIDI control on: January 19, 2013, 05:22:19 pm
Quote
How do I make Keyboard use Serial2 instead of serial0
That would all depend on what Keyboard is, wouldn't it? That's why snippets don't cut it.

If Keyboard is a library, you'll need to modify it to use a different Serial instance. You'll also need to figure out how to connect that Serial instance to the device that is on the receiving end.

Only the Serial instance is connected to the USB to serial converter chip/USB port.

Paul,

I was going to connect another FTDI chip to serial port 2, just as the original is connected to port 0 or am I barking up the wrong tree?


DOH!

Just realised that the "Keyboard" command is not supported on the 2560...... reverting to plan B
217  Using Arduino / Project Guidance / Using additional serial ports of 2560 for USB keyboard and MIDI control on: January 19, 2013, 05:10:32 pm
I'm building a musical control device which I want to be able to connect to a computer so will be using the standard TX & RX pins for the normal USB comms so that the arduino can talk to a desktop program BUT I am also wanting to connect to a MIDI keyboard and control the computer as if a USB keyboard (to start/stop/rewind DAW etc)....

Now MIDI....   Looking at the MIDI example it seems very much a straight forward job, just change serial to serial1

so......

Code:
void setup() {
  //  Set MIDI baud rate:
  Serial1.begin(31250);
}

void loop() {
  // play notes from F#-0 (0x1E) to F#-5 (0x5A):
  for (int note = 0x1E; note < 0x5A; note ++) {
    //Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
    noteOn(0x90, note, 0x45);
    delay(100);
    //Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
    noteOn(0x90, note, 0x00);   
    delay(100);
  }
}

//  plays a MIDI note.  Doesn't check to see that
//  cmd is greater than 127, or that data values are  less than 127:
void noteOn(int cmd, int pitch, int velocity) {
  Serial1.write(cmd);
  Serial1.write(pitch);
  Serial1.write(velocity);
}



Now I need to control an application running on the computer using the arduino pretending to be a USB keyboard.....

now this the main issue at the moment......

Code:
const int buttonPin = 2;          // input pin for pushbutton
int previousButtonState = HIGH;   // for checking the state of a pushButton
int counter = 0;                  // button push counter

void setup() {
  // make the pushButton pin an input:
  pinMode(buttonPin, INPUT);
  // initialize control over the keyboard:
  Keyboard.begin();
}

void loop() {
  // read the pushbutton:
  int buttonState = digitalRead(buttonPin);
  // if the button state has changed,
  if ((buttonState != previousButtonState)
    // and it's currently pressed:
  && (buttonState == HIGH)) {
    // increment the button counter
    counter++;
    // type out a message
    Keyboard.print("You pressed the button ");
    Keyboard.print(counter);
    Keyboard.println(" times.");
  }
  // save the current button state for comparison next time:
  previousButtonState = buttonState;
}


How do I make Keyboard use Serial2 instead of serial0
218  Using Arduino / Interfacing w/ Software on the Computer / Re: Cowascript - AVRDUDE HEX uploader etc for MacOS & Linux on: January 09, 2013, 05:31:51 pm
You are getting there smiley-grin

Looks like it just cannot locate the AVRDUDE application.  Should just be a matter of changing the location in the script.
219  Using Arduino / Installation & Troubleshooting / Re: Serial monitor broken ? on: November 08, 2012, 01:19:51 pm
PROBLEM SOLVED.....


The box [No line ending...New line...CR.....etc etc] had moved to "No line ending"

DOH!
220  Using Arduino / Installation & Troubleshooting / Re: Serial monitor broken ? on: November 08, 2012, 01:13:13 pm
I just quickly wrote this to test it:



Code:
char inputString[50];
int stringPos=0;

void setup() {
  Serial.begin(115200);
  Serial.println("Quick test");
}

void loop() {
  if (Serial.available()>0){
    digitalWrite(13, HIGH);
    Serial.println(Serial.available());
  } else {
    digitalWrite(13, LOW);
  }
  if (Serial.available()>0) {
    char inChar = (char)Serial.read();
    inputString[stringPos]= inChar;
    stringPos=min(stringPos+1,50);
    if (inChar == '\n') {
      digitalWrite(10, HIGH);
      delay(100);
      digitalWrite(10, LOW);
      Serial.println(inputString);
      stringPos = 0;
      for (byte i = 0; i < 50; i++) {inputString[i]=(char)0;}
    } else {
      Serial.print("Part = ");
      Serial.println(inputString);
    }
  }
}


And it works fine.....  BUT it still doesn't work in the original sketch or previous versions that WERE working fine.

Investigating......
221  Using Arduino / Installation & Troubleshooting / Re: Serial monitor broken ? on: November 08, 2012, 01:11:39 pm
Quote
Yes as stated in OP thanks.
which terminal emulator?

Part of the desktop program which communicates with the board.......


However.....
222  Using Arduino / Installation & Troubleshooting / Re: Serial monitor broken ? on: November 08, 2012, 12:51:16 pm
Does the loopback test work? Can confirm the USB path is all working.
http://arduino.cc/forum/index.php/topic,73748.0.html

No I've not done that but I have two identical boards here both of which are working perfectly using my own serial comms program in both directions.  Both also send data which the computer receives only issue is the serial monitor sending data which does not work.
223  Using Arduino / Installation & Troubleshooting / Re: Serial monitor broken ? on: November 08, 2012, 12:48:31 pm
Have you tried a terminal emulator?

Yes as stated in OP thanks.
224  Using Arduino / Installation & Troubleshooting / Serial monitor broken ? on: November 08, 2012, 12:14:00 pm
I have been using the serial monitor for trouble shooting and communicating with a 168p on a custom board with no problems whatsoever.  Suddenly now it will no longer talk to the chip !

If I communicate with the 168p via some test software I wrote (which includes a serial monitor) it works fine.
The sketch when running on a friends Windows PC and using the same board works fine
Sketches from weeks ago when it was still working work fine
The baud rate is set correctly
It RECEIVES data from the 168p and happily displays this correctly.

So basically if I enter text into the text box and press return or click send the 168p does not get it and if I do the same with my own serial monitor it does.

So it appears that a setting has gone astray or broken OR the IDE is damaged.

I've tried renaming the Arduino package within Applications (MAC) and reinstalling a fresh version which does the same.

It's just annoying that I can't use the built in monitor......


Any ideas?
225  Using Arduino / Programming Questions / Setting up a block of space on: July 06, 2012, 05:14:08 am
Is it possible to setup a block of RAM using constants?

<I am going to use compiler commands which make what I want to do obvious but they are just made up and/or mixed with old assembler commands in order to demonstrate what I want.>


In assembler I could do something like:

Code:
loc_hello: #defstring "Hello",0
loc_Goodbye: #defstring "Goodbye",0
loc_Error: #defstring "Error",0

so that referring to "loc_Goodbye" would give the address of the "G" in "Goodbye" etc

I could even replace the "Hello" with a constant from a table so....

Code:
loc_hello: #defstring $const_hello$

Also each of the definitions is relative to the previous one...  Is it possible to make one relative to another but offset by a fixed amount so:

Code:
loc_hello: #defstring "Hello",0
loc_Goodbye: #defstring "Goodbye",0
a1: #defspace (30-a1-loc_hello)
loc_Error: #defstring "Error",0

So that loc_Error is 30 bytes after loc_hello ??


Also is it possible to compile code to the EEPROM ???

So that I could have say the text for the sketch compiled straight to the EEPROM rather than programming space?
Pages: 1 ... 13 14 [15] 16 17 ... 30