Show Posts
Pages: 1 [2]
16  Using Arduino / Programming Questions / Re: ShiftPWM and Tone Problem on: December 08, 2012, 04:43:42 pm
Hm this is getting complicated... do you know a library which plays tone with timer1 ? ShiftPWM Library says it would use timer1 by default and just because i uncomment the define statement it would use timer 2. But if i uncomment the define statement again he tries to use timer3 and not timer1 by default... so maybe i should contact the developer of this library.
// ShiftPWM uses timer1 by default. To use a different timer, before '#include <ShiftPWM.h>', add  #define SHIFTPWM_USE_TIMER2  // for Arduino Uno and earlier (Atmega328)
17  Using Arduino / Programming Questions / ShiftPWM and Tone Problem on: December 08, 2012, 04:02:25 pm
Hey, i got this ShiftPWM Library:
At the beginning of the code i got this statement:
If i just uncomment this i get this error message:
"The avr you are using does not have a timer3"
The problem is that i also want to play a tone on my piezo buzzer. Therefore i got this code:
for (int thisNote = 0; thisNote < 8; thisNote++) {
    int noteDuration = 1000/noteDurations[thisNote];
    tone(12, melody[thisNote],noteDuration);
    int pauseBetweenNotes = noteDuration * 1.30;

Which is working fine in a single project, but combined with the shiftpwm library and its define statment i get the following error message:
core.a(Tone.cpp.o): In function `__vector_7':
/Applications/ multiple definition of `__vector_7'
ShiftPWM_RGB_Example.cpp.o:/Users/david/Documents/Arduino/libraries/ShiftPWM/ShiftPWM.h:190: first defined here

So i went to the Tone.cpp file and i saw that there is also an timer2 statement which (in my opinion) causes this error.

I am new to this arduino stuff and i can make some minor bug fixes or something like that, but this error is too complicated for me at this time.
Do you have an idea how i can solve the puzzle ?

Btw if it helps you these are line 190 following from ShiftPW:
#elif defined(SHIFTPWM_USE_TIMER2)
//Install the Interrupt Service Routine (ISR) for Timer1 compare and match A.
and line 523 following from Tone.cpp:

  if (timer2_toggle_count != 0)
    // toggle the pin
    *timer2_pin_port ^= timer2_pin_mask;

    if (timer2_toggle_count > 0)
    // need to call noTone() so that the tone_pins[] entry is reset, so the
    // timer gets initialized next time we call tone().
    // XXX: this assumes timer 2 is always the first one used.
//    disableTimer(2);
//    *timer2_pin_port &= ~(timer2_pin_mask);  // keep pin low after stop
18  Using Arduino / LEDs and Multiplexing / Re: Light up RGB Led with 74hc595 on: December 06, 2012, 03:31:17 pm
shiftOut(dataPin, clockPin, MSBFIRST, 255);
See that 255, that is saying make all the outputs a one. That is light up all the LEDs. If you only want to light up one then use a number that has only one bit with a one in it.
Numbers like 1, 2, 4, 8, 16, 32, 64, or 128
How do you mean that ?
How can i get the right number to my led or how can i assign a number to one of my led's ?
19  Using Arduino / LEDs and Multiplexing / Light up RGB Led with 74hc595 on: December 06, 2012, 03:08:14 pm
Hey, i got a shift register (74hc595) and i'd like to light up my rgb led. Everything is connected but i have problems with the code.
Say my rgb led is connected to Q0,Q1 and Q2 of my shift register (Pin 15,1,2). How can i light up the rgb led (i want to switch between the color blue, green and red). I got this example which is working, but i don't know how to go on and how to achieve the thing mentioned above.

//  Name    : shiftOutCode, Hello World                               
//  Author  : Carlyn Maw,Tom Igoe, David A. Mellis
//  Date    : 25 Oct, 2006   
//  Modified: 23 Mar 2010                                 
//  Version : 2.0                                             
//  Notes   : Code for using a 74HC595 Shift Register           //
//          : to count from 0 to 255                           

//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;

void setup() {
  //set pins to output so you can control the shift register
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);

void loop() {
  // count from 0 to 255 and display the number
  // on the LEDs

    // take the latchPin low so
    // the LEDs don't change while you're sending in bits:
    digitalWrite(latchPin, LOW);
    // shift out the bits:
    shiftOut(dataPin, clockPin, MSBFIRST, 255);

    //take the latch pin high so the LEDs will light up:
    digitalWrite(latchPin, HIGH);
    // pause before next value:

This lights up my rgb led which is has the color white-blue with this code.
Please help me out and give me hints how to change the code so i can control whether my rgb led lights up green, red or blue.

Thanks ! smiley-roll-sweat
20  Using Arduino / Displays / Re: hook up LCD Shield on: November 29, 2012, 01:38:21 pm
Ok danke !
Habe es nun hinbekommen... habe einfach das shield aufgesetzt und die pins per female/male jumper wire nutzen können. Tatsächlich sind die Button nur auf A0... hatte ich wohl überlesen.
Also danke !
21  Using Arduino / Displays / hook up LCD Shield on: November 29, 2012, 12:02:19 pm
Hey, i got a LCD Shield from DFRobot:
Now i need to hook it up to my Arduino UNO, but i don't want the buttons (its a lcd + keypad) to waste my digital pins, because i dont need the keypad for my current project. So i thought i might not slide the shield above my arduino, but i connect it by myself via jumper wires, so i can only connect the pins i need or want. The lcd lights up when i connect Ground and 5V. But which pins from the lcd i need to connect to which pin of my arduino to change the text on the lcd ? i am not quite sure.
I posted the datasheet above, also here you can see a picture of the lcd

Hopefully someone can guide me through this smiley
22  Using Arduino / LEDs and Multiplexing / Re: Help with 3x3 RGB LED Matrix on: November 28, 2012, 04:52:46 pm
wow great answer... this really helps me
Anyway i found a solution by using multiple  74HC595.
23  Using Arduino / LEDs and Multiplexing / Help with 3x3 RGB LED Matrix on: November 28, 2012, 02:32:43 pm
Hey, i am beginner and i am working on my first "real" project. Therefore i need an 3x3 RGB LED. I am aware of the fact, that the Arduino hasn't got enough pins to control them all, but i heard something about a technique called Charlieplexing which makes this possible. Like i said i am a beginner and i hope that someone of you can help me out with it. Maybe someone of you did something similar before ? It would be super nice if someone could post me a Fritzing Graphic which shows me how to wire my LED's.

Thanks so much
Regards, David
Pages: 1 [2]