Arduino UNO r3-not working right

Hello every 1!

The thing happend yesterday.
I was messing up with 2 servos, and buttons.

/*
Arduino Servo Test sketch
*/
#include <Servo.h>
Servo servoMain; // Define our Servo
int button_pin = 4;
int button_state = 0;
int button_pin2 = 5;
int button_state2 = 0;
int servo_place = 5;
void setup()
{
  pinMode(button_pin, INPUT); 
  pinMode(button_pin2, INPUT);
   servoMain.attach(10); // servo on digital pin 10
   servoMain.write(0);
}

void loop()
{
  button_state = digitalRead(button_pin);
  button_state2 = digitalRead(button_pin2);
  
 if (button_state == HIGH) {     
   servo_place += 10;
   servoMain.write(servo_place);   // Turn Servo Left to 0 degrees
   delay(250);          // Wait 1 second
 }
 else
 {
   servo_place+=0;
 }
 
 if (servo_place >= 185)
 {
  servo_place = 180;
 }
 
 
 
  if (button_state2 == HIGH) {     
   servo_place -= 10;
   servoMain.write(servo_place);   // Turn Servo Left to 0 degrees
   delay(250);          // Wait 1 second
 }
 else
 {
   servo_place-=0;
 }
 
 if (servo_place <= -5)
 {
  servo_place = 0;
 }
 
}

Everything was working fine. After few hours my arduino stopped responding for usb power.
When i connect it by usb cable with external power source connected it looks like it’s working fine. :roll_eyes:

How can I fix it( if possible )?

Thank u!

I am afraid you are running at the limit of current you can get out of a USB port. General rule of thumb is ~100uA out of the port while your Polyfuse is rated at 500uA to cut power to protect your computer from your project.

If you are tripping that polyfuse, I would suspect you are drawing way too much current through your Atmega which could cook it.

So is there way to fix it? (Simple as replacing atmega 328?)

You need a separate servo driver with it's own power source. Something like this:

http://arduino.cc/en/Main/ArduinoMotorShieldR3 or http://www.adafruit.com/products/81

This way, you can run it off of your USB plus a 12v supply.

Ok. I was thinking about this :). But still my arduino is only working on other power source then usb. How can I get "usb power" back?

Edit: I got Arduino r3

You might have damaged the power circuit of your USB in the computer rather than on the Arduino I have killed the power in one of my computers USB Ports by accidentally shorting a connection on the Arduino.

Duane B

rcarduino.blogspot.com

I don't know if I killed the power. (my usb mouse works good (It dosent have other power source I think))

Arduino works rader fine. I don't like using 30x30 "brick" power source. 9v battery should do the thing?

I'll test it at my friends pc and tell you if it works.. ty! :D