Show Posts
Pages: [1]
1  Using Arduino / General Electronics / Solder points on a pet laser toy? on: October 06, 2013, 05:25:13 pm
I pulled the diode out of a pet laser and I'm stumped on where to solder this thing. The negative was easy enough to find a solder point for, I just removed the contact switch and soldered a wire to that. But the positive I'm having problems with.

I thought that the positive just ran through the metal of the case and connected to the metal surrounding the diode, but it turns out that what I thought was metal was plastic. When the soldering iron touched it, it melted to a black color and gave off a smell of burning plastic:



This picture shows what happened when I touched the soldering iron to the "metal."  The solder was not successful. What I want to do is control the laser sort of like an LED. It will be mounted on a servo that will wave the laser around for a cat. I was wondering if anyone else out there has attempted to use one of these in a project and could guide me in the right direction.
2  Using Arduino / Programming Questions / Re: Problems with playground servo tutorial on: October 05, 2013, 03:09:32 pm
Thanks agju, it compiles fine now and it uploaded to my uno. But now I can't figure out how to control it, the servo just sits there doing nothing smiley-sad

I've tried sending 0-9, w,a,s, and d through the serial monitor, but I'm not even sure if thats how this sketch was meant to be controlled.
3  Using Arduino / Programming Questions / (Solved)Problems with playground servo tutorial on: October 05, 2013, 02:46:29 pm
Hello all. I'm trying to learn how to control servos but I'm having a problem with the tutorial I'm trying to follow in the playground (http://playground.arduino.cc/Learning/SingleServoExample).

When I try to compile the example sketch in the tutorial I get a bunch of errors concerning the servo.cpp file:

Code:
C:\Arduino\libraries\Servo\Servo.cpp: In member function 'uint8_t Servo::attach(int)':
C:\Arduino\libraries\Servo\Servo.cpp:28: error: 'digitalWrite' was not declared in this scope
C:\Arduino\libraries\Servo\Servo.cpp:29: error: 'OUTPUT' was not declared in this scope
C:\Arduino\libraries\Servo\Servo.cpp:29: error: 'pinMode' was not declared in this scope
C:\Arduino\libraries\Servo\Servo.cpp: In member function 'void Servo::write(int)':
C:\Arduino\libraries\Servo\Servo.cpp:52: error: 'clockCyclesPerMicrosecond' was not declared in this scope
C:\Arduino\libraries\Servo\Servo.cpp: In static member function 'static void Servo::refresh()':
C:\Arduino\libraries\Servo\Servo.cpp:74: error: 'millis' was not declared in this scope
C:\Arduino\libraries\Servo\Servo.cpp:107: error: 'digitalWrite' was not declared in this scope
C:\Arduino\libraries\Servo\Servo.cpp:109: error: 'TCNT0' was not declared in this scope
C:\Arduino\libraries\Servo\Servo.cpp:124: error: 'digitalWrite' was not declared in this scope

