Show Posts
Pages: [1] 2
1  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Why are most examples using variables for pin num on: October 27, 2009, 11:15:23 am
Okay after reading a bit of the const vs define discussions found on google, I think i can comprehend why const is better in some situations than define. (eg. if you need to define a string it would take up more propmem to use define instead of a variable, given the string is used in multiple places)
2  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Why are most examples using variables for pin num on: October 27, 2009, 11:05:45 am
But doesnt a const variable take up RAM just like a normal variable ?
3  Forum 2005-2010 (read only) / Bugs & Suggestions / Why are most examples using variables for pin num on: October 27, 2009, 11:00:22 am
Hi! I was wondering why most of the examples use a integer variable for defining the pin used instead of the #define compiler command?

Wouldn't it be more "correct" to use define as pin numbers are unlikely to be changed at runtime? (Also #define shouldn't take up any memory of the atmega as its more or less a search & replace done by the compiler.. afaik)

I apologise if this is a retarded question..
4  Forum 2005-2010 (read only) / Scandinavia / Re: Til alle Danskere on: October 27, 2009, 08:54:50 am
1, Her på siden og gennem diverse andre websider.

2, Selve arduinoen købte jeg igennem svenske electrokit.se.. Eller dvs. min kæreste købte den til mig i gave der fra.

3, Den kan fås både som kit (saml selv) og færdig samlet

4, Det ved jeg ikke, men som sagt, hvad skal man med en lille håndfuld mennesker når man har hele det enegelsk sprogede internet at lære fra..

5,  smiley
5  Forum 2005-2010 (read only) / Scandinavia / Re: Nogen danskere ? on: November 22, 2009, 03:05:34 pm
Det ser sku godt ud Aniss1001!

har lagt mærke til dine projekter - spændende smiley!


Har hentet dit Oscilloskop for noget tid siden, har ikke lige prøvet det endnu
6  Forum 2005-2010 (read only) / Scandinavia / Re: Nogen danskere ? on: October 27, 2009, 08:57:43 am
Jeg er også fra Danmark... Odense for at være præcis.
7  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino resets when powered by 9v battery on: September 24, 2009, 01:39:48 am
Thanks.. I will try that.

Im quite the newbie, so a quick guide on how to do it would be greatly appreciated :-)
8  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino resets when powered by 9v battery on: September 23, 2009, 11:01:21 am
Okay problem solved.. It was just a bad battery, went down to the store and bought a new one, and problem solved...

Thanks for the replies
9  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino resets when powered by 9v battery on: September 23, 2009, 09:24:59 am
I did a little further troubleshooting and the sketch seems to run fine if i disconnect the "motor" (causing the bot to stand still and only turn when a "collision" occours.

I also tried making it go backwards with motorServo.write(50) instead of setting it to 0 degrees, but that was a nogo..

Is there any chance of me getting this to work with a 9v battery?

10  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino resets when powered by 9v battery on: September 23, 2009, 09:18:05 am
Okay so i experimented a bit and tried to power the arduino by a solarcharged USB battery (through the arduino USB port) and it works fine.. But im still clueless to why it resets when its on a 9v
11  Forum 2005-2010 (read only) / Troubleshooting / Arduino resets when powered by 9v battery on: September 23, 2009, 08:43:13 am
Hi! Im trying to make a small bot that turns around when ever it hits something.. I made it out of cardboard and the sensor that detects a collision is two pieces of aluminum foil that acts as a button. (With a 5kohm pulldown resister between the pin and ground)

The thing is run by two servos (one acts as the "motor" the other one is for steering)

When i power the bot through USB everything works fine, but when i try to power it by a 9v battery the arduino seems to reset when the bot goes from backwards direction to forwards.

the 9 V battery is attached to Vin & gnd


Here is my code:
Code:
#include <Servo.h>

int frontSensorPin = 12;
int motorServoPin = 3;
int turnServoPin = 5;

int initialized = 0;
Servo motorServo;
Servo turnServo;

void setup(){
  turnServo.attach(turnServoPin);
  pinMode(frontSensorPin, INPUT);
  pinMode(13, OUTPUT);

  randomSeed(analogRead(0));
  turnServo.write(79); //go straight
}

void loop(){
  if(initialized != 0){
   motorServo.write(110); //Go forward
   turnServo.write(79); //go straight
   if(digitalRead(frontSensorPin) == HIGH){
   //Turn in a random direction and go backwards if sensor is activated
     if(random(10) > 5){
       turnServo.write(60);
     } else {
       turnServo.write(100);
     }
     motorServo.write(0);
     delay(3000); //Arduino seems to reset after this delay when powered by 9V
   }
  
  } else {
     delay(1000);
     digitalWrite(13, HIGH);
     delay(1000);
     digitalWrite(13, LOW);
     if(digitalRead(frontSensorPin) == HIGH){
       initialized = 1;
       motorServo.attach(motorServoPin);
     }    
  }
}

The servos are attached according to the servo tutorials..

Is the servos drawing too much power, causing the arduino to reset, or what exactly is going on here?
12  Forum 2005-2010 (read only) / Interfacing / Re: Multiple servos (5!) on: November 09, 2009, 11:51:31 am
Okay, thanks mike!



Great tutorials be the way : )


13  Forum 2005-2010 (read only) / Interfacing / Re: Multiple servos (5!) on: November 09, 2009, 07:19:19 am
It works with the servos im using so thats not really an issue for me..


But back to the topic. You guys believe that i will need an external powersource for the servos, right?

The ground of the powersupply should be connected to the ground of the arduino, right?
14  Forum 2005-2010 (read only) / Interfacing / Re: Multiple servos (5!) on: November 09, 2009, 07:13:14 am
Pauls: The datawire will not allow you to read a servos position, you can read it with the servo libary, but that is just the last write you get really..

Grumpy_mike: I have soldered a wire to the potentiometer in the servo.. reading this is trivial and works okay (The resolution is good enough for my usage)

When i read the potentiometer i simply detach the servo with the servo libary, this works fine! (Theres no need to read it while the servo is attached anyways as you wouldnt be able to move it..)

The project im doing is a robotic arm, programmable by moving it.
15  Forum 2005-2010 (read only) / Interfacing / Multiple servos (5!) on: November 09, 2009, 06:14:03 am
Hi im currently doing a project where i need 5 servos connected to the arduino, all running simultaniously.


I guess i will be needing an external powersupply for this. (Either a battery pack or preferably a 5v adapter?)

what would be the best way to do this? Can i harm the arduino by running all servos through the 5v rail ?

I need to read the servo's potentiometer through analogread, would there be any trouble doing so with an external supply for the servos?
Pages: [1] 2