Hi,
So, quistion is, could I add 3 ultrasonic sensors to one pin (for example, 2). And how code should look like to controll these sensors?
Thanks for yours' answers.
Hi,
So, quistion is, could I add 3 ultrasonic sensors to one pin (for example, 2). And how code should look like to controll these sensors?
Thanks for yours' answers.
It does not seem likely to be possible.
Why are you considering doing this ?
I wanna to make robot with 3 ultrasonic sensors on 1 pin, because I will add 1 photocell, 3 leds, 2 buttons, motor shield. For motor shield needs about 6 pins, but I have only Arduino Uno.
UNO has 20 I/O pins.
It sounds like you have plenty of pins free without the need to try doubling up the sensors. The Uno has 14 digital pins and 6 analogue pins that can be used as digital if required.
Arduino has 14 digital inputs/outputs, 6 analog inputs/outputs.
Motor shield uses about 6 pins;
Photocell uses 1 analog pin;
Button usses 1 pin (2 buttons - 2 pins);
Led uses 1 pin (3 leds - 3 pins);
Ultrasonic sensor 2 pins (1 pin as output, other as input) (3 ultrasonic sensors - 6 pins)
So, I will use 1 analog pin and about 17 digital pins. But I wanna to use as less pins as posible. It is why asks you is it possoble to use 3 ultrasonic sensors on 1 pin as input, on another pin as output.
Another quistion:
is it possible to use motor shield's pins on LCD, because mycmotor shield uses pins, which needs LCD to use. Please help !! Thx.
The analog pins also work as digital pins.
Thanks for everyone, who answered.
And, sorry for my stupid head, how to connect piezo buzzer to Arduyino? Thanks for answer.
It's best to avoid the conflict by choosing shields which don't use clashing pins. There are usually alternatives for each type of shield and you may be able to find a combination that will work together. Alternative, replace one of the shields with a separate board. For example there are various motor drivers which are not shields, but separate boards which you would connect with wires. As a last resort you can use an in-between shield to redirect the pins between layers. Mayhew Labs make them, and no doubt other companies do too.
It's only saving one pin, but it's possible to connect multiple pushbutton switches to a single analog input using a resistor ladder. It makes it much more complicated and would only be worth the bother if you were critically short of pins.
I haven't done it or seen anyone else do it, but it might be possible to connect the three ultrasonic inputs back to a single pin. Obviously they would need separate output pins. Again, I would only bother doing this if you were critically short of pins. To do it I suggest you get a single sensor working correctly, and then try connecting up a second sensor and see whether the first sensor still works. If you get lucky, try adding the third sensor. It might not work, but you have nothing to lose by trying.
While assigning pins, keep pins 0 and 1 free if at all possible since these are needed to use the serial connection to the PC.
syvanaLTU:
Thanks for everyone, who answered.
And, sorry for my stupid head, how to connect piezo buzzer to Arduyino? Thanks for answer.
Connect the same as the speaker in this tutorial:
http://arduino.cc/en/Tutorial/Tone
It's best to avoid the conflict by choosing shields which don't use clashing pins. There are usually alternatives for each type of shield and you may be able to find a combination that will work together. Alternative, replace one of the shields with a separate board. For example there are various motor drivers which are not shields, but separate boards which you would connect with wires. As a last resort you can use an in-between shield to redirect the pins between layers. Mayhew Labs make them, and no doubt other companies do too.
It's only saving one pin, but it's possible to connect multiple pushbutton switches to a single analog input using a resistor ladder. It makes it much more complicated and would only be worth the bother if you were critically short of pins.
I haven't done it or seen anyone else do it, but it might be possible to connect the three ultrasonic inputs back to a single pin. Obviously they would need separate output pins. Again, I would only bother doing this if you were critically short of pins. To do it I suggest you get a single sensor working correctly, and then try connecting up a second sensor and see whether the first sensor still works. If you get lucky, try adding the third sensor. It might not work, but you have nothing to lose by trying.
While assigning pins, keep pins 0 and 1 free if at all possible since these are needed to use the serial connection to the PC.
Thanks for your anser, it helped ![]()
Connect the same as the speaker in this tutorial:
http://arduino.cc/en/Tutorial/Tone
Thanks, that you showed, how to cennect, because I am ,,green" on Arduino and programmingXD
syvanaLTU:
Connect the same as the speaker in this tutorial:
http://arduino.cc/en/Tutorial/ToneThanks, that you showed, how to cennect, because I am ,,green" on Arduino and programmingXD
That's okay. None of us was born knowing this and most of us have head start. You will come along as your time and life (all the other things you do) and interests permit.
This is our hobby and the forum is our community. You are welcome to join and you are already here.
The questions you ask and answers you get can be seen by others who may also learn.