Use of StandardFirmata with M-duino 57R+ PLC

Hello,

I am trying to use a Firmata protocol to communicate with my PLC (M-duino 57R+).
I am trying to link Arduino, Python and LabVIEW with different libraries and I have been able to make it work on an Arduino Uno.
I just received my PLC and I just want to launch the StandardFirmata (File>Examples>Firmata>StandardFirmata) code in Arduino, but I got an error:

Arduino: 1.8.19 (Windows 10), Board: "M-Duino family, M-Duino 57R+"

C:\Program Files (x86)\Arduino\libraries\Firmata\utility\SerialFirmata.cpp: In member function 'Stream* SerialFirmata::getPortFromId(byte)':

C:\Program Files (x86)\Arduino\libraries\Firmata\utility\SerialFirmata.cpp:249:15: error: 'Serial2' was not declared in this scope

       return &Serial2;

               ^~~~~~~

C:\Program Files (x86)\Arduino\libraries\Firmata\utility\SerialFirmata.cpp:249:15: note: suggested alternative: 'Serial1'

       return &Serial2;

               ^~~~~~~

               Serial1

C:\Program Files (x86)\Arduino\libraries\Firmata\utility\SerialFirmata.cpp:253:15: error: 'Serial3' was not declared in this scope

       return &Serial3;

               ^~~~~~~

C:\Program Files (x86)\Arduino\libraries\Firmata\utility\SerialFirmata.cpp:253:15: note: suggested alternative: 'Serial1'

       return &Serial3;

               ^~~~~~~

               Serial1

exit status 1

Error compiling for board M-Duino family.



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

As of now, I have been able to get analog data from a potentiometer with a serial communication thanks to the code below:

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(I0_2);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (5.0 / 1023.0);
  // print out the value you read:
  Serial.println(voltage);
  delay(100);
  }

By the way, I am using Arduino 1.8.19 and I use the M-duino family board on COM4. I also tried on my work pc and personal pc to see if it was a firewall issue and I get the same error.

Thank you for your help

It seems that your core does something wrong. The manufacturer specifies your board to be Arduino Mega compatible but your core doesn't define Serial2 and Serial3. As your PLC doesn't offer the Serial2 and Serial3 pins to be used it might make sense to hide these ports but then you have to do the work completely. Your manufacturer didn't. As your PLC is fairly high priced I would contact your supplier to fix that, for that price commercial support should be included.

This is not an error caused by the Arduino IDE or the Firmata library.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.