I used 0.1875 because the test program I found to read the ads1115 aux3 used it. In your ino. file the WAS bit shifts by three. What exactly does that mean?
//get steering position
if (aogSettings.SingleInputWAS) //Single Input ADS
{
steeringPosition = ads.readADC_SingleEnded(0); //ADS1115 Single Mode
steeringPosition = (steeringPosition >> 3); //bit shift by 3 0 to 3320 is 0 to 5v
I have button selected and sent that to the arduino.
I will try using raw data and change the byte to a int since it doesn’t need decimal places like a long would give.
The >> is called a bit shift operator. 16 >> 1 would result in 8, 16 >>2 would be 4. Its like really efficient division where the bits are shifted over either left or right.
So in the ADS code for WAS, value >> 3 is the same as value/8.
Remember int goes from -32768 to +32767 whereas uint goes from 0 to 65535.
I guess the real question is if I go with raw data on aux 3 of the ads1115 with 0 to 5 volts coming in will it be 0 to 3320 still? That’s what I am after with the 2000 I had.
After watching a youtube video on bit shifting it looks like bits can get lost off the end if you don’t use decimals. Is that why you have to use an unsigned long to prevent that issue?
I think i just used unsigned long but could have used an uint as well. Yes, the bits just fall off the end. All you are “losing” is whether the real answer is 2345.5678 or just 2345.
I have a similar setup with a 5volt pressure transducer on valve, is this code working with your setup now? How is it wired into your PCB board. Thanks
Yes, I have it working. I tweaked the trigger amount a little lower to make it work better. I have it coming into the ads1115 marked aux 2 on the side of the PCBV2. In the code it has to be ads.readADC_SingleEnded(3) however since that’s where it actually ends up on the ads1115.
I modified your code to this to be able to adjust the sensibility of the steering disengagement by the pressure transducer with the encoder setting in Aog is this correct
//modif le 22/03/21 ====================================================
if (aogSettings.ShaftEncoder)
{
SteeringWheelPressureReading = ads.readADC_SingleEnded(3);
SteeringWheelPressureReading = (SteeringWheelPressureReading >> 3); //bit shift by 3 0 to 3320 is 0 to 5v
if ((pulseCount >= aogSettings.PulseCountMax)||(SteeringWheelPressureReading >=(aogSettings.PulseCountMax*100)))
{
steerSwitch = 1;
currentState = 1;
previous = HIGH;
}
}
looks promising. When version 4.6 comes out ill have to try it out. 1300 or 13 with the conversion in your code seemed to be a good amount for my setup. I look forward to trying it.
Hello, I got some questions on this 5 volt pressure sender . I got the V2 board running on UDP V5.6 software in a nano. I am steering a old hydraulic cat challenger I can’t find and info on what pin the signal go’s to to reference the pressure in AOG , I got one set up with a simple pressure switch ( it trips the switch when you turn ) but it works very poorly on the encoder input as when you grab the wheel it closes the switch , it is not a pulse till you let off the wheel. So AOG just keeps steering, but humans tend to keep steering and not let off the wheel . I tried to look through the Adruio ino code to determine what pin could do this or that but I am still lost . My other plan was to use a 555 timer to drive the encoder input so it would see a pulse instead of a constant voltage. But it seem like a lot of stuff to add if this sensor input works. By the way I got a Tennsy driving PANDA over UDP also. Any advice would be greatly appreciated