I have done everything exactly as the tutorial said to do, but now I'm stuck. I searched the forums for a solution, but the only thing I found was someone with the same problem but didn't give enough information for anyone to help with a solution (http://forum.arduino.cc/index.php?topic=191509.0#). As was suggested in that thread, I made sure my sketch and servo library are in the correct folders, but it's still not compiling.

Anyone know what is happening?
4  Using Arduino / Installation & Troubleshooting / Re: Arduino Micro COM jumping? on: January 28, 2013, 02:05:20 pm
Thanks Lefty that gives me an idea of whats going on,  but I'm still stumped on how to fix it. I will look up guides on Leonardo and see if I can find anything.
5  Using Arduino / Installation & Troubleshooting / Arduino Micro COM jumping? on: January 28, 2013, 01:44:04 pm
I picked up an Arduino Micro from radioshack today and I'm having no luck with it so far.

I'm using windows vista. I installed the drivers just like I did for the Uno I have, and attempted to upload the blink example. As it was uploading I heard the USB disconnect sound, then the reconnect sound. The LED on the board was blinking, however the micro had moved from COM 5, to COM 6. I modified the blink example to blink different pins with leds hooked to them a few times, and each time I uploaded the sketch I would hear the usb disconnect and it would move to a different COM port. I went into control panel and tried to set it to COM 2. I choose COM 2 over the original COM 5, because COMs 5-8 (every COM it jumped to) were all "in use". I tried uploading a bigger sketch to see what would happen. I hooked up a gyroscope module and a full color LED, and used a simple program that would print the gyros sensor values to the serial monitor, and change the LED color based on the data. The device disconnected again and came back on COM 8. I opened the serial monitor, and nothing was printing. I hit the reset button on the micro and then it just vanished altogether. The disconnect sound played and nothing was available in the serial port menu until I restarted the computer and plugged the micro back in.

The sketch I uploaded didn't appear to be working either, as the LED didn't light up. Testing the sketch on my Uno proved the sketch worked as it's supposed to however. My Uno is still working fine, it stays put on COM 4 just like it's supposed to.

Does anyone have an idea of whats going on here, and how I can fix it?
6  Using Arduino / Programming Questions / Re: Arduino can't fade 2 LEDs at same time? on: January 04, 2013, 04:33:09 pm
Quote
What board are you using:-
Arduino Uno, the diagram next to the pins says pins 11, 10, 9, 6,5, and 3 are pwm pins.

Quote
Pin 1 is normally used for serial communications and should be avoided if possible.
Ah, good to know. I'm going to take the LED out of that pin then.

Quote
The Arduino can fade any number of LED at the same time. Not using delay(), though. That function absolutely, positively, has to do.
Wait... so why does it work one way but not the other then?
7  Using Arduino / Programming Questions / Arduino can't fade 2 LEDs at same time? on: January 04, 2013, 04:23:49 pm
Hello everyone, I'm trying to create an lighting effect with my arduino but I'm running into a bit of a problem. I have 13 LEDs hooked up in a row on my breadboard, connected to pins 1-13. The first led in the row is hooked to pin 11, and the last led is hooked to pin 2, which I understand to both be PWM pins. The effect I'm going for is for the first LED (hooked to pin 11) to start out at it's brightest, fade a bit, then the leds between the first and the last to turn on and off in order until they reach the last LED which brightens a bit, and so on, and so on until the first LED is off, and the last LED is at it's brightest, then it reverses going from last to first.

Whats happening instead is it works one way (from first LED to last), then when the order reverses the first LED just blinks on and off instead of fading up its brightness.

I'm new to C++ programming, so I'm wondering if I've messed up something in my code. Can someone take a look and let me know if they see anything that would cause this behavior?

Code:
int leds[]= {13, 12, 10, 9, 8, 7, 6, 5, 4, 2, 1};
int digLeds = 11;
int timer = 30;
int fadeLEDfront = 11;
int fadeLEDback = 3;

void setup() {
  for(int j = 0; j < digLeds; j++){
    pinMode(leds[j], OUTPUT);
  }
  analogWrite(fadeLEDfront, 255);
  analogWrite(fadeLEDback, 0);
}

void loop() {
  // LEDs pulse front to back
  for( int fade = 15; fade <= 255; fade += 15 ){
    analogWrite(fadeLEDfront, 255 - fade);
    for( int i = 0; i < digLeds; i++){
      digitalWrite(leds[i], HIGH);
      delay(timer);
      digitalWrite(leds[i - 1], LOW);
      delay(timer);
    }
    analogWrite(fadeLEDback, fade);
    digitalWrite(leds[digLeds - 1], LOW);
    delay(timer*3);
  }
 
  randomLightShow();

  //LEDs pulse back to front 
  for( int fade2 = 15; fade2 <= 255; fade2 += 15 ){
    analogWrite(fadeLEDback, 255 - fade2);
    for( int i = digLeds; i >= 0; i--){
      digitalWrite(leds[i], HIGH);
      delay(timer);
      digitalWrite(leds[i + 1], LOW);
      delay(timer);
    }
    analogWrite(fadeLEDfront, fade2);
    digitalWrite(leds[0], LOW);
    delay(timer*3);
  }
 
  randomLightShow();
  ledsOff();
   
}

void ledsOff(){
  for( int n = 0; n < digLeds; n++ ){
    digitalWrite(leds[n], LOW);
  }
}

//lights up LEDs randomly for random length of time
void randomLightShow(){
 
  int ranCycles = random(10,50);
  for( int r = 0; r < ranCycles; r++ ){
    int ranLength = random(1, digLeds);
    int ranArr[ranLength];
    ledsOff();
   
    //pick random LEDs
    for(int b = 0; b < ranLength -1; b++ ){
      int ranLED = random(0, digLeds);
      ranArr[b] = leds[ranLED];
    }
   
    for (int j = 0; j < ranLength -1; j++) {
      digitalWrite(ranArr[j], HIGH);
    }
    delay(timer);
    ledsOff();
  }
 
}
Pages: [1]