Pages: 1 ... 4 5 [6] 7 8 9   Go Down
Author Topic: Need some help for a science project.  (Read 7922 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I tried to do sweep with my Uno, and it decided that it does not want to work anymore, so now I have to do a completely different science project.
Logged

Robots are cool.

Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I also have an extra that I haven't touched at all and that isn't working either.
Logged

Robots are cool.

Beijing
Offline Offline
Full Member
***
Karma: 3
Posts: 193
Skype name habib.derbyshire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Aw... Sorry to hear that. Don't drop Arduino now you've picked it up though...
Logged

What is man's best friend? The breadboard!

Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nevermind. It was a false alarm.  smiley-roll
Logged

Robots are cool.

Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

However, one of them did die on me. Whenever I plug the USB in, the green LED turns on and then immediately turns off. 
Logged

Robots are cool.

Beijing
Offline Offline
Full Member
***
Karma: 3
Posts: 193
Skype name habib.derbyshire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The led on the servo, on the computer or on the Arduino? If it's on the Arduino, there's a short circuit and you must be very careful or you might destroy your Arduino.
Logged

What is man's best friend? The breadboard!

Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Arduino.
Logged

Robots are cool.

Beijing
Offline Offline
Full Member
***
Karma: 3
Posts: 193
Skype name habib.derbyshire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The green led? YOu mean the TX and RX leds?
Logged

What is man's best friend? The breadboard!

Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, that's what I'm talking about. It started working again though.
Logged

Robots are cool.

Beijing
Offline Offline
Full Member
***
Karma: 3
Posts: 193
Skype name habib.derbyshire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The TX and RX leds only flash when your uploading a sketch.
Logged

What is man's best friend? The breadboard!

Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Woops. I actually meant the ON LED.  smiley-roll
Logged

Robots are cool.

Beijing
Offline Offline
Full Member
***
Karma: 3
Posts: 193
Skype name habib.derbyshire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You must be careful when that happens. It means there's a short circuit somewhere.
Logged

What is man's best friend? The breadboard!

Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is getting out of hand... I'm doing everything it says in this tutorial, (http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html) and it still isn't working... I have to have this thing done by February 4th, and this is worth a TON of points, so if it doesn't get done, my grade will suffer...
Logged

Robots are cool.

Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wait a second... How do I add a servo? Here's the line of code.
Quote
  // attach the servos
  for(int nServo = 0;nServo < CONNECTED_SERVOS;nServo++)
  {
    myServos[nServo].attach(SERVO_TO_PIN(nServo));
  }

Logged

Robots are cool.

Online Online
Faraday Member
**
Karma: 80
Posts: 3797
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

At the top of DuaneB's code it says this...

Code:
#include <Servo.h>
// Sample sketch for driving 12 Servos from an Arduino UNO, servos are attached to digital pins 2,3,4,5,6,7,8,9,10,11,12,13

#define CONNECTED_SERVOS 12

It sweeps a whole load of servos on those pins....

So to attach servos to the board, you control them by putting their yellow / orange wires into those pins.

(The #define CONNECTED_SERVOS 12 tells it there are 12 and you could reduce that number I guess to just have however servos you have)

This part:

 
Code:
// attach the servos
  for(int nServo = 0;nServo < CONNECTED_SERVOS;nServo++)
  {
    myServos[nServo].attach(SERVO_TO_PIN(nServo));
  }


... uses the value of "CONNECTED_SERVOS" which is 12 if you didn't alter it at the top as the upper limit of a counter in a loop and runs the "attach" line as many times as you have servos to as many pins as there are servos.

This is an automated way of doing what I showed you a few posts back where I had something like myservo.attach and anotherservo.attach. The myServos[nServo] in Duane's code is a way of automating say myServos5 and myServos9 or whatever where nServo is a variable instead of hardcoding the same line a stack of times each with a different number.
« Last Edit: January 26, 2013, 12:13:53 am by JimboZA » Logged

Although I answer in good faith, remember always: Your Mileage May Vary.
Get me on LinkedIn: za.linkedin.com/in/jimbrownza/

Pages: 1 ... 4 5 [6] 7 8 9   Go Up
Jump to: