Strange Question

Hey guys I have a weird question.Basically I want to make a project that requires more pins than an arduino uno can offer. I have 2 arduino uno though and because it s a bit hard for me to use I2C communication between them I was thinking to use the analog pins to transfer information. I am new in arduino area so i was thinking if I use anlogWrite from one arduino and analogRead from the other and by connecting the first analog Pin of the 2 arduino, will it be harmful to the to devices?

Strange only in the way you want to solve your problem. Forget about using two Arduinos it is a common beginners mistake.

Instead look at adding more pins.

  1. you can use the Analogue input pins as digital input or outputs.
  2. use a shift register to get more inputs or outputs than you will ever need.
  3. use a port expander chip connected to either the I2C pins or the SPI pins.

analogWrite() sends a series of pulses. For a human looking at an LED this appears to dim the LED. But it is actually on at full brightness for part of the time.

If you read this with an analogRead() you will randomly get either off or on and very little in between.

You could use pulseIn() to read the width of the pulses but that is very rarely done. There is usually a better way to solve the problem.

[quote author=Ioannis Demetriades date=1522001356 link=msg=3662917]
Hey guys I have a weird question.Basically I want to make a project that requires more pins than an arduino uno can offer.[/quote]

Do you need more inputs, or outputs, or both? Digital? Analog? There are techniques to attack each of these.

You can use a smoothing circuit to get a true analog output from analogWrite() but I'm not necessarily recommending this solution. analogRead() is slow so it's not an efficient way to communicate.

Another solution to consider is to buy an Arduino Mega.

Look guys sorry for the confusion. I want to make a circuit that uses a LCD Display(162), a 44 matrix Pad, a servo and an ultrasonic sensor. The LCD will display the measurements of the ultrasonic sensor and the 4*4 Pad will be used to enter the password for the servo to rotate and also to choose between options shown on the LCD.
I have 2 arduino uno and a nano. Can i proceed to the project with a single arduino device or it will require 2?

How pins are you using for each device (and of what type)? That will tell you what type of pins you need more of.

One option would be to connect the display via I2C. That would require only two pins instead of six, but that doesn't help without the answer to question one to see how many more you need.

You can connect two Arduinos together but that will require pins. If you connect via I2C (example available in the reference section) then why not just connect the LCD via I2C and skip the hardware and software complexity.

Can i proceed to the project with a single arduino device

YES!

Any shortage of pins can be got round.

Thanks a lot. It works by using the analog Pins for the 4*4 matrix pad