Go Down

Topic: IR Sensors Read, Compare, and Output Code? (Read 1 time) previous topic - next topic

holmes4

As the code you posted is full of 3 second delays I can't see any chance of you geting it to work. You need to look at blink without delay

Mark

Edwin7

Correct, I tried to use the PulseIn() code but I was not sure how to make it read for only a 1 second or less. My issue is reading in data from the sensors like a frequency or an array of voltages via analog input. I tired an array and it was just a mess and the code was all over the place since I am not familiar with arrays at all in any programming language.

AWOL

Quote
could result in a negative numbers and thus greatly changing the indifference in comparison.

Difficult to see how the result of an abs operation could return a negative value, but I'm ready to be surprised.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

SAButter

#7
Nov 28, 2012, 09:26 am Last Edit: Nov 28, 2012, 09:29 am by SAButter Reason: 1
I know I'm new to programming but I don't see anything in the sketch to count the wheel or shaft revolutions within a given amount time.

I'm thinking that most automotive ABS cycle something like every 200ms or less. Counting the inputs pulses with in a specific amount of time doing some math like you have above. Then determining if in fact the drive wheels are slipping. I'm thinking you have everything to make it work but you missing a bit of programming.

If your lucky maybe some programming guru will help your team pass you final for tomorrow.  ;)

SAButter

#6
Nov 28, 2012, 07:22 am Last Edit: Nov 28, 2012, 08:14 am by SAButter Reason: 1
I know I'm new to the site but is it possible that the code below.
Code: [Select]
int FrontCompare = abs(ReadFRS - ReadFLS)
or
int TotalCompare = abs(ReadRS - FrontAverage);

could result in a negative numbers and thus greatly changing the indifference in comparison.

I guess if you keep making left hand turns you should be ok for the FrontCompare. ;)


Go Up