Using ADC (Analog to Digital) Ports, Commands and Controls.

Step 4. ADC Script Commands.

In the ARC script menu, you will find some script commands that can be used with the ADC ports.

ADC_Wait (ADC Port number, higher/lower/equals, ADC value, [delay ms])

This will wait until an ADC ports value in your script is either "higher" or "lower" than specified value you have chosen. The "Delay MS" command is the millisecond delay for checking and works out the delay between value reads. This command is optional.

EZ-Script menu examples using ADC port "A0".

ADC_Wait(ADC0, HIGHER, 50) ADC_Wait(ADC0, HIGHER, 50, 50)

ADC_Wait_Between (ADC Port number, low, high, [delay ms])

This command will pause a script until the ADC port reading is in between two values (a high value, and a low value). Once met, the script will begin to run. As before, the "Delay MS" command is the millisecond delay for checking and works out the delay between value reads. This is also is optional.

EZ-Script menu examples using ADC port "A0".

ADC_Wait_Between(ADC0, 20, 50) ADC_Wait_Between(ADC0, 20, 50, 50)

GetADC( Port )

This will return the 8 Bit ADC value of the ADC port you have chosen.

EZ-Script menu example using ADC port "A0".

$x = GetADC(adc0)

Another example of this script command can be found being used, in step 8.

GetADC12( Port )

Returns the 12 Bit ADC value of the specified port on the EZ-B v4

EZ-Script menu example using ADC port "A0".

Example: $x = GetADC12(adc0)


ARC Pro

Upgrade to ARC Pro

ARC Pro is more than a tool; it's a creative playground for robot enthusiasts, where you can turn your wildest ideas into reality.

PRO
USA
#1  

can this detect the audio for a jaw movement on a robot?

PRO
Canada
#2  

If you have a analog audio level sensor (has a microphone) hooked up to the ADC you can detect the strength of audio levels.

You may be able to run the audio from the speaker breakout on the EZ-B v4 or IoTiny to an analog pin, I've never tried it but in theory it would work. It's a 3.3V audio amplifier. Although, it might mess up your audio if you still want audio going to the speaker. Worth a try I suppose.