Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: How to use functions? on: January 07, 2014, 12:58:31 pm
Arduino IDE - 1.0-beta1 ( Arduino SDK 1.0.5 ),
Compiles fine for me too.  That's a rather odd version string; are you using some IDE other than the one from
The error you're seeing is about what I'd expect if something was NOT doing the usual pre-processing of .ino files into .cpp files.

You can probably "fix" it by moving your function to BEFORE the loop() definition.

Yes, I fix it by moving the function BEFORE the loop() definition. Than you very much.

Thank You all for responses.

Regards, from Pál
2  Using Arduino / Programming Questions / How to use functions? on: January 07, 2014, 11:51:29 am
I'm trying to build a simple code in Arduino IDE - 1.0-beta1 ( Arduino SDK 1.0.5 ),
but sofar unsuccessfully.

I download the code:
int trigPin = 2;
int echoPin = 4;
void setup() {
void loop(){
  long duration;
  float cm;
  pinMode(echoPin, INPUT);
  pinMode(trigPin, OUTPUT);
  digitalWrite(trigPin, LOW);
  digitalWrite(trigPin, HIGH);
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  cm = microsecondsToCentimeters(duration);
float microsecondsToCentimeters(long microseconds){
  return (microseconds*0.034029)/2;

but get an error when trzing to build it:
error: ‘microsecondsToCentimeters’ was not declared in this scope
Compilation failed.

I red the
but still don't understand what is here the problem?
Wat am I missing here?
3  Using Arduino / Project Guidance / Re: Using Arduino Uno and relay FRS1B in a Robot Arm project on: April 21, 2012, 02:38:01 am
If you replace the relay and transistor with a LED and resistor, does the LED turn on and off?
When I replace the relay and transistor with a LED and resistor (220 Ohm), and run the program, the LED does turn on and off,
however it doesn't work on pin 13 (switch) and pin 12 (relay) but only on pin 4 (switch) and pin 2 (relay). Does it mean that that I
messed the Arduino? smiley-sad

I have more difficulties here: the switch isn't so good and I realise yesterday that that if I replace the switch with two wires on the breadboard, then LED works always right, however I don't understand why turn on/off LED when the "switch" is off (LOW) and not when the "switch" is on (HIGH)? Regarding to the programcode it should works in another way instead.

Yesterday I soldered the end of wires so that I get more reliable connections on breadboard and Arduino connectors.

Sorry for my mistake, I realised these days that , that I did put instead a normal diode a zenner diode to protect the relay. Sorry, I'm a newbe in electronics. So now I replace the zenner diode with the 1N407 diode.

Any advices?
4  Using Arduino / Project Guidance / Using Arduino Uno and relay FRS1B in a Robot Arm project on: April 19, 2012, 12:11:21 am

I made a project called 'Robot Arm with Electromagnet' that has been published here:

Arduino Uno with a program controls two servos and should controls the electromagnet in the and of the arm.
If a switch is off then one can control the arm (only servos) with potentiometers.
If a switch is on then the program controls the arm: two servos and electromagnet.

The schematic can be seen here:

My problem is that that relay doesn't switch on/off the electromagnet.
The electromagnet is always switched on.

I use the FRS1B relay and the 2N1613 transistor in the project.

The programcode can be downloaded from here:

Why doesn't work relay?

Regards, from Pál
5  Using Arduino / Project Guidance / Re: Controlling two servos with two potentiometers simultaneously on: March 07, 2012, 04:33:23 pm

Think you need to slow it down a little, so a longer delay. Furthermore add some debug statements what values are read.

It can also be a matter of power, if you unhook one servo does the other start working?

// Ketto szervo helyzetet vezerli potenciometerrel (valtoztathato ellenallas)
// 2012, Copyright Santa Krisztian

#include <Servo.h>

Servo szervo1;  // szervo1 objektum letrehozasa az egyik szervo vezerlesehez
Servo szervo2;  // szervo2 objektum letrehozasa a masik szervo vezerlesehez

int potpin1 = 2;  // analog lab csatlakozik az egyik potenciometerhez
int potpin2 = 5;  // analog lab csatlakozik a masik potenciometerhez

int val1;    // valtozo, amely olvassa az egyik analog lab erteket
int val2;    // valtozo, amely olvassa a masik analog lab erteket

void setup()
  szervo1.attach(9);  // az egyik szervot csatolja a 9-es labon a szervo1 objektumhoz
  szervo2.attach(11);  // az egyik szervot csatolja a 3-as labon a szervo2 objektumhoz

void loop()
  val1 = analogRead(potpin1);            
  val1 = map(val1, 0, 1023, 0, 179);    
  Serial.print("Val1 = ");
  val2 = analogRead(potpin2);            
  val2 = map(val2, 0, 1023, 0, 179);    
  Serial.print("Val2 = ");
Indeed, the 'delay(200)' did it to works, although with slow motion.

So I have now a "robot arm" with two servos that I can control with two potentiometers.

Before I uploaded this code abowe, I tried advices and yes, if I unhooked one servo the other started working.

The problem is solved (thank you very much!!), however, how can I read the added debug statements what values are read is?

Regards, from Pál
6  Using Arduino / Project Guidance / Controlling two servos with two potentiometers simultaneously on: March 06, 2012, 04:25:51 pm

I want to try controlling two servos with two potentiometers simultaneously.
There is a Fritzing Starter Kit and a project for servo but only with one potentiometer and one servo:

I edited that code and the result can be seen in my attachment.

When uploaded to Arduino UNO (smd) the program doesn't works althought everything is connected properly.

So where is the problem in the code?

Any advices will be appreciated!

Regards, from Pál
7  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: To have reference designs in gEDA & PCB files on: January 01, 2011, 04:12:48 am
Darn - I installed PCB on my system (from the repository), and your version was newer than mine, so it won't load the board; gschem had no problem with the schematic, though.

I probably just need to upgrade my system (on Ubuntu 9.10) - I just hate doing it, because it invariably breaks things, then I sit there for a week trying make all my crap work again...
My system is Debian GNU/Linux Squeeze and have had installed PCB from Debian package repository too, but I delete this installation. I downloaded then PCB from and installed it so it works.  smiley-grin
8  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: To have reference designs in gEDA & PCB files on: December 30, 2010, 02:20:00 am
Thanks!  smiley-grin
9  Forum 2005-2010 (read only) / Bugs & Suggestions / To have reference designs in gEDA & PCB files on: December 18, 2010, 08:41:22 am

I wish to have reference designs not only in EAGLE files but also in gEDA gschem and PCB files too.

Pages: [1]