1. Home
  2. Docs
  3. MC-EX-AM8 | Analog Input (4-20mA) Expansion Module
  4. Expansion Module Startup Guide
  5. Run Example Program

Run Example Program

  1. After following Figure 1(a),(b) diagrams instructions in Wiring Diagram section. Connect a Analog Input Expansion module in to the 40 pin board to board connector in CPU Module (Explained in MC-CPU-CM4-Gx datasheet).
  2. Now open Terminal Window after turn on the CPU Module.
  3. Type ‘i2cdetect -y 0’ command and run the command (Check Figure 1(b)).
  4. The result will be similar to the Figure 1 shown below.
  5. Here the ‘0x48’ & ‘0x49’ are the Analog Inputs expansion module I2C addresses, This I2C address can be changed according to user requirement by changing the DIP switch configuration on expansion module (Check Figure 1(a)).
Figure 1(a): DIP Switch Configuration Address present in Hexadecimal
Figure 1(b): The Analog Input Module I2C address check result.
  1. Follow the File Manager > Pi > Rpi_Moduler_test path, then open Rpi_Moduler_test folder.
  2. In Rpi_Moduler_test folder include example program for every expansion module.
  3. Select the MC_EX_ASC1115_Analog_IN_test.py example program that matches with the Analog Input expansion module shown in Figure 2.
Figure 2: The example programs for expansion modules.

9. The python program will open on default Thonny Python IDE. Click RUN for start the program shown in Figure 3.

Figure 3: Analog Input example code run on Thonny Python IDE.
Was this article helpful to you? Yes No

How can we help?