Let's Make Robots!

Comparing multiple Arduino inputs

Hi,

 

This is probably very simple, but is there an easy way to find which of multiple arduino inputs is greatest/least?

All I can think of is using lots of  if/else's. I tried googling it but found no relevent results.

 

I am thinking of between 10-16 inputs, so if/ else's would not be very practical.

 

Thanks, 

HC-SR04 Problems

Hi all,

A while ago I bought a HC-SR04 Ultrasonic Sensor, and it worked fine, but now I want to use it on a robot and I am having some problems.

 

When I output the data from the sensor to the serial monitor this is the result:

 

MS: 204551, CM: 3702.51, IN: 1457.68

MS: 1526, CM: 27.62, IN: 10.87

MS: 204613, CM: 3703.63, IN: 1458.12

MS: 847, CM: 15.33, IN: 6.04

MS: 204630, CM: 3703.94, IN: 1458.24

MS: 613, CM: 11.10, IN: 4.37

MS: 204615, CM: 3703.67, IN: 1458.13

MS: 419, CM: 7.58, IN: 2.99

MS: 204636, CM: 3704.05, IN: 1458.28

MS: 785, CM: 14.21, IN: 5.59

MS: 204656, CM: 3704.41, IN: 1458.43

MS: 1598, CM: 28.92, IN: 11.39

MS: 204688, CM: 3704.99, IN: 1458.65

MS: 1553, CM: 28.11, IN: 11.07

MS: 204715, CM: 3705.48, IN: 1458.85

MS: 1526, CM: 27.62, IN: 10.87

MS: 204726, CM: 3705.68, IN: 1458.93

MS: 1544, CM: 27.95, IN: 11.00

MS: 204715, CM: 3705.48, IN: 1458.85

MS: 1519, CM: 27.49, IN: 10.82

MS: 204745, CM: 3706.02, IN: 1459.06

MS: 1523, CM: 27.57, IN: 10.85

MS: 204733, CM: 3705.80, IN: 1458.97

As you can see only every second reading is accurate.

Stepper motor

Hi, just a basic question, but I have a stepper here with four wires coming out of it one of which is gnd,

Is it a three or four wire Stepper motor?

I am slightly confused so any anwser would be appreciated,

Cheers