All Tutorials / Steve G / Using ADC (Analog to Digital) Ports, Commands and Controls.

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

Step 4. ADC Script Commands.

In the EZ-Builder 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)