Trouble reading from Expansion Ports

Hi folks, 

Just trying to experiment and hook up a Maxbotix EZ1 sonar in the APM1's expansion ports. 

I've written my own test loop in the CLI interface which is very basically saying...

value6 = analogRead(6);
value7 = analogRead(7);

Serial.printf_P(PSTR("Ref6: %d\t Ref7: %d\t\n"), value6, value7);

and seeing if I can detect the voltage output from pin3 of the sensor. It works fine when connected to the pitot connection, but not the expansions. 

I'm aware I'll still need to do further manipulation for accurate range, however I'm not getting anything?

Any ideas?

Thanks. 

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • I've tried reading multiple references but again still no luck.

    value6 = analogRead(6);

    value7 = analogRead(7);

    value90 = analogRead(90);

    value91 = analogRead(91);

    valuePF6 = analogRead(PF6);

    valuePF7 = analogRead(PF7);

    //valueADC6 = analogRead(ADC6);

    //valueADC7 = analogRead(ADC7);

    (ADC6 / ADC7 create compile errors saying they are not referenced - is this my problem?)

    By printing via - Serial.printf_P(PSTR("6: %d\t 7: %d\t 90: %d\t 91: %d\t PF6: %d\t PF7: %d\t \n"), value6, value7, value90, value91, valuePF6, valuePF7);

    Print output is constant - 6: 42 7: -110 90: 110 91: -32 PF6: 40 PF7: 83

    Anyone? Sorry just frustrating when it seems something that should be simple isn't working. 

    Cheers. 

  • Edit / Update. 

    I have a sneaking suspicion I might need to change the source of the sonar to the analogue pins as defined in the initial definition of the sonar class instead of the ADC (Can I hook up two sonars at once? - what I'm trying to do) I'm just not sure where SONAR_SOURCE_ADC and SONAR_SOURCE_ANALOG_PIN are defined. 

This reply was deleted.

Activity