A 4-channel AD input module that can measure voltage and current. You can select current (0~20mA) or voltage (0~10V) input by setting the dip switch.
1. #include "CFMEGA.h" library registration
2. CFNET object creation: CFNET object name ⇒ CFNET cfnet;
3. Call the function(s): Object name.analogRead(); ⇒ cfnet.analogRead(0,0);
Reads the analog value of the corresponding channel of the specified address module. (about 0~26,666)
address: The address of the module as configured by its DIP switch (0~3)channel: Channel number (0~3)#include "CFMEGA.h" CFNET cfnet; void setup() { Serial.begin(9600); } void loop() { u16 CH0 = cfnet.analogRead(0, 0); u16 CH1 = cfnet.analogRead(0,1); Serial.print("CH0:"); Serial.print(CH0); Serial.print("\n"); Serial.print("CH1:"); Serial.print(CH1); Serial.print("\n"); delay(200); Serial.print("\n"); }