#include <Arduino.h>
// Define the Serial port you want to use
#define CI_PLUS_SERIAL Serial1 // Change to Serial if using pins 0 and 1
void setup() {
// Initialize Serial Monitor for debugging
Serial.begin(9600);
while (!Serial) {
; // Wait for Serial to initialize
}
// Initialize the CI+ Module Serial
CI_PLUS_SERIAL.begin(115200); // Adjust baud rate as needed
Serial.println("CI+ Module Communication Initialized.");
}
void loop() {
// Check if there is data available from the CI+ module
if (CI_PLUS_SERIAL.available()) {
String data = CI_PLUS_SERIAL.readStringUntil('\n'); // Read until newline
Serial.print("Received from CI+: ");
Serial.println(data);
}
// Example command to send to CI+ module
// Replace with actual command as per the CI+ protocol
if (Serial.available()) {
String command = Serial.readStringUntil('\n'); // Read from Serial Monitor
CI_PLUS_SERIAL.println(command); // Send command to CI+ module
Serial.print("Sent to CI+: ");
Serial.println(command);
}
delay(100); // Add delay to avoid overwhelming the serial communication
